static void Postfix(ITickable __state, Rect timerRect)
        {
            if (__state == null)
            {
                return;
            }

            Rect  rect        = new Rect(timerRect.x, timerRect.y, TimeControls.TimeButSize.x, TimeControls.TimeButSize.y);
            float normalSpeed = __state.ActualRateMultiplier(TimeSpeed.Normal);
            float fastSpeed   = __state.ActualRateMultiplier(TimeSpeed.Fast);

            if (normalSpeed == 0f) // Completely paused
            {
                Widgets.DrawLineHorizontal(rect.x + rect.width, rect.y + rect.height / 2f, rect.width * 3f);
            }
            else if (normalSpeed == fastSpeed)  // Slowed down
            {
                Widgets.DrawLineHorizontal(rect.x + rect.width * 2f, rect.y + rect.height / 2f, rect.width * 2f);
            }

            TimeSpeed newSpeed = Find.TickManager.CurTimeSpeed;

            Find.TickManager.CurTimeSpeed = savedSpeed;

            if (prevSpeed == newSpeed)
            {
                return;
            }

            if (Multiplayer.IsReplay)
            {
                TickPatch.replayTimeSpeed = newSpeed;
            }

            // Prevent multiple players changing the speed too quickly
            if (keyPressed && Time.realtimeSinceStartup - MultiplayerWorldComp.lastSpeedChange < 0.4f)
            {
                return;
            }

            TimeControl.SendTimeChange(__state, newSpeed);
        }
Beispiel #2
0
        static void Postfix(ITickable __state)
        {
            if (__state == null)
            {
                return;
            }

            TimeSpeed newSpeed = Find.TickManager.CurTimeSpeed;

            Find.TickManager.CurTimeSpeed = savedSpeed;

            if (prevSpeed == newSpeed)
            {
                return;
            }

            if (Multiplayer.IsReplay)
            {
                TickPatch.replayTimeSpeed = newSpeed;
            }

            TimeControl.SendTimeChange(__state, newSpeed);
        }