private void DoPlayButtons(bool isOrWillEnterPlaymode) { bool isPlaying = EditorApplication.isPlaying; GUI.changed = false; int num = (!isPlaying) ? 0 : 4; if (AnimationMode.InAnimationMode()) { num = 8; } Color color = GUI.color + new Color(0.01f, 0.01f, 0.01f, 0.01f); GUI.contentColor = new Color(1f / color.r, 1f / color.g, 1f / color.g, 1f / color.a); GUILayout.Toggle(isOrWillEnterPlaymode, Toolbar.s_PlayIcons[num], "CommandLeft", new GUILayoutOption[0]); GUI.backgroundColor = Color.white; if (GUI.changed) { Toolbar.TogglePlaying(); GUIUtility.ExitGUI(); } GUI.changed = false; bool isPaused = GUILayout.Toggle(EditorApplication.isPaused, Toolbar.s_PlayIcons[num + 1], "CommandMid", new GUILayoutOption[0]); if (GUI.changed) { EditorApplication.isPaused = isPaused; GUIUtility.ExitGUI(); } if (GUILayout.Button(Toolbar.s_PlayIcons[num + 2], "CommandRight", new GUILayoutOption[0])) { EditorApplication.Step(); GUIUtility.ExitGUI(); } }
private void DoPlayButtons(bool isOrWillEnterPlaymode) { bool isPlaying = EditorApplication.isPlaying; GUI.changed = false; int index = !isPlaying ? 0 : 4; if (UnityEditor.AnimationMode.InAnimationMode()) { index = 8; } Color color = GUI.color + new Color(0.01f, 0.01f, 0.01f, 0.01f); GUI.contentColor = new Color(1f / color.r, 1f / color.g, 1f / color.g, 1f / color.a); GUILayout.Toggle(isOrWillEnterPlaymode, s_PlayIcons[index], "CommandLeft", new GUILayoutOption[0]); GUI.backgroundColor = Color.white; if (GUI.changed) { TogglePlaying(); GUIUtility.ExitGUI(); } GUI.changed = false; bool flag2 = GUILayout.Toggle(EditorApplication.isPaused, s_PlayIcons[index + 1], "CommandMid", new GUILayoutOption[0]); if (GUI.changed) { EditorApplication.isPaused = flag2; GUIUtility.ExitGUI(); } if (GUILayout.Button(s_PlayIcons[index + 2], "CommandRight", new GUILayoutOption[0])) { EditorApplication.Step(); GUIUtility.ExitGUI(); } }
void DoPlayButtons(bool isOrWillEnterPlaymode) { // Enter / Exit Playmode bool isPlaying = EditorApplication.isPlaying; GUI.changed = false; int buttonOffset = isPlaying ? 4 : 0; Color c = GUI.color + new Color(.01f, .01f, .01f, .01f); GUI.contentColor = new Color(1.0f / c.r, 1.0f / c.g, 1.0f / c.g, 1.0f / c.a); GUI.SetNextControlName("ToolbarPlayModePlayButton"); GUILayout.Toggle(isOrWillEnterPlaymode, s_PlayIcons[buttonOffset], isPlaying ? Styles.commandLeftOn : Styles.commandLeft); GUI.backgroundColor = Color.white; if (GUI.changed) { EditorApplication.TogglePlaying(); GUIUtility.ExitGUI(); } // Pause game GUI.changed = false; buttonOffset = EditorApplication.isPaused ? 4 : 0; GUI.SetNextControlName("ToolbarPlayModePauseButton"); bool isPaused = GUILayout.Toggle(EditorApplication.isPaused, s_PlayIcons[buttonOffset + 1], Styles.commandMid); if (GUI.changed) { EditorApplication.isPaused = isPaused; GUIUtility.ExitGUI(); } using (new EditorGUI.DisabledScope(!isPlaying)) { // Step playmode GUI.SetNextControlName("ToolbarPlayModeStepButton"); if (GUILayout.Button(s_PlayIcons[2], Styles.commandRight)) { EditorApplication.Step(); GUIUtility.ExitGUI(); } } }