| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- 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;
- private void Start()
- {
- //StandaloneAPI.StartGameTimeCountDown();
- }
- // Update is called once per frame
- void Update()
- {
- //首页投币测试
- if (Input.GetKeyDown(KeyCode.Alpha7))
- {
- //投币接口测试
- StandaloneAPI.InsertCoint(1);
- }
- StandaloneAPI.DoGameTimeCountDown();
- playTimeText.text = string.Format("剩余时间{0}", GetTimeStr());
- if (UserSettings.ins != null) {
- // Debug.Log(StandaloneAPI.CoinCount + " " + UserSettings.ins.PerRoundCoin);
- cointCountText.text = string.Format("币:{0}/{1}", StandaloneAPI.CoinCount, UserSettings.ins.PerRoundCoin);
- }
- }
- string GetTimeStr()
- {
- long second = StandaloneAPI.GetGameTimeCountDown() / 1000;
- long minute = second / 60;
- second = second % 60;
- string str = second + "秒";
- if (minute > 0) str = minute + "分" + str;
- return str;
- }
- }
|