| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using UnityEngine.SceneManagement;
- /* 限时模式的游戏界面 */
- public class TimeLimitGameView : MonoBehaviour
- {
- public Text nickNameTxt;
- public Text highestScoreTxt;
- public Text currentScoreTxt;
- public Text timeTxt;
- TimeLimitGameMode gameMode;
- public static TimeLimitGameView ins;
- void Start()
- {
- ins = this;
- gameMode = (TimeLimitGameMode) GameMgr.ins.gameMode;
- //nickNameTxt.text = LoginMgr.myUserInfo.nickname;
-
- if (GlobalData.pkMatchType == PKMatchType.None && UserSettings.ins.trainMode) {
- timeTxt.transform.parent.gameObject.SetActive(false);
- }
- }
- void OnDestroy()
- {
- if (ins == this) ins = null;
- }
- void Update()
- {
- timeTxt.text = gameMode.GetTimeStr();
- currentScoreTxt.text = gameMode.score.ToString($"f{CommonConfig.ringsPrecision}");
- }
- public void RenderHighestScoreByDistance(int distance)
- {
- float highestScore = 0;
- string distanceStr = distance.ToString();
- if (LoginMgr.myUserInfo.timeLimitGameScores.ContainsKey(distanceStr)) {
- highestScore = LoginMgr.myUserInfo.timeLimitGameScores[distanceStr];
- }
- highestScoreTxt.text = highestScore.ToString($"f{CommonConfig.ringsPrecision}");
- }
- }
|