Correction de bug de navigation et gestion des highscores
This commit is contained in:
parent
f33aa6c989
commit
a73a6899ce
@ -160,7 +160,7 @@ MonoBehaviour:
|
|||||||
m_AlignByGeometry: 0
|
m_AlignByGeometry: 0
|
||||||
m_RichText: 1
|
m_RichText: 1
|
||||||
m_HorizontalOverflow: 0
|
m_HorizontalOverflow: 0
|
||||||
m_VerticalOverflow: 0
|
m_VerticalOverflow: 1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: 11:12:00
|
m_Text: 11:12:00
|
||||||
--- !u!114 &114502846675755674
|
--- !u!114 &114502846675755674
|
||||||
|
@ -1903,7 +1903,7 @@ MonoBehaviour:
|
|||||||
m_HorizontalOverflow: 1
|
m_HorizontalOverflow: 1
|
||||||
m_VerticalOverflow: 1
|
m_VerticalOverflow: 1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: Chargement...
|
m_Text: Chargement
|
||||||
--- !u!222 &494702548
|
--- !u!222 &494702548
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1960,7 +1960,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_Material: {fileID: 0}
|
m_Material: {fileID: 0}
|
||||||
m_Color: {r: 0.19607843, g: 0.78431374, b: 0, a: 1}
|
m_Color: {r: 1, g: 0.19607843, b: 0, a: 1}
|
||||||
m_RaycastTarget: 1
|
m_RaycastTarget: 1
|
||||||
m_OnCullStateChanged:
|
m_OnCullStateChanged:
|
||||||
m_PersistentCalls:
|
m_PersistentCalls:
|
||||||
@ -6009,7 +6009,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1543364354
|
--- !u!224 &1543364354
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -6048,7 +6048,7 @@ MonoBehaviour:
|
|||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_FontData:
|
m_FontData:
|
||||||
m_Font: {fileID: 12800000, guid: 8a697d283fb701b4a9a210c0e58f6a5e, type: 3}
|
m_Font: {fileID: 12800000, guid: 0c90228a5041e3e46870c5be76316d08, type: 3}
|
||||||
m_FontSize: 100
|
m_FontSize: 100
|
||||||
m_FontStyle: 0
|
m_FontStyle: 0
|
||||||
m_BestFit: 0
|
m_BestFit: 0
|
||||||
@ -7697,7 +7697,7 @@ MonoBehaviour:
|
|||||||
m_HorizontalOverflow: 1
|
m_HorizontalOverflow: 1
|
||||||
m_VerticalOverflow: 1
|
m_VerticalOverflow: 1
|
||||||
m_LineSpacing: 1
|
m_LineSpacing: 1
|
||||||
m_Text: Chargement...
|
m_Text: Chargement
|
||||||
--- !u!222 &2082426110
|
--- !u!222 &2082426110
|
||||||
CanvasRenderer:
|
CanvasRenderer:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -159,7 +159,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: fd3dd54012b3be2438dbc7f320e35e40, type: 3}
|
m_Script: {fileID: 11500000, guid: fd3dd54012b3be2438dbc7f320e35e40, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
InputDelay: 300
|
InputDelay: 200
|
||||||
PlayerPanelImage: {fileID: 492428415}
|
PlayerPanelImage: {fileID: 492428415}
|
||||||
PlayerPanelText: {fileID: 2039829331}
|
PlayerPanelText: {fileID: 2039829331}
|
||||||
Player2: 1
|
Player2: 1
|
||||||
@ -717,7 +717,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 1e789aa866dfadd4ab1c6223848940b5, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 2c13d450cb305d44a94d5aa553784944, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -2687,7 +2687,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 6a8f085d2aaf45944a3231f952e31ae9, type: 3}
|
m_Sprite: {fileID: 21300000, guid: e4fcb2606917da24cbf3a1f819a23aa6, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -3303,7 +3303,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 1, y: 1}
|
m_AnchorMax: {x: 1, y: 1}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: -20, y: -20}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &1117559510
|
--- !u!114 &1117559510
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -3324,7 +3324,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 5e5aa15eeebbb9b4d91b51b1be4d1b9a, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 2e777b13dd5485b4a97e59c8bd908059, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -4234,7 +4234,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 52f4e3480388c4d44a69d61037b9e748, type: 3}
|
m_Sprite: {fileID: 21300000, guid: c3e68ef6268b9064ca97e1462de7521c, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -4294,7 +4294,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: fd3dd54012b3be2438dbc7f320e35e40, type: 3}
|
m_Script: {fileID: 11500000, guid: fd3dd54012b3be2438dbc7f320e35e40, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
InputDelay: 300
|
InputDelay: 200
|
||||||
PlayerPanelImage: {fileID: 977855010}
|
PlayerPanelImage: {fileID: 977855010}
|
||||||
PlayerPanelText: {fileID: 1118367624}
|
PlayerPanelText: {fileID: 1118367624}
|
||||||
Player2: 0
|
Player2: 0
|
||||||
@ -4399,7 +4399,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 3f1c4bdd8395ac6429ff42fc32da9979, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 6a2422d51d4dfb744addfbfb14f54a4c, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -4598,7 +4598,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: c1892bf031c4dfe449720146bd70ceba, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 8f7323fb09091f74da79a90293cb02f1, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -4666,7 +4666,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 7c46cf47738bd4942a6ecf581cad1b86, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 74dd425457649a147928238b0894376c, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
@ -6061,7 +6061,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_Sprite: {fileID: 21300000, guid: 769f59da1a572b1498ca93ca6f4ce637, type: 3}
|
m_Sprite: {fileID: 21300000, guid: 20e11d603671b2c47a437c48eb9c4dae, type: 3}
|
||||||
m_Type: 0
|
m_Type: 0
|
||||||
m_PreserveAspect: 0
|
m_PreserveAspect: 0
|
||||||
m_FillCenter: 1
|
m_FillCenter: 1
|
||||||
|
@ -4,14 +4,15 @@ using System;
|
|||||||
public abstract class BaseInputBehavior : MonoBehaviour
|
public abstract class BaseInputBehavior : MonoBehaviour
|
||||||
{
|
{
|
||||||
protected DateTime lastInput;
|
protected DateTime lastInput;
|
||||||
public int InputDelay = 100;
|
public int InputDelay = 300;
|
||||||
|
|
||||||
protected bool IsSpawned
|
protected bool IsSpawned
|
||||||
{
|
{
|
||||||
get { return lastInput == null || (DateTime.Now - lastInput).Milliseconds < InputDelay; }
|
get {
|
||||||
|
//return false;
|
||||||
|
return (DateTime.Now - lastInput).Milliseconds < InputDelay;
|
||||||
|
return (DateTime.Now - lastInput).Milliseconds < InputDelay;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -67,6 +67,19 @@ public class GameManager : MonoBehaviour
|
|||||||
public string SubmitP2 = "SubmitP2";
|
public string SubmitP2 = "SubmitP2";
|
||||||
public string CancelP2 = "CancelP2";
|
public string CancelP2 = "CancelP2";
|
||||||
|
|
||||||
|
// public string XAxis = KeyCode.UpArrow;
|
||||||
|
// public string YAxis = KeyCode.DownArrow;
|
||||||
|
// public string Submit = KeyCode.Return;
|
||||||
|
// public string Cancel = KeyCode.RightControl;
|
||||||
|
// public string XAxisP1 = KeyCode.UpArrow;
|
||||||
|
// public string YAxisP1 = KeyCode.DownArrow;
|
||||||
|
// public string SubmitP1 = KeyCode.Return;
|
||||||
|
// public string CancelP1 = KeyCode.RightControl;
|
||||||
|
// public string XAxisP2 = KeyCode.Z;
|
||||||
|
// public string YAxisP2 = KeyCode.S;
|
||||||
|
// public string SubmitP2 = KeyCode.Space;
|
||||||
|
// public string CancelP2 = KeyCode.LeftControl;
|
||||||
|
|
||||||
//public static GameManager Instance {get {return _instance; } }
|
//public static GameManager Instance {get {return _instance; } }
|
||||||
public static GameManager Instance
|
public static GameManager Instance
|
||||||
{
|
{
|
||||||
@ -83,8 +96,8 @@ public class GameManager : MonoBehaviour
|
|||||||
private States _status;
|
private States _status;
|
||||||
public States Status { get { return _status; } }
|
public States Status { get { return _status; } }
|
||||||
|
|
||||||
public HighscoreEntry EntryP1 = new HighscoreEntry { time = new TimeSpan(0, 0, 0, 28, 20) };
|
public HighscoreEntry EntryP1 = new HighscoreEntry { time = new TimeSpan(0, 0, 0, 28, 20) };
|
||||||
public HighscoreEntry EntryP2 = new HighscoreEntry { time = new TimeSpan(0, 0, 0, 40, 20) };
|
public HighscoreEntry EntryP2 = new HighscoreEntry { time = new TimeSpan(0, 0, 0, 40, 20) };
|
||||||
|
|
||||||
// Skins of the two players
|
// Skins of the two players
|
||||||
private int[] _skins = new int[2];
|
private int[] _skins = new int[2];
|
||||||
@ -269,7 +282,7 @@ public class GameManager : MonoBehaviour
|
|||||||
hm.SetMessageActive(true);
|
hm.SetMessageActive(true);
|
||||||
hm.SetMessage("PRETS ?");
|
hm.SetMessage("PRETS ?");
|
||||||
// Timer
|
// Timer
|
||||||
yield return new WaitForSeconds(2f);
|
yield return new WaitForSeconds(3f);
|
||||||
hm.SetMessage("PEDALEZ !");
|
hm.SetMessage("PEDALEZ !");
|
||||||
startTime = Time.time;
|
startTime = Time.time;
|
||||||
hm.SetActiveChrono (true);
|
hm.SetActiveChrono (true);
|
||||||
|
@ -19,7 +19,6 @@ public abstract class Tachometer : MonoBehaviour {
|
|||||||
|
|
||||||
public void SetPlayer(int playerID) {
|
public void SetPlayer(int playerID) {
|
||||||
inputID = "WheelP" + (playerID + 1);
|
inputID = "WheelP" + (playerID + 1);
|
||||||
|
|
||||||
LoadConfig(playerID);
|
LoadConfig(playerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,10 +2,12 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Video;
|
using UnityEngine.Video;
|
||||||
|
using System;
|
||||||
|
|
||||||
public class VideoManager : MonoBehaviour {
|
public class VideoManager : MonoBehaviour {
|
||||||
|
|
||||||
private VideoPlayer videoPlayer;
|
private VideoPlayer videoPlayer;
|
||||||
|
private int id;
|
||||||
public float speed {get; set; }
|
public float speed {get; set; }
|
||||||
public bool setUp = false;
|
public bool setUp = false;
|
||||||
public bool finish = false;
|
public bool finish = false;
|
||||||
@ -16,6 +18,7 @@ public class VideoManager : MonoBehaviour {
|
|||||||
|
|
||||||
public void SetSkin(int playerID) {
|
public void SetSkin(int playerID) {
|
||||||
videoPlayer = gameObject.AddComponent<VideoPlayer>();
|
videoPlayer = gameObject.AddComponent<VideoPlayer>();
|
||||||
|
id = playerID + 1;
|
||||||
|
|
||||||
var gm = GameManager.Instance;
|
var gm = GameManager.Instance;
|
||||||
|
|
||||||
@ -32,6 +35,7 @@ public class VideoManager : MonoBehaviour {
|
|||||||
videoPlayer.skipOnDrop = true;
|
videoPlayer.skipOnDrop = true;
|
||||||
videoPlayer.isLooping = false;
|
videoPlayer.isLooping = false;
|
||||||
videoPlayer.playOnAwake = false;
|
videoPlayer.playOnAwake = false;
|
||||||
|
videoPlayer.renderMode = VideoRenderMode.MaterialOverride;
|
||||||
videoPlayer.prepareCompleted += VideoReady;
|
videoPlayer.prepareCompleted += VideoReady;
|
||||||
videoPlayer.Prepare();
|
videoPlayer.Prepare();
|
||||||
}
|
}
|
||||||
@ -54,8 +58,10 @@ public class VideoManager : MonoBehaviour {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Update () {
|
void Update () {
|
||||||
if (!finish) {
|
|
||||||
|
if (!finish ) {
|
||||||
videoPlayer.playbackSpeed = taco.GetPlayerSpeed ();
|
videoPlayer.playbackSpeed = taco.GetPlayerSpeed ();
|
||||||
|
Debug.Log ("Player" + id + " : " + videoPlayer.playbackSpeed);
|
||||||
} else {
|
} else {
|
||||||
videoPlayer.playbackSpeed = 1f;
|
videoPlayer.playbackSpeed = 1f;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ public class HighscoreRecordMenuManager : BaseInputBehavior
|
|||||||
{
|
{
|
||||||
if (WaitText != null) {
|
if (WaitText != null) {
|
||||||
WaitText.gameObject.SetActive (true);
|
WaitText.gameObject.SetActive (true);
|
||||||
WaitText.text = "En attente du joueur " + (Player2 ? "1" : "2");
|
WaitText.text = "En attente du joueur " + (Player2 ? "Orange":"Vert");
|
||||||
|
|
||||||
}
|
}
|
||||||
if (Recorders[OtherPlayerIndex]!=null && Recorders[OtherPlayerIndex].Finished)
|
if (Recorders[OtherPlayerIndex]!=null && Recorders[OtherPlayerIndex].Finished)
|
||||||
@ -90,13 +90,15 @@ public class HighscoreRecordMenuManager : BaseInputBehavior
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(SubmitButtonName))
|
if (!string.IsNullOrEmpty(SubmitButtonName))
|
||||||
{
|
{
|
||||||
if (Input.GetButton(SubmitButtonName))
|
if (Input.GetButton(SubmitButtonName) && !string.IsNullOrEmpty(GetPseudo()))
|
||||||
{
|
{
|
||||||
|
System.Threading.Monitor.Enter (HighscoresManager.Current);
|
||||||
if (HighscoresManager.Current.IsANewRecord(Entry))
|
if (HighscoresManager.Current.IsANewRecord(Entry))
|
||||||
{
|
{
|
||||||
Entry.pseudo = GetPseudo();
|
Entry.pseudo = GetPseudo();
|
||||||
HighscoresManager.Current.AddNewEntry(Entry);
|
HighscoresManager.Current.AddNewEntry(Entry);
|
||||||
}
|
}
|
||||||
|
System.Threading.Monitor.Exit (HighscoresManager.Current);
|
||||||
Finish();
|
Finish();
|
||||||
//GameManager.Instance.DisplayMenu();
|
//GameManager.Instance.DisplayMenu();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -35,16 +36,25 @@ public class HighscoresManager
|
|||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
Entries.Clear();
|
Entries.Clear();
|
||||||
Entries.Add(new HighscoreEntry { rank = 1, pseudo = "Toto", transport = 0, time = new TimeSpan(0, 0, 0, 50, 30) });
|
Entries.Add(new HighscoreEntry { rank = 1, pseudo = "Fausto", transport = 0, time = new TimeSpan(0, 0, 0, 50, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 2, pseudo = "Tata", transport = 0, time = new TimeSpan(0, 0, 0, 55, 30) });
|
Entries.Add(new HighscoreEntry { rank = 2, pseudo = "Raymond", transport = 1, time = new TimeSpan(0, 0, 0, 55, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 3, pseudo = "Titi", transport = 0, time = new TimeSpan(0, 0, 0, 52, 30) });
|
Entries.Add(new HighscoreEntry { rank = 3, pseudo = "Louison", transport = 2, time = new TimeSpan(0, 0, 0, 52, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 4, pseudo = "Tutu", transport = 0, time = new TimeSpan(0, 0, 0, 42, 30) });
|
Entries.Add(new HighscoreEntry { rank = 4, pseudo = "Marco", transport = 2, time = new TimeSpan(0, 0, 0, 42, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 5, pseudo = "Popo", transport = 0, time = new TimeSpan(0, 0, 0, 40, 30) });
|
Entries.Add(new HighscoreEntry { rank = 5, pseudo = "Jeannie", transport = 3, time = new TimeSpan(0, 0, 0, 40, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 6, pseudo = "Papa", transport = 0, time = new TimeSpan(0, 0, 0, 50, 0) });
|
Entries.Add(new HighscoreEntry { rank = 6, pseudo = "Nathalie", transport = 6, time = new TimeSpan(0, 0, 0, 50, 0) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 7, pseudo = "Mama", transport = 0, time = new TimeSpan(0, 0, 1, 30, 30) });
|
Entries.Add(new HighscoreEntry { rank = 7, pseudo = "Eddy", transport = 4, time = new TimeSpan(0, 0, 1, 30, 30) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 8, pseudo = "Mimi", transport = 0, time = new TimeSpan(0, 0, 1, 50, 10) });
|
Entries.Add(new HighscoreEntry { rank = 8, pseudo = "Bernard", transport = 5, time = new TimeSpan(0, 0, 1, 50, 10) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 9, pseudo = "Nana", transport = 0, time = new TimeSpan(0, 0, 1, 55, 0) });
|
Entries.Add(new HighscoreEntry { rank = 9, pseudo = "Jacques", transport = 7, time = new TimeSpan(0, 0, 1, 55, 0) });
|
||||||
Entries.Add(new HighscoreEntry { rank = 10, pseudo = "Dada", transport = 0, time = new TimeSpan(0, 0, 1, 30, 0) });
|
Entries.Add(new HighscoreEntry { rank = 10, pseudo = "Laurent", transport = 0, time = new TimeSpan(0, 0, 1, 30, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 11, pseudo = "Miguel", transport = 0, time = new TimeSpan(0, 0, 2, 00, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 12, pseudo = "Harry", transport = 0, time = new TimeSpan(0, 0, 2, 10, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 13, pseudo = "Donatello", transport = 0, time = new TimeSpan(0, 0, 2, 20, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 14, pseudo = "Raphael", transport = 0, time = new TimeSpan(0, 0, 2, 25, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 15, pseudo = "Conan", transport = 0, time = new TimeSpan(0, 0, 2, 35, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 16, pseudo = "ObiWan", transport = 0, time = new TimeSpan(0, 0, 2, 40, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 17, pseudo = "Bilbo", transport = 0, time = new TimeSpan(0, 0, 2, 50, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 18, pseudo = "James", transport = 0, time = new TimeSpan(0, 0, 2, 55, 0) });
|
||||||
|
Entries.Add(new HighscoreEntry { rank = 19, pseudo = "Indy", transport = 0, time = new TimeSpan(0, 0, 3, 00, 0) });
|
||||||
WriteFile();
|
WriteFile();
|
||||||
LoadFile();
|
LoadFile();
|
||||||
}
|
}
|
||||||
@ -63,7 +73,7 @@ public class HighscoresManager
|
|||||||
|
|
||||||
internal bool IsANewRecord(HighscoreEntry highscore)
|
internal bool IsANewRecord(HighscoreEntry highscore)
|
||||||
{
|
{
|
||||||
return Entries.Any(e => e.time > highscore.time);
|
return !Entries.Contains(highscore) && Entries.Any(e => e.time > highscore.time && e!= highscore);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadFile()
|
private void LoadFile()
|
||||||
|
@ -10,11 +10,11 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
|
|
||||||
#region private fields
|
#region private fields
|
||||||
List<Transform> transports;
|
List<Transform> transports;
|
||||||
int columnCount;
|
|
||||||
Transform currentTransport;
|
Transform currentTransport;
|
||||||
object selectionLock;
|
object selectionLock;
|
||||||
private bool _selected;
|
private bool _selected;
|
||||||
private Image _gameObjectImage;
|
private Image _gameObjectImage;
|
||||||
|
private bool init;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region private properties
|
#region private properties
|
||||||
@ -26,8 +26,6 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Transform CurrentTransport
|
Transform CurrentTransport
|
||||||
{
|
{
|
||||||
get { return currentTransport; }
|
get { return currentTransport; }
|
||||||
@ -95,6 +93,7 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
//3E00FFFF
|
//3E00FFFF
|
||||||
InitGameObjectImage();
|
InitGameObjectImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRenderObject()
|
private void OnRenderObject()
|
||||||
{
|
{
|
||||||
if (transports == null) InitializedTransportsList();
|
if (transports == null) InitializedTransportsList();
|
||||||
@ -107,13 +106,18 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
HandleInputs();
|
HandleInputs();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Awake()
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
Selected = false;
|
||||||
|
lastInput = DateTime.Now.AddMilliseconds(InputDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnDisable()
|
||||||
{
|
{
|
||||||
Selected = false;
|
|
||||||
lastInput = DateTime.Now.AddMilliseconds(InputDelay);
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -134,9 +138,9 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
transports = new List<Transform>();
|
transports = new List<Transform>();
|
||||||
for (int i = 0; i < TransportsPanel.childCount; i++)
|
for (int i = 0; i < TransportsPanel.childCount; i++)
|
||||||
transports.Add(TransportsPanel.GetChild(i));
|
transports.Add(TransportsPanel.GetChild(i));
|
||||||
columnCount = TransportsPanel.GetComponent<GridLayoutGroup>().constraintCount;
|
|
||||||
CurrentTransport = transports[Player2 ? transports.Count / 2 : 0];
|
CurrentTransport = transports[Player2 ? transports.Count / 2 : 0];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Ui
|
#region Ui
|
||||||
@ -171,16 +175,16 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
private void HandleInputs()
|
private void HandleInputs()
|
||||||
{
|
{
|
||||||
if (IsSpawned || transports == null || LaunchGameScript.Current.Launching) return;
|
if (IsSpawned || transports == null || LaunchGameScript.Current.Launching ) return;
|
||||||
if (!string.IsNullOrEmpty(YAxisName) && !Selected)
|
if (!string.IsNullOrEmpty(YAxisName) && !Selected)
|
||||||
{
|
{
|
||||||
var verticalAxis = Input.GetAxis(YAxisName);
|
var verticalAxis = Input.GetAxis(YAxisName);
|
||||||
if (Math.Abs(verticalAxis) == 1)
|
if (Math.Abs(verticalAxis) == 1)
|
||||||
{
|
{
|
||||||
|
Debug.Log ("Vertical (" + YAxisName + ") => " + verticalAxis);
|
||||||
bool? move = IsPositiveMove(verticalAxis);
|
bool? move = IsPositiveMove(verticalAxis);
|
||||||
if (move.HasValue)
|
if (move.HasValue)
|
||||||
{
|
{
|
||||||
@ -193,6 +197,7 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
var horizontalAxis = Input.GetAxis(XAxisName);
|
var horizontalAxis = Input.GetAxis(XAxisName);
|
||||||
if (Math.Abs(horizontalAxis) == 1)
|
if (Math.Abs(horizontalAxis) == 1)
|
||||||
{
|
{
|
||||||
|
Debug.Log ("Vertical (" + YAxisName + ") => " + horizontalAxis);
|
||||||
bool? move = IsPositiveMove(horizontalAxis);
|
bool? move = IsPositiveMove(horizontalAxis);
|
||||||
if (move.HasValue)
|
if (move.HasValue)
|
||||||
{
|
{
|
||||||
@ -200,9 +205,9 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(SubmitButtonName))
|
if (!string.IsNullOrEmpty(SubmitButtonName))
|
||||||
{
|
{
|
||||||
if (Input.GetButton(SubmitButtonName))
|
if (Input.GetButton(SubmitButtonName))
|
||||||
{
|
{
|
||||||
Selected = true;
|
Selected = true;
|
||||||
}
|
}
|
||||||
@ -231,25 +236,34 @@ public class SelectorBehavior : BaseInputBehavior
|
|||||||
private void MoveVertical(bool positive)
|
private void MoveVertical(bool positive)
|
||||||
{
|
{
|
||||||
var value = CurrentTransportIndex;
|
var value = CurrentTransportIndex;
|
||||||
if (value - (transports.Count / 2) >= 0)
|
var semiLength = transports.Count / 2;
|
||||||
value -= (transports.Count / 2);
|
if (value - semiLength >= 0)value -= semiLength;
|
||||||
else value += (transports.Count / 2);
|
else value += semiLength;
|
||||||
//var value = GetCurrentTransportIndex;
|
|
||||||
//if (positive) value += 1;
|
|
||||||
//else value -= 1;
|
|
||||||
//if (value > transports.Count - 1) value -= transports.Count - 1;
|
|
||||||
lastInput = DateTime.Now;
|
lastInput = DateTime.Now;
|
||||||
CurrentTransport = transports[value];
|
CurrentTransport = transports[value];
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MoveHorizontal(bool positive)
|
private void MoveHorizontal(bool positive)
|
||||||
{
|
{
|
||||||
var value = CurrentTransportIndex;
|
var semi = transports.Count/2;
|
||||||
|
var isInFirstRow = CurrentTransportIndex < semi;
|
||||||
|
var value = positive ? CurrentTransportIndex+1 : CurrentTransportIndex-1;
|
||||||
|
if (isInFirstRow) {
|
||||||
|
if (value < 0)
|
||||||
|
value = semi-1;
|
||||||
|
else if (value > semi)
|
||||||
|
value = 0;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
if (value < semi)
|
||||||
|
value = transports.Count - 1;
|
||||||
|
else if (value >= transports.Count)
|
||||||
|
value = semi;
|
||||||
|
|
||||||
if (positive) value++;
|
}
|
||||||
else value--;
|
|
||||||
if (value < 0) value = transports.Count - 1;
|
// if (value < 0) value = transports.Count - 1;
|
||||||
if (value > transports.Count - 1) value = 0;
|
// if (value > transports.Count - 1) value = 0;
|
||||||
|
|
||||||
lastInput = DateTime.Now;
|
lastInput = DateTime.Now;
|
||||||
CurrentTransport = transports[value];
|
CurrentTransport = transports[value];
|
||||||
|
@ -15,6 +15,8 @@ public class StayFocusBehavior : MonoBehaviour
|
|||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
|
Debug.Log ("Vertical Axis : " + Input.GetAxis (GameManager.Instance.YAxis));
|
||||||
|
Debug.Log ("Horizontal Axis : " + Input.GetAxis (GameManager.Instance.XAxis));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AlignIconWithButton(Transform transform)
|
private void AlignIconWithButton(Transform transform)
|
||||||
|
@ -1 +1 @@
|
|||||||
{"Items":[{"pseudo":"Toto","transport":0,"timeStr":"0:50:30"},{"pseudo":"Tata","transport":0,"timeStr":"0:55:30"},{"pseudo":"Titi","transport":0,"timeStr":"0:52:30"},{"pseudo":"Tutu","transport":0,"timeStr":"0:42:30"},{"pseudo":"Popo","transport":0,"timeStr":"0:40:30"},{"pseudo":"Papa","transport":0,"timeStr":"0:50:0"},{"pseudo":"Mama","transport":0,"timeStr":"1:30:30"},{"pseudo":"Mimi","transport":0,"timeStr":"1:50:10"},{"pseudo":"Nana","transport":0,"timeStr":"1:55:0"},{"pseudo":"Dada","transport":0,"timeStr":"1:30:0"}]}
|
{"Items":[{"pseudo":"Fausto","transport":0,"timeStr":"0:50:30"},{"pseudo":"Raymond","transport":1,"timeStr":"0:55:30"},{"pseudo":"Louison","transport":2,"timeStr":"0:52:30"},{"pseudo":"Marco","transport":2,"timeStr":"0:42:30"},{"pseudo":"Jeannie","transport":3,"timeStr":"0:40:30"},{"pseudo":"Nathalie","transport":6,"timeStr":"0:50:0"},{"pseudo":"Eddy","transport":4,"timeStr":"1:30:30"},{"pseudo":"Bernard","transport":5,"timeStr":"1:50:10"},{"pseudo":"Jacques","transport":7,"timeStr":"1:55:0"},{"pseudo":"Laurent","transport":0,"timeStr":"1:30:0"},{"pseudo":"Miguel","transport":0,"timeStr":"2:0:0"},{"pseudo":"Harry","transport":0,"timeStr":"2:10:0"},{"pseudo":"Donatello","transport":0,"timeStr":"2:20:0"},{"pseudo":"Raphael","transport":0,"timeStr":"2:25:0"},{"pseudo":"Conan","transport":0,"timeStr":"2:35:0"},{"pseudo":"ObiWan","transport":0,"timeStr":"2:40:0"},{"pseudo":"Bilbo","transport":0,"timeStr":"2:50:0"},{"pseudo":"James","transport":0,"timeStr":"2:55:0"},{"pseudo":"Indy","transport":0,"timeStr":"3:0:0"}]}
|
||||||
|
@ -14,8 +14,8 @@ InputManager:
|
|||||||
altNegativeButton: a
|
altNegativeButton: a
|
||||||
altPositiveButton: d
|
altPositiveButton: d
|
||||||
gravity: 3
|
gravity: 3
|
||||||
dead: 0.001
|
dead: 0.2
|
||||||
sensitivity: 3
|
sensitivity: 1
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
@ -30,8 +30,8 @@ InputManager:
|
|||||||
altNegativeButton: s
|
altNegativeButton: s
|
||||||
altPositiveButton: z
|
altPositiveButton: z
|
||||||
gravity: 3
|
gravity: 3
|
||||||
dead: 0.001
|
dead: 0.2
|
||||||
sensitivity: 3
|
sensitivity: 1
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
@ -111,7 +111,7 @@ InputManager:
|
|||||||
altPositiveButton: space
|
altPositiveButton: space
|
||||||
gravity: 1000
|
gravity: 1000
|
||||||
dead: 0.001
|
dead: 0.001
|
||||||
sensitivity: 1000
|
sensitivity: 3
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
@ -127,7 +127,7 @@ InputManager:
|
|||||||
altPositiveButton: left ctrl
|
altPositiveButton: left ctrl
|
||||||
gravity: 1000
|
gravity: 1000
|
||||||
dead: 0.001
|
dead: 0.001
|
||||||
sensitivity: 1000
|
sensitivity: 3
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
@ -148,7 +148,7 @@ InputManager:
|
|||||||
invert: 0
|
invert: 0
|
||||||
type: 2
|
type: 2
|
||||||
axis: 0
|
axis: 0
|
||||||
joyNum: 2
|
joyNum: 1
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
m_Name: VerticalP1
|
m_Name: VerticalP1
|
||||||
descriptiveName:
|
descriptiveName:
|
||||||
@ -164,7 +164,7 @@ InputManager:
|
|||||||
invert: 0
|
invert: 0
|
||||||
type: 2
|
type: 2
|
||||||
axis: 1
|
axis: 1
|
||||||
joyNum: 2
|
joyNum: 1
|
||||||
- serializedVersion: 3
|
- serializedVersion: 3
|
||||||
m_Name: SubmitP1
|
m_Name: SubmitP1
|
||||||
descriptiveName:
|
descriptiveName:
|
||||||
@ -175,7 +175,7 @@ InputManager:
|
|||||||
altPositiveButton: return
|
altPositiveButton: return
|
||||||
gravity: 1000
|
gravity: 1000
|
||||||
dead: 0.001
|
dead: 0.001
|
||||||
sensitivity: 1000
|
sensitivity: 3
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
@ -191,7 +191,7 @@ InputManager:
|
|||||||
altPositiveButton: right ctrl
|
altPositiveButton: right ctrl
|
||||||
gravity: 1000
|
gravity: 1000
|
||||||
dead: 0.001
|
dead: 0.001
|
||||||
sensitivity: 1000
|
sensitivity: 3
|
||||||
snap: 1
|
snap: 1
|
||||||
invert: 0
|
invert: 0
|
||||||
type: 0
|
type: 0
|
||||||
|
Loading…
Reference in New Issue
Block a user