Ejemplo n.º 1
0
    /// <summary>
    /// 重置FPS计数器
    /// <para>fixedFPS 是否自动补帧</para>
    /// </summary>
    /// <param name="luaState"></param>
    /// <returns></returns>
    public static int ResetFPSTimer(ILuaState luaState)
    {
        bool fixedFPS = luaState.ToBoolean(-1);

        FPSController.GetInstance().Restart(fixedFPS);
        return(0);
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     FPSController.GetInstance().SleepToNextFrame();
     //if (_isFirst)
     //{
     //    _isFirst = false;
     //    _lastFrameTime = TimeUtil.GetTimestamp();
     //}
     //else
     //{
     //    long curFrameTime = TimeUtil.GetTimestamp();
     //    Logger.Log("FrameDuration = " + 1000f * (curFrameTime - _lastFrameTime) / 10000000);
     //    _lastFrameTime = curFrameTime;
     //}
     _fsm.Update();
     TimerManager.GetInstance().Update();
     TweenManager.GetInstance().Update();
     UIManager.GetInstance().Update();
     SoundManager.GetInstance().Update();
     // 销毁检测
     if (Global.SysBusyValue < Consts.SysBusyValue)
     {
         ObjectsPool.GetInstance().CheckDestroyPoolObjects();
         if (Global.SysBusyValue == 0)
         {
             ObjectsPool.GetInstance().DestroyProtoTypes();
         }
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 执行关卡task
 /// </summary>
 private void OnStageTaskUpdate()
 {
     if (_curStageTask.isFinish != true)
     {
         if (!_curStageTask.isStarted)
         {
             // 设置fixedFPS
             if (_curStageInfo.fixedFps)
             {
                 Application.targetFrameRate = 90;
             }
             else
             {
                 Application.targetFrameRate = 60;
             }
             FPSController.GetInstance().Restart(_curStageInfo.fixedFps);
             // bgm开始播放
             //SoundManager.GetInstance().SetSoundPlayTime(_curStageInfo.bgm, 0);
             SoundManager.GetInstance().ResumeAllSTGSound();
             //SoundManager.GetInstance().PrintSoundTime("DarkRoad");
             InterpreterManager.GetInstance().AddPara(ExtraTaskManager.GetInstance(), LuaParaType.LightUserData);
             InterpreterManager.GetInstance().CallTaskCoroutine(_curStageTask, 1);
         }
         else
         {
             InterpreterManager.GetInstance().CallTaskCoroutine(_curStageTask);
         }
     }
 }