예제 #1
0
        private void DrawMainSettings()
        {
            SpiralEditor.BeginPanel("Global Editor Simulation params");
            EditorGUI.indentLevel += 1;

            Sandbox.isRunning       = EditorGUILayout.Toggle("Editor simulation", Sandbox.isRunning);
            Sandbox.minimalStepMode = (Sandbox.MinimalStep)EditorGUILayout.EnumPopup("Step mode", Sandbox.minimalStepMode);
            if (Sandbox.minimalStepMode == Sandbox.MinimalStep.Custom)
            {
                GUIContent contentMTS = new GUIContent("Minimal time step");
                Sandbox.customMinimalTimeStep = EditorGUILayout.FloatField(contentMTS, Sandbox.customMinimalTimeStep);
            }
            Sandbox.checkAverageDeltaEvery = EditorGUILayout.FloatField("Check average every", Sandbox.checkAverageDeltaEvery);

            Sandbox.autoClearReferences = EditorGUILayout.Toggle("Clear references", Sandbox.autoClearReferences);
            Sandbox.secureMode          = EditorGUILayout.Toggle("Secure mode", Sandbox.secureMode);
            EditorGUI.indentLevel      -= 1;

            if (SpiralEditor.CenteredButton("Save current prefs"))
            {
                SandboxPrefs.SaveSettings();
            }

            EditorGUILayout.Space();
            SpiralEditor.EndPanel();
        }
        private void DrawSnapshotPanel()
        {
            SpiralEditor.BeginPanel("Last snapshot preview");
            SpiralEditor.SetGUIEnabled(false);
            SpiralEditor.DrawObjectField("Snapshot", lastSnapshot, false);
            if (lastSnapshot != null)
            {
                SpiralEditor.BoldLabel($"{lastSnapshot.width}x{lastSnapshot.height}", true);
            }
            SpiralEditor.RestoreGUIEnabled();

            bool snapShotEnabled = GameViewUtils.gameView != null && !waiting;

            SpiralEditor.SetGUIEnabled(snapShotEnabled);
            try
            {
                bool makescreen = SpiralEditor.CenteredButton("Make a photo");
                if (makescreen)
                {
                    EditorCoroutineUtility.StartCoroutine(WaitForEditor(), this);
                }
            }
            catch
            {
                SpiralEditor.EndPanel();
                return;
            } // welcome to the silence null
            SpiralEditor.RestoreGUIEnabled();
            if (!snapShotEnabled)
            {
                if (waiting)
                {
                    SpiralEditor.MessagePanel("Wait...", MessageType.Info);
                }
                else
                {
                    SpiralEditor.MessagePanel("If disabled, try to open or restart GameView", MessageType.Warning);
                }
            }
            SpiralEditor.EndPanel();
        }
예제 #3
0
        private void DrawHealthMonitor()
        {
            SpiralEditor.BeginPanel("Simulator's Health Monitor", SpiralStyles.colorLightRed);
            EditorGUI.indentLevel += 1;

            float  average    = Sandbox.averageDeltaTime;
            string strAverage = average.ToString("F4");

            EditorGUILayout.LabelField("Average real time step: ",
                                       $"{strAverage} s.",
                                       SpiralStyles.labelNormal);
            EditorGUILayout.LabelField("Events count: ",
                                       $"{Sandbox.sandboxCurrentCount} / {Sandbox.sandboxTotalCount}",
                                       SpiralStyles.labelNormal);
            EditorGUI.indentLevel -= 1;

            if (SpiralEditor.CenteredButton("Kill all events"))
            {
                Sandbox.RemoveAll();
            }

            EditorGUILayout.Space();
            SpiralEditor.EndPanel();
        }