TimeLimitGameView.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using UnityEngine.SceneManagement;
  6. public class TimeLimitGameView : MonoBehaviour
  7. {
  8. public Text nickNameTxt;
  9. public Text highestScoreTxt;
  10. public Text currentScoreTxt;
  11. public Text timeTxt;
  12. TimeLimitGameMode gameMode;
  13. public static TimeLimitGameView ins;
  14. void Start()
  15. {
  16. ins = this;
  17. gameMode = (TimeLimitGameMode) GameMgr.ins.gameMode;
  18. nickNameTxt.text = LoginMgr.myUserInfo.nickname;
  19. }
  20. void Update()
  21. {
  22. timeTxt.text = gameMode.GetTimeStr();
  23. currentScoreTxt.text = gameMode.score.ToString();
  24. }
  25. public void RenderHighestScoreByDistance(int distance)
  26. {
  27. int highestScore = 0;
  28. string distanceStr = distance.ToString();
  29. System.Object highestScoreObj = LoginMgr.myUserInfo.timeLimitGameHighestScores[distanceStr];
  30. if (highestScoreObj != null) highestScore = int.Parse(highestScoreObj.ToString());
  31. highestScoreTxt.text = highestScore.ToString();
  32. }
  33. }