| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- public class ShowGameTime : MonoBehaviour
- {
- [SerializeField] Text playTimeText;
- [SerializeField] Text cointCountText;
- const long PayTimeCountDown = 60 * 1000;
- //string coinContinueGameUnit;
- private void Start()
- {
- //StandaloneAPI.StartGameTimeCountDown();
- }
- // Update is called once per frame
- void Update()
- {
- //首页投币测试
- if (Input.GetKeyDown(KeyCode.Alpha7))
- {
- //投币接口测试
- StandaloneAPI.InsertCoint(7);
- }
- StandaloneAPI.DoGameTimeCountDown();
- //"剩余时间{0}"
- playTimeText.text = string.Format(TextAutoLanguage2.GetTextByKey("RemainingTime"), GetTimeStr());
- if (UserSettings.ins != null) {
- // Debug.Log(StandaloneAPI.CoinCount + " " + UserSettings.ins.PerRoundCoin);
- //"币:{0}/{1}"
- cointCountText.text = string.Format(TextAutoLanguage2.GetTextByKey("CoinsInfo"), StandaloneAPI.CoinCount, UserSettings.ins.PerRoundCoin);
- }
- }
- string GetTimeStr()
- {
- long second = StandaloneAPI.GetGameTimeCountDown() / 1000;
- long minute = second / 60;
- second = second % 60;
- string str = second + TextAutoLanguage2.GetTextByKey("Seconds");// "秒";
- if (minute > 0) str = minute + TextAutoLanguage2.GetTextByKey("Minutes") + str;// "分"
- return str;
- }
- }
|