private void UnusedSceneGUI(string scenePath, ref EditorBuildSettingsScene[] context)
        {
            Color gc = GUI.color;

            EditorGUILayout.BeginHorizontal();

            // Is active ?
            GUI.color = SsmUtility.IsActive(scenePath) ? Color.yellow : gc;
            // Select Scene
            SsmGUI.SelectButton(scenePath);

            // Add Scene
            GUI.color = gc;
            if (SsmGUI.Button(SsmContent.BtnAdd))
            {
                SsmAction.AddSceneInBuild(scenePath, ref context);
            }

            // Is active ?
            GUI.color = SsmUtility.IsActive(scenePath) ? Color.yellow : gc;
            // Button to open it (Label)
            SsmGUI.LabelButton(scenePath);
            GUI.color = gc;

            // Play button
            SsmGUI.PlayModeButton(scenePath);
            SsmGUI.PlayButton(scenePath);

            EditorGUILayout.EndHorizontal();
        }
예제 #2
0
 public static void TogglePlayModeStartScene(string scenePath)
 {
     if (SsmUtility.IsScenePlayedAtStart(scenePath))
     {
         EditorSceneManager.playModeStartScene = null;
     }
     else
     {
         SetPlayModeStartScene(scenePath);
     }
 }
        public static bool PlayModeButton(string _scenePath)
        {
            Color gc = GUI.color;

            GUI.color = SsmUtility.IsScenePlayedAtStart(_scenePath) ? SsmContent.BtnPlayMode.ActiveColor : gc;
            if (!Button(SsmContent.BtnPlayMode))
            {
                GUI.color = gc;
                return(false);
            }
            GUI.color = gc;
            SsmAction.TogglePlayModeStartScene(_scenePath);
            return(true);
        }
        private void SceneGUI(ref EditorBuildSettingsScene[] context, int index, ref int buildIndex)
        {
            EditorBuildSettingsScene scene = context[index];

            Color gc = GUI.color;

            EditorGUILayout.BeginHorizontal();

            // Is active ?
            GUI.color = SsmUtility.IsActive(scene.path) ? Color.yellow : gc;
            // Select Scene
            SsmGUI.SelectButton(scene.path);

            GUI.color = gc;
            // Remove Scene
            if (SsmGUI.Button(SsmContent.BtnRemove))
            {
                SsmAction.RemoveSceneInBuild(scene.path, ref context);
            }

            // Is active ?
            GUI.color = SsmUtility.IsActive(scene.path) ? Color.yellow : gc;

            // Enable toggle / Build index
            var content = SsmContent.BtnIndex.Content;

            content.text = scene.enabled ? buildIndex.ToString() : "";
            if (GUILayout.Button(content, SsmContent.BtnIndex.Style, SsmContent.BtnIndex.Width))
            {
                SsmAction.ToggleSceneEnabling(ref scene);
            }
            buildIndex = scene.enabled ? buildIndex + 1 : buildIndex;

            // Button to open it (Label)
            SsmGUI.LabelButton(scene.path);

            GUI.color = gc;
            // Play button
            SsmGUI.PlayModeButton(scene.path);
            SsmGUI.PlayButton(scene.path);

            EditorGUILayout.EndHorizontal();
        }
예제 #5
0
        public static void PlayScene(string scenePath)
        {
            if (SsmUtility.IsScenePlayedAtStart(scenePath))
            {
                EditorApplication.isPlaying = true;
                return;
            }

            if (EditorSceneManager.playModeStartScene == null)
            {
                EditorPrefs.SetString(SsmUtility.PlayModeSceneToResetKey, "null");
            }
            else
            {
                EditorPrefs.SetString(SsmUtility.PlayModeSceneToResetKey, EditorSceneManager.playModeStartScene.name);
            }
            SetPlayModeStartScene(scenePath);
            EditorApplication.isPlaying = true;
        }
        private static void OnPlayModeStateChanged(PlayModeStateChange state)
        {
            if (state != PlayModeStateChange.EnteredPlayMode)
            {
                return;
            }
            if (!EditorPrefs.HasKey(SsmUtility.PlayModeSceneToResetKey))
            {
                return;
            }

            string playModeSceneToReset = EditorPrefs.GetString(SsmUtility.PlayModeSceneToResetKey);

            if (playModeSceneToReset == "null")
            {
                EditorSceneManager.playModeStartScene = null;
            }
            else
            {
                foreach (EditorBuildSettingsScene settingsScene in EditorBuildSettings.scenes)
                {
                    if (playModeSceneToReset != SsmUtility.SceneFileName(settingsScene))
                    {
                        continue;
                    }

                    var sceneAsset = AssetDatabase.LoadAssetAtPath <SceneAsset>(settingsScene.path);
                    EditorSceneManager.playModeStartScene = sceneAsset;
                    break;
                }
            }
            EditorPrefs.DeleteKey(SsmUtility.PlayModeSceneToResetKey);

            if (IsOpen)
            {
                instance.Repaint();
            }
        }
예제 #7
0
 public static GUIContent SceneGUIContent(string path)
 {
     return(new GUIContent(" " + SsmUtility.SceneFileName(path), $"Open {path}"));
 }