示例#1
0
        //private void modeSlowmoFPSKeeper()
        //{
        //    GUI.enabled = (TimeController.Instance.IsOperational
        //        && (TimeController.Instance.CurrentWarpState == TimeControllable.None || TimeController.Instance.CurrentWarpState == TimeControllable.SlowMo));

        //    bool fpsKeeperActive = GUILayout.Toggle( TimeController.Instance.IsFpsKeeperActive, "FPS Keeper: " + Mathf.Round( Settings.Instance.FpsMinSlider / 5 ) * 5 + " fps" );
        //    if (fpsKeeperActive != TimeController.Instance.IsFpsKeeperActive)
        //        TimeController.Instance.SetFPSKeeper( fpsKeeperActive );

        //    Settings.Instance.FpsMinSlider = (int)GUILayout.HorizontalSlider( Settings.Instance.FpsMinSlider, 5, 60 );

        //    GUI.enabled = true;
        //}

        private void GUITimeScale()
        {
            bool priorGUIEnabled = GUI.enabled;

            GUI.enabled = priorGUIEnabled && (SlowMoController.Instance?.CanSlowMo ?? false);

            GUILayout.BeginVertical();
            {
                SlowMoController.Instance.DeltaLocked = GUILayout.Toggle(SlowMoController.Instance.DeltaLocked, "Lock physics delta to default");

                float  ratePct           = (float)Math.Round(SlowMoController.Instance.SlowMoRate * 100f, 0);
                string slowMoSliderLabel = "Slow Motion Rate: ".MemoizedConcat(ratePct.MemoizedToString().MemoizedConcat("%"));

                Action <float> updateSlowMo = delegate(float f)
                {
                    SlowMoController.Instance.SlowMoRate = (float)Math.Round(f / 100f, 2);
                };

                Func <float, float> modifySlowMo = delegate(float f) { return(Mathf.Floor(f)); };
                IMGUIExtensions.floatTextBoxSliderPlusMinus(slowMoSliderLabel, ratePct, 0f, 100f, 1f, updateSlowMo, modifySlowMo, true);

                GUILayout.Label("", GUILayout.Height(5));

                sharedGUI.GUIThrottleControl();
            }
            GUILayout.EndVertical();

            GUI.enabled = priorGUIEnabled;
        }
示例#2
0
        private void GUIMaxDelta()
        {
            const float deltaIncrement = 0.01f;

            string hyperMaxRateLabel = "Max Delta Time During Hyper-Warp: ".MemoizedConcat(HyperWarpController.Instance.MaximumDeltaTime.MemoizedToString());

            if (HyperWarpController.Instance.MaximumDeltaTime > 0.12f)
            {
                hyperMaxRateLabel = hyperMaxRateLabel.MemoizedConcat(" - Low FPS Likely");
            }

            Action <float> updateHyperMaxDelta = delegate(float f) { HyperWarpController.Instance.MaximumDeltaTime = f; };
            // Force slider to select integer values between min and max
            Func <float, float> modifyFieldHyperMaxDelta = delegate(float f) { return(Mathf.Round(f * (1f / deltaIncrement)) / (1f / deltaIncrement)); };

            IMGUIExtensions.floatTextBoxSliderPlusMinus(hyperMaxRateLabel, HyperWarpController.Instance.MaximumDeltaTime, TimeController.MaximumDeltaTimeMin, TimeController.MaximumDeltaTimeMax, deltaIncrement, updateHyperMaxDelta, modifyFieldHyperMaxDelta);
        }