Exemplo n.º 1
0
    public static void Swap(int index1, int index2)
    {
        MyScenes backUp = EditorConfiguration.Scenes[index1];

        EditorConfiguration.Scenes[index1] = EditorConfiguration.Scenes[index2];
        EditorConfiguration.Scenes[index2] = backUp;
    }
Exemplo n.º 2
0
    private static void SceneMove(MyScenes scene, bool up)
    {
        int index = EditorConfiguration.Scenes.IndexOf(scene);

        if (up)
        {
            Swap(index, index - 1);
        }
        else
        {
            Swap(index, index + 1);
        }
    }
Exemplo n.º 3
0
    public void InitializeScene()
    {
        _scenes = new MyScenes();
        _scenes.GetSceneInfo();

        switch (_techChoice)
        {
        case 1:
            foreach (GameObject go in _scenes.Techniques)
            {
                if (go.name == "[ForceGestureManager]")
                {
                    go.SetActive(true); break;
                }
            }
            break;

        case 2:
            foreach (GameObject go in _scenes.Techniques)
            {
                if (go.name == "[HoloGestureManager]")
                {
                    go.SetActive(true); break;
                }
            }
            break;

        case 3:
            foreach (GameObject go in _scenes.Techniques)
            {
                if (go.name == "[IronmanGestureManager]")
                {
                    go.SetActive(true); break;
                }
            }
            break;

        default:
            break;
        }

        foreach (GameObject go in _scenes.Levels)
        {
            if (go.name == "level_" + _currLevel.ToString())
            {
                go.SetActive(true); break;
            }
        }
    }
Exemplo n.º 4
0
    private void DisplayScenes()
    {
        _foldOutScenes = UnityEditor.EditorGUILayout.Foldout(_foldOutScenes, "SceneManager");
        UnityEditor.EditorGUILayout.BeginHorizontal();
        UnityEditor.EditorGUILayout.LabelField("", UnityEngine.GUILayout.MaxWidth(30));
        UnityEditor.EditorGUILayout.BeginVertical();
        if (_foldOutScenes)
        {
            if (EditorConfiguration.Scenes.Count != 0)
            {
                UnityEditor.EditorGUILayout.BeginHorizontal();
                UnityEditor.EditorGUILayout.LabelField("Display scene full path: ");
                EditorConfiguration.scenePathDisplayed = UnityEditor.EditorGUILayout.Toggle(EditorConfiguration.scenePathDisplayed);
                UnityEditor.EditorGUILayout.EndHorizontal();
                UnityEngine.GUILayout.BeginVertical(UnityEngine.GUI.skin.textField);
                MyScenes sceneToBeRemoved = null;
                int      counter          = 0;
                foreach (var scene in EditorConfiguration.Scenes)
                {
                    UnityEngine.GUILayout.BeginHorizontal(UnityEngine.GUI.skin.textArea);

                    var valToggle = UnityEditor.EditorGUILayout.Toggle(scene.ToBeBuilt, UnityEngine.GUILayout.MaxWidth(10));
                    if (valToggle != scene.ToBeBuilt)
                    {
                        scene.ToBeBuilt = valToggle;
                        UnityEditor.EditorBuildSettings.scenes = PathFromTheSceneInCurrentList();
                    }
                    var sceneName = scene.Path;
                    if (!EditorConfiguration.scenePathDisplayed)
                    {
                        var splitedPath = sceneName.Split('/');
                        sceneName = splitedPath[splitedPath.Length - 1];
                    }
                    UnityEditor.EditorGUILayout.LabelField(sceneName);
                    string value;
                    if (scene.ToBeBuilt)
                    {
                        scene.BuildScene = counter;
                        counter++;
                        value = scene.BuildScene.ToString();
                    }
                    else
                    {
                        value = "";
                    }

                    UnityEditor.EditorGUILayout.LabelField(value, UnityEngine.GUILayout.MaxWidth(30));


                    if (EditorConfiguration.Scenes.IndexOf(scene) != 0 && EditorConfiguration.Scenes.Count > 1)
                    {
                        if (UnityEngine.GUILayout.Button("^", UnityEngine.GUILayout.MaxWidth(30)))
                        {
                            SceneMove(scene, true);
                            UnityEditor.EditorBuildSettings.scenes = PathFromTheSceneInCurrentList();
                        }
                    }

                    if (EditorConfiguration.Scenes.IndexOf(scene) != EditorConfiguration.Scenes.Count - 1 && EditorConfiguration.Scenes.Count > 1)
                    {
                        if (UnityEngine.GUILayout.Button("v", UnityEngine.GUILayout.MaxWidth(30)))
                        {
                            SceneMove(scene, false);
                            UnityEditor.EditorBuildSettings.scenes = PathFromTheSceneInCurrentList();
                        }
                    }


                    if (UnityEngine.GUILayout.Button("X", UnityEngine.GUILayout.MaxWidth(30)))
                    {
                        sceneToBeRemoved = scene;
                    }

                    UnityEngine.GUILayout.EndHorizontal();
                }


                if (sceneToBeRemoved != null)
                {
                    RemoveScene(sceneToBeRemoved);
                }

                UnityEngine.GUILayout.EndVertical();
            }

            UnityEngine.GUILayout.BeginVertical();
            UnityEditor.EditorGUILayout.BeginHorizontal();
            UnityEditor.EditorGUILayout.LabelField("Add scene: ", UnityEngine.GUILayout.MaxWidth(80));
            _obj = UnityEditor.EditorGUILayout.ObjectField(_obj, typeof(UnityEditor.SceneAsset), true);

            if (_obj != null)
            {
                var path = UnityEditor.AssetDatabase.GetAssetPath(_obj);
                if (EditorConfiguration.Scenes.All(n => n.Path != path))
                {
                    EditorConfiguration.Scenes.Add(new MyScenes(false, path, 0));
                    _obj = new UnityEngine.Object();
                }

                _obj = null;
            }
            UnityEditor.EditorGUILayout.EndHorizontal();
            UnityEditor.EditorGUILayout.BeginHorizontal();
            if (UnityEngine.GUILayout.Button("Add all scenes", UnityEditor.EditorStyles.miniButtonLeft))
            {
                AddAllScenes();
            }

            if (UnityEngine.GUILayout.Button("Select all scenes", UnityEditor.EditorStyles.miniButtonMid))
            {
                SelectAllScenes();
            }
            if (UnityEngine.GUILayout.Button("Deselect all scenes", UnityEditor.EditorStyles.miniButtonMid))
            {
                DeselectAllScenes();
            }
            if (UnityEngine.GUILayout.Button("Remove not selected scenes", UnityEditor.EditorStyles.miniButtonMid))
            {
                RemoveNotSelectedScenes();
            }
            if (UnityEngine.GUILayout.Button("Remove all scenes", UnityEditor.EditorStyles.miniButtonRight))
            {
                EditorConfiguration.Scenes             = new System.Collections.Generic.List <MyScenes>();
                UnityEditor.EditorBuildSettings.scenes = PathFromTheSceneInCurrentList();
            }
            UnityEditor.EditorGUILayout.EndHorizontal();
            UnityEditor.EditorGUILayout.EndVertical();
        }

        UnityEditor.EditorGUILayout.EndVertical();
        UnityEditor.EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 5
0
 private void RemoveScene(MyScenes scene)
 {
     EditorConfiguration.Scenes.Remove(scene);
     UnityEditor.EditorBuildSettings.scenes = PathFromTheSceneInCurrentList();
 }