Beispiel #1
0
 static int GetTimestamp(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 0);
         int o = BattleTime.GetTimestamp();
         LuaDLL.lua_pushinteger(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #2
0
    // 刷新倒计时
    private void OnRefreshTime()
    {
        int time      = 0;
        int timestamp = BattleTime.GetTimestamp();

        _txtOverTimeText.gameObject.SetActive(false);
        if (timestamp > GameConfig.GAME_TIME + GameConfig.OVER_TIME)
        {
            // 比赛结束
            time = GameConfig.GAME_TIME + GameConfig.OVER_TIME - timestamp;
        }
        else if (timestamp > GameConfig.GAME_TIME)
        {
            // 加时赛时间
            time = GameConfig.GAME_TIME + GameConfig.OVER_TIME - timestamp;
            _txtOverTimeText.gameObject.SetActive(true);
        }
        else if (timestamp > GameConfig.GAME_TIME - GameConfig.DOUBLE_TIME)
        {
            // 双倍圣水时间
            time = GameConfig.GAME_TIME - timestamp;
        }
        else
        {
            // 正常时间
            time = GameConfig.GAME_TIME - timestamp;
        }

        _txtTime.text = Utils.GetCountDownTime(time / 1000f);

        // _txtOverTimeText  如果是加时赛,则显示这个文本

        // 圣水量显示为0-10
        _txtMP.text = (BattleController.Instance.Mana / GameConfig.MANA_MUL).ToString();

        _imgMP.fillAmount = 1f * BattleController.Instance.Mana / GameConfig.MANA_MAX;
    }