赛事loading页面状态实时变化和一些微调

This commit is contained in:
lishuo committed 2021-07-27 19:34:33 +08:00
1 parent ea79b6cfc5
commit 0eb399be9a
16 files changed
+4074 -2881

No files matched your search

@@ -10,14 +10,10 @@ namespace Assets.Scenes.Ride.Scripts
public class RaceAlertController : PFUIPanel
{
public Text Content { get; set; }
public Text BandContent { get; set; }
public Text Timer { get; set; }
//public Text Timer { get; set; }
public GameObject GoBtn { get; set; }
public GameObject Card { get; set; }
public GameObject Band { get; set; }
public GameObject BandGoBtn { get; set; }
public GameObject StayBtn { get; set; }
public GameObject BandStayBtn { get; set; }
public int ticks = 0;
@@ -27,54 +23,37 @@ namespace Assets.Scenes.Ride.Scripts
protected override void Awake()
{
//Card
Timer = this.transform.Find("Card/Timer").GetComponent<Text>();
//Timer = this.transform.Find("Card/Timer").GetComponent<Text>();
Content = this.transform.Find("Card/Content").GetComponent<Text>();
GoBtn = this.transform.Find("Card/Go").gameObject;
StayBtn = this.transform.Find("Card/Stay").gameObject;
Card = this.transform.Find("Card").gameObject;
//band
BandContent = this.transform.Find("Band/Content").GetComponent<Text>();
BandGoBtn = this.transform.Find("Band/Go").gameObject;
BandStayBtn = this.transform.Find("Band/Stay").gameObject;
Band = this.transform.Find("Band").gameObject;
UIManager.AddEvent(GoBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Go);
UIManager.AddEvent(StayBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Stay);
UIManager.AddEvent(BandGoBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Go);
UIManager.AddEvent(BandStayBtn, UnityEngine.EventSystems.EventTriggerType.PointerClick, Stay);
}
float t = 1f;
private void Update()
{
t -= Time.deltaTime;
while (t <= 0)
{
if (ticks > 0)
{
ticks--;
Timer.text = Helper.FormatTicks(ticks);
}
t = 1f;
}
//t -= Time.deltaTime;
//while (t <= 0)
//{
// if (ticks > 0)
// {
// ticks--;
// Timer.text = Helper.FormatTicks(ticks);
// }
// t = 1f;
//}
}
public void Set(DateTime startTime, DateTime now,string title, string sceneName, int competitionId,int routeId)
{
ticks = (int)(startTime - now).TotalSeconds;
var content = $"Your <color='#F93086'>{title}</color> race about to start";
Content.text = content;
BandContent.text = content;
CompetitionId = competitionId;
RouteId = routeId;
var ride = sceneName.Equals("Ride");
Card.SetActive(ride);
Band.SetActive(!ride);
}
//切换到当前用户视角