赛事开始逻辑调整

This commit is contained in:
lishuo 2021-11-24 10:15:28 +08:00
parent eeffccd4e6
commit 917cbbfb90
2 changed files with 12 additions and 2 deletions

View File

@ -49,6 +49,7 @@ namespace Assets.Scenes.Ride.Scripts
altitudeGraph.gameObject.SetActive(false); altitudeGraph.gameObject.SetActive(false);
//暂停按钮禁用 //暂停按钮禁用
pauseButton.interactable = false; pauseButton.interactable = false;
InitGameObject();
} }
protected override void Update() protected override void Update()
{ {
@ -67,7 +68,12 @@ namespace Assets.Scenes.Ride.Scripts
//开始骑行-加个5秒钟倒计时 //开始骑行-加个5秒钟倒计时
public override void StartRide() public override void StartRide()
{ {
competitionModel = mainController.cyclingController as CompetitionModel;
}
public void InitGameObject()
{
competitionModel = mainController.cyclingController as CompetitionModel;
#if UNITY_IOS || UNITY_ANDROID #if UNITY_IOS || UNITY_ANDROID
countDownPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CountDownPanel"), uipanel.transform); countDownPanel = Instantiate(Resources.Load<GameObject>("UI/Prefab/Match/Mobile/CountDownPanel"), uipanel.transform);

View File

@ -23,13 +23,17 @@ namespace Assets.Scenes.Ride.Scripts
CountTimer = transform.Find("Timer").GetComponent<Text>(); CountTimer = transform.Find("Timer").GetComponent<Text>();
TimerTitle = transform.Find("ConpetitionTimerTitle").GetComponent<Text>(); TimerTitle = transform.Find("ConpetitionTimerTitle").GetComponent<Text>();
Timer = transform.Find("ConpetitionTimer").GetComponent<Text>(); Timer = transform.Find("ConpetitionTimer").GetComponent<Text>();
competitionModel = cyclingController.cyclingController as CompetitionModel;
} }
GameObject competitionResultPanel { get; set; } GameObject competitionResultPanel { get; set; }
private void Update() private void Update()
{ {
if (competitionModel == null)
{
competitionModel = cyclingController.cyclingController as CompetitionModel;
}
if (competitionModel != null) if (competitionModel != null)
{ {
var count = competitionModel.StartCountdown(); var count = competitionModel.StartCountdown();