コード例 #1
0
        static bool Prefix()
        {
            if (Multiplayer.Client == null)
            {
                return(true); // Not in multiplayer mode
            }
            Player?simulationOwner = Multiplayer.Client.SimulationManager.GetSimulationOwner();

            if (simulationOwner == null || simulationOwner.Value != Multiplayer.Client.LocalPlayer)
            {
                return(false); // Player isn't the simulation owner
            }
            PlanetbaseMultiplayer.Client.Time.TimeManager timeManager = Multiplayer.Client.TimeManager;
            float timeScale = timeManager.GetCurrentSpeed();

            timeScale /= 2f;

            if (timeScale < 1f)
            {
                timeScale = 1f;
            }

            timeManager.SetSpeed(timeScale);
            return(false);
        }
コード例 #2
0
        static bool Prefix()
        {
            if (Multiplayer.Client == null)
            {
                return(true); // Not in multiplayer mode
            }
            Player?simulationOwner = Multiplayer.Client.SimulationManager.GetSimulationOwner();

            if (simulationOwner == null || simulationOwner.Value != Multiplayer.Client.LocalPlayer) // Player isn't the simulation owner
            {
                MessageToast.Show($"Only the simulation owner can control time!", 3f);
                return(false);
            }

            PlanetbaseMultiplayer.Client.Time.TimeManager timeManager = Multiplayer.Client.TimeManager;
            float timeScale = timeManager.GetCurrentSpeed();

            timeScale /= 2f;

            if (timeScale < 1f)
            {
                timeScale = 1f;
            }

            MessageToast.Show(StringList.get("speed_set") + " x" + timeScale, 3f);
            TimeManager.getInstance().decreaseSpeed();
            return(false);
        }
コード例 #3
0
        static bool Prefix()
        {
            if (Multiplayer.Client == null)
            {
                return(true); // Not in multiplayer mode
            }
            Player?simulationOwner = Multiplayer.Client.SimulationManager.GetSimulationOwner();

            if (simulationOwner == null || simulationOwner.Value != Multiplayer.Client.LocalPlayer)
            {
                return(false); // Player isn't the simulation owner
            }
            PlanetbaseMultiplayer.Client.Time.TimeManager timeManager = Multiplayer.Client.TimeManager;
            timeManager.SetNormalSpeed();
            return(false);
        }
コード例 #4
0
        static bool Prefix(ref float __result)
        {
            if (Multiplayer.Client == null)
            {
                return(true);
            }

            PlanetbaseMultiplayer.Client.Time.TimeManager timeManager = Multiplayer.Client.TimeManager;

            if (timeManager.IsPaused())
            {
                __result = 0f;
                return(false);
            }

            __result = timeManager.GetCurrentSpeed();
            return(false);
        }