示例#1
0
    void ShowOptionPlayTimer()
    {
        if (GameManager.Instance().IsGameInitialize)
        {
            if (SceneManager.GetActiveScene().buildIndex == (int)SCENE_INDEX.GAMESTAGE)
            {
                TimeSpan diff = DateTime.UtcNow - GameManager.Instance().Time_LatestStartGame;
                playUnixTime = GameConfigs.GetPlayUnixTime() + (int)diff.TotalSeconds;
            }
            else
            {
                playUnixTime = GameConfigs.GetPlayUnixTime();
            }

            TimeSpan curPlayTimeSpan = TimeSpan.FromSeconds(playUnixTime);

            playTimeText.text = string.Format("{0}:{1}:{2}", curPlayTimeSpan.Hours, curPlayTimeSpan.Minutes.ToString("D2"), curPlayTimeSpan.Seconds.ToString("D2"));
        }
    }