Exemplo n.º 1
0
    // called by every frame if this area is active
    public void Tick()
    {
        //for ( ; CurrentFrame < TotallFrames.Count; ++CurrentFrame)
        //{
        //    logic_mgr.excute_frame(TotallFrames[CurrentFrame]);
        //    logic_mgr.Tick();
        //}
        Console.Write("TotallFrames.Count " + TotallFrames.Count + "\n");

        foreach (SyncFrame syncframe in TotallFrames)
        {
            logic_mgr.excute_frame(syncframe); // 这里只拿到位置信息
            logic_mgr.Tick();                  //计算新的位置
        }
        //执行完就清空
        TotallFrames.Clear();
    }
Exemplo n.º 2
0
        private void HandleInput()
        {
            var restart = CrossPlatformInputManager.GetButton("Restart");

            if (restart)
            {
                m_lastInputTime = 0f;
                RestartGame();
                return;
            }

            if (m_isPause)
            {
                return;
            }

            var pause = CrossPlatformInputManager.GetButton("Pause");

            if (pause)
            {
                m_lastInputTime = 0f;
                PauseGame();
                return;
            }

            var isTimeToInputDelay = (Time.unscaledTime - m_lastInputTime) >= gameConfig.inputRepeatDelay;

            var undo = CrossPlatformInputManager.GetButton("Undo");
            var redo = CrossPlatformInputManager.GetButton("Redo");

            if (undo)
            {
                if (isTimeToInputDelay)
                {
                    m_lastInputTime = Time.unscaledTime;
                    m_logicGameManager.Undo();
                    m_presentationGameManager.RefreshPresentation();
                }
            }
            else if (redo)
            {
                if (isTimeToInputDelay)
                {
                    m_lastInputTime = Time.unscaledTime;
                    m_logicGameManager.Redo();
                    m_presentationGameManager.RefreshPresentation();
                }
            }
            else
            {
                var operationType = GetLogicOperation();

                if (operationType != OperationType.None)
                {
                    if (isTimeToInputDelay)
                    {
                        m_lastInputTime = Time.unscaledTime;
                        m_logicGameManager.Tick(operationType);
                        m_presentationGameManager.RefreshPresentation();
                    }
                }
                else
                {
                    m_lastInputTime = 0f;
                }
            }
        }