ShowGameTime.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. [SerializeField] Text cointCountText;
  9. const long PayTimeCountDown = 60 * 1000;
  10. //string coinContinueGameUnit;
  11. private void Start()
  12. {
  13. //StandaloneAPI.StartGameTimeCountDown();
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. //首页投币测试
  19. if (Input.GetKeyDown(KeyCode.Alpha7))
  20. {
  21. //投币接口测试
  22. StandaloneAPI.InsertCoint(1);
  23. }
  24. StandaloneAPI.DoGameTimeCountDown();
  25. //"剩余时间{0}"
  26. playTimeText.text = string.Format(TextAutoLanguage2.GetTextByKey("RemainingTime"), GetTimeStr());
  27. if (UserSettings.ins != null) {
  28. // Debug.Log(StandaloneAPI.CoinCount + " " + UserSettings.ins.PerRoundCoin);
  29. //"币:{0}/{1}"
  30. cointCountText.text = string.Format(TextAutoLanguage2.GetTextByKey("CoinsInfo"), StandaloneAPI.CoinCount, UserSettings.ins.PerRoundCoin);
  31. }
  32. }
  33. string GetTimeStr()
  34. {
  35. long second = StandaloneAPI.GetGameTimeCountDown() / 1000;
  36. long minute = second / 60;
  37. second = second % 60;
  38. string str = second + TextAutoLanguage2.GetTextByKey("Seconds");// "秒";
  39. if (minute > 0) str = minute + TextAutoLanguage2.GetTextByKey("Minutes") + str;// "分"
  40. return str;
  41. }
  42. }