ShowGameTime.cs 784 B

1234567891011121314151617181920212223242526272829303132
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. public class ShowGameTime : MonoBehaviour
  6. {
  7. [SerializeField] Text playTimeText;
  8. const long PayTimeCountDown = 60 * 1000;
  9. private void Start()
  10. {
  11. //StandaloneAPI.StartGameTimeCountDown();
  12. }
  13. // Update is called once per frame
  14. void Update()
  15. {
  16. StandaloneAPI.DoGameTimeCountDown();
  17. playTimeText.text = string.Format("Ê£Óàʱ¼ä{0}", GetTimeStr());
  18. }
  19. string GetTimeStr()
  20. {
  21. long second = StandaloneAPI.GetGameTimeCountDown() / 1000;
  22. long minute = second / 60;
  23. second = second % 60;
  24. string str = second + "Ãë";
  25. if (minute > 0) str = minute + "·Ö" + str;
  26. return str;
  27. }
  28. }