コード例 #1
0
ファイル: HyperIMGUI.cs プロジェクト: ntwest/TimeControl
        public void HyperGUI()
        {
            if (!HyperWarpController.IsReady)
            {
                return;
            }

            bool priorGUIEnabled = GUI.enabled;

            GUI.enabled = priorGUIEnabled && HyperWarpController.Instance.CanHyperWarp;

            {
                GUILayout.BeginVertical();
                {
                    GUIRateButtons();
                    GUIMaxRate();
                    GUIMinPhys();
                    GUIMaxDelta();
                    GUIButtons();
                    GUILayout.Label("", GUILayout.Height(5));
                    GUIWarpTime();
                    GUILayout.Label("", GUILayout.Height(5));
                    sharedGUI.GUIThrottleControl();
                }
                GUILayout.EndVertical();
            }
            GUI.enabled = priorGUIEnabled;
        }
コード例 #2
0
ファイル: SlowMoIMGUI.cs プロジェクト: ntwest/TimeControl
        //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;
        }