Ejemplo n.º 1
0
        public void DrawDebugBox(GPUInstancerEditorSimulator simulator = null)
        {
            if (!Application.isPlaying)
            {
                EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box);

                Rect foldoutRect = GUILayoutUtility.GetRect(0, 20, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false));
                foldoutRect.x += 12;
                showDebugBox   = EditorGUI.Foldout(foldoutRect, showDebugBox, GPUInstancerEditorConstants.TEXT_debug, true, GPUInstancerEditorConstants.Styles.foldout);

                if (showDebugBox)
                {
                    if (simulator != null)
                    {
                        if (simulator.simulateAtEditor)
                        {
                            if (simulator.initializingInstances)
                            {
                                EditorGUI.BeginDisabledGroup(true);
                                GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorPrep, GPUInstancerEditorConstants.Colors.darkBlue, Color.white,
                                                                              FontStyle.Bold, Rect.zero, null);
                                EditorGUI.EndDisabledGroup();
                            }
                            else
                            {
                                GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorStop, Color.red, Color.white,
                                                                              FontStyle.Bold, Rect.zero, () =>
                                {
                                    simulator.StopSimulation();
                                });
                            }
                        }
                        else
                        {
                            GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditor, GPUInstancerEditorConstants.Colors.green, Color.white,
                                                                          FontStyle.Bold, Rect.zero, () =>
                            {
                                simulator.StartSimulation();
                            });
                        }
                    }
                    DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_simulator);

                    _manager.keepSimulationLive = EditorGUILayout.Toggle("Keep Simulation Live", _manager.keepSimulationLive);

                    if (_manager.keepSimulationLive)
                    {
                        _manager.updateSimulation = EditorGUILayout.Toggle(new GUIContent("Update Simulation On Change", "Update Simulation On Change"), _manager.updateSimulation);

                        EditorGUILayout.HelpBox("Simulation is kept alive. The simulation might not show every change on terrain details. Changing some prototype settings during the simulation can also cause errors. Please stop and start the simulation again to solve these issues.", MessageType.Warning);
                    }
                }

                EditorGUILayout.EndVertical();
            }
        }
Ejemplo n.º 2
0
        public void DrawDebugBox(GPUInstancerEditorSimulator simulator = null)
        {
            if (!Application.isPlaying)
            {
                EditorGUILayout.BeginVertical(GPUInstancerEditorConstants.Styles.box);
                GPUInstancerEditorConstants.DrawCustomLabel(GPUInstancerEditorConstants.TEXT_debug, GPUInstancerEditorConstants.Styles.boldLabel);

                if (simulator != null)
                {
                    if (simulator.simulateAtEditor)
                    {
                        if (simulator.initializingInstances)
                        {
                            EditorGUI.BeginDisabledGroup(true);
                            GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorPrep, GPUInstancerEditorConstants.Colors.darkBlue, Color.white,
                                                                          FontStyle.Bold, Rect.zero, null);
                            EditorGUI.EndDisabledGroup();
                        }
                        else
                        {
                            GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditorStop, Color.red, Color.white,
                                                                          FontStyle.Bold, Rect.zero, () =>
                            {
                                simulator.StopSimulation();
                            });
                        }
                    }
                    else
                    {
                        GPUInstancerEditorConstants.DrawColoredButton(GPUInstancerEditorConstants.Contents.simulateAtEditor, GPUInstancerEditorConstants.Colors.green, Color.white,
                                                                      FontStyle.Bold, Rect.zero, () =>
                        {
                            simulator.StartSimulation();
                        });
                    }
                }
                DrawHelpText(GPUInstancerEditorConstants.HELPTEXT_simulator);

                EditorGUILayout.EndVertical();
            }
        }