Ajout gestion d' attente de l'autre joueur après hi
This commit is contained in:
parent
067d9ff6a6
commit
4a597e3954
@ -51,8 +51,6 @@ public class HighscoreLetterManager : BaseInputBehavior
|
||||
private Image upButtonImage;
|
||||
private Image downButtonImage;
|
||||
private bool letterIsChanging;
|
||||
private bool upButtonPressed;
|
||||
private bool downButtonPressed;
|
||||
//private DateTime lastInput;
|
||||
//public int InputDelay = 500;
|
||||
private bool _isActive;
|
||||
@ -146,17 +144,13 @@ public class HighscoreLetterManager : BaseInputBehavior
|
||||
if (letterIsChanging) return;
|
||||
lastInput = DateTime.Now;
|
||||
letterIsChanging = true;
|
||||
upButtonPressed = false;
|
||||
downButtonPressed = false;
|
||||
if (plus)
|
||||
{
|
||||
CurrentIndex++;
|
||||
upButtonPressed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentIndex--;
|
||||
downButtonPressed = true;
|
||||
}
|
||||
if (CurrentIndex < 0) CurrentIndex = Alphanumerics.Count - 1;
|
||||
else if (CurrentIndex >= Alphanumerics.Count) CurrentIndex = 0;
|
||||
@ -171,5 +165,8 @@ public class HighscoreLetterManager : BaseInputBehavior
|
||||
return move;
|
||||
}
|
||||
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
CurrentIndex = 0;
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,10 @@ using UnityEngine.UI;
|
||||
public class HighscoreRecordMenuManager : BaseInputBehavior
|
||||
{
|
||||
public GameObject[] Letters;
|
||||
private static HighscoreRecordMenuManager[] Recorders = new HighscoreRecordMenuManager[2];
|
||||
public Text PseudoText;
|
||||
public Text TimeText;
|
||||
public Text WaitText;
|
||||
public Image TransportImage;
|
||||
public string XAxisName
|
||||
{
|
||||
@ -33,15 +35,17 @@ public class HighscoreRecordMenuManager : BaseInputBehavior
|
||||
|
||||
private int _selectionIndex = 0;
|
||||
private bool selectionChanging;
|
||||
|
||||
|
||||
private bool waitFor;
|
||||
|
||||
public HighscoreEntry Entry { get; private set; }
|
||||
public bool Finished { get; private set; }
|
||||
|
||||
|
||||
public int PlayerIndex { get { return Player2 ? 1 : 0; } }
|
||||
public int OtherPlayerIndex { get { return Player2 ? 0 : 1; } }
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
Recorders[PlayerIndex] = this;
|
||||
if (Letters != null && Letters.Any())
|
||||
{
|
||||
var manager = Letters[0].GetComponent<HighscoreLetterManager>();
|
||||
@ -53,6 +57,16 @@ public class HighscoreRecordMenuManager : BaseInputBehavior
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (Finished)
|
||||
{
|
||||
if (waitFor)
|
||||
{
|
||||
if(WaitText!=null) WaitText.text = "En attente du joueur " + (Player2 ? "2" : "1");
|
||||
if (Recorders[OtherPlayerIndex].Finished)
|
||||
GameManager.Instance.DisplayMenu();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (PseudoText != null)
|
||||
PseudoText.text = GetPseudo();
|
||||
if (TransportImage != null && Entry != null && GameManager.Instance.Transports != null && Entry.transport < GameManager.Instance.Transports.Count)
|
||||
@ -76,17 +90,32 @@ public class HighscoreRecordMenuManager : BaseInputBehavior
|
||||
Entry.pseudo = GetPseudo();
|
||||
HighscoresManager.Current.AddNewEntry(Entry);
|
||||
}
|
||||
GameManager.Instance.DisplayMenu();
|
||||
Finish();
|
||||
//GameManager.Instance.DisplayMenu();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Finish()
|
||||
{
|
||||
Finished = true;
|
||||
if (!Recorders[OtherPlayerIndex].Finished)
|
||||
{
|
||||
waitFor = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Finished = false;
|
||||
waitFor = false;
|
||||
|
||||
//on récupère le highscore du joueur
|
||||
Entry = Player2 ? GameManager.Instance.EntryP2 : GameManager.Instance.EntryP1;
|
||||
CheckEntry();
|
||||
|
||||
}
|
||||
|
||||
private void CheckEntry()
|
||||
|
@ -45,6 +45,5 @@ public class ScrollBarButtonScript : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,6 @@ public class SelectorBehavior : BaseInputBehavior
|
||||
//Resources.Load<Sprite>("suit_life_meter_2");
|
||||
var imageName = CurrentTransport.GetChild(0).gameObject.GetComponent<Image>().mainTexture.name;
|
||||
imageName = imageName.Substring(0, imageName.IndexOf('_')) + "_320x320";
|
||||
Debug.Log(imageName);
|
||||
PlayerPanelImage.sprite = Resources.Load<Sprite>("Images/"+imageName);
|
||||
PlayerPanelImage.color = Selected ? SelectorColor : NormalColor;
|
||||
PlayerPanelImage.preserveAspect = true;
|
||||
@ -180,7 +179,6 @@ public class SelectorBehavior : BaseInputBehavior
|
||||
if (!string.IsNullOrEmpty(YAxisName) && !Selected)
|
||||
{
|
||||
var verticalAxis = Input.GetAxis(YAxisName);
|
||||
Debug.Log(" "+Input.GetAxis(YAxisName));
|
||||
if (Math.Abs(verticalAxis) == 1)
|
||||
{
|
||||
bool? move = IsPositiveMove(verticalAxis);
|
||||
|
Loading…
Reference in New Issue
Block a user