Exemplo n.º 1
0
 public void Execute()
 {
     if (UnityEngine.Input.GetKeyDown(KeyCode.Escape))
     {
         SceneSetup.LoadPreviousScene();
     }
 }
    void OnGUI()
    {
        GUILayout.Label("STEP Export", EditorStyles.boldLabel);

        GUILayout.Space(20f);

        // create the simulated right handed coordinate system and spawn the sample model
        GUILayout.Label("Setup right handed coordinate system:", EditorStyles.label);
        if (GUILayout.Button("Setup"))
        {
            if (GameObject.Find("simulated_right_handed_coordinate_system_Z_up") != null)
            {
                Debug.LogWarning("GameObject with name 'simulated_right_handed_coordinate_system_Z_up' already exists. Delete the GameObject first.");
                return;
            }

            sceneSetup = new SceneSetup();
            stepExport = new StepExport();

            rootCoordinateSystem = sceneSetup.Setup();
        }

        GUILayout.Space(20f);

        // specify export path and provide option to export the scene content to file
        GUILayout.Label("Specify export path and write file:", EditorStyles.label);
        EditorGUI.BeginDisabledGroup(sceneSetup == null || rootCoordinateSystem == null);
        path = GUILayout.TextField(path);
        GUILayout.Space(4f);
        if (GUILayout.Button("Export STEP"))
        {
            stepExport.WriteSceneToStepFile(path, rootCoordinateSystem);
        }
        EditorGUI.EndDisabledGroup();
    }
        public static void LoadDataPackageInToEditor(LevelSceneData sceneData)
        {
            //Get the selected data
            if (sceneData)
            {
                int loadcount = sceneData.SceneList.Count;
                if (!String.IsNullOrEmpty(sceneData.MasterScene))
                {
                    loadcount++;
                }
                SceneSetup[] setup = new SceneSetup[loadcount];
                int          i     = 0;
                if (loadcount > sceneData.SceneList.Count)
                {
                    setup[0]          = new SceneSetup();
                    setup[0].path     = sceneData.MasterScene;
                    setup[0].isLoaded = true;
                    setup[0].isActive = true;

                    i = 1;
                }
                foreach (SceneData sdata in sceneData.SceneList)
                {
                    setup[i]          = new SceneSetup();
                    setup[i].path     = sdata.Path;
                    setup[i].isLoaded = true;
                    i++;
                }
                EditorSceneManager.RestoreSceneManagerSetup(setup);
            }
        }
Exemplo n.º 4
0
 public void Execute()
 {
     if (UnityEngine.Input.GetKeyDown(KeyCode.Escape))
     {
         SceneSetup.LoadScene("MainMenu");
     }
 }
Exemplo n.º 5
0
 public void Execute()
 {
     if (UnityEngine.Input.GetKeyDown(KeyCode.R))
     {
         SceneSetup.LoadScene("Editor");
     }
 }
Exemplo n.º 6
0
            /// <summary>
            /// Construct from a Unity SceneSetup
            /// </summary>
            public SceneEntry(SceneSetup sceneSetup)
            {
                scene = new AmsSceneReference(sceneSetup.path);

                loadInEditor = sceneSetup.isLoaded;
                loadMethod   = LoadMethod.Additive;
            }
Exemplo n.º 7
0
    public void LoadSetupInclusive()
    {
        SceneSetup[] current  = EditorSceneManager.GetSceneManagerSetup();
        SceneSetup[] newSetup = new SceneSetup[current.Length + setup.Length];

        int newSetupIndex = 0;

        for (int i = 0; i < current.Length; i++)
        {
            newSetup[newSetupIndex] = current[i];
            newSetupIndex++;
        }
        for (int i = 0; i < setup.Length; i++)
        {
            newSetup[newSetupIndex] = new SceneSetup()
            {
                path     = setup[i].path,
                isLoaded = setup[i].isLoaded,
                isActive = false
            };
            newSetupIndex++;
        }

        EditorSceneManager.RestoreSceneManagerSetup(newSetup);
    }
Exemplo n.º 8
0
 public void Execute(List <Entity> entities)
 {
     if (entities.Any(x => x.hasActingSequences))
     {
         return;
     }
     SceneSetup.LoadScene("Editor");
 }
Exemplo n.º 9
0
        public SceneSetup ConvertToSceneSetup()
        {
            SceneSetup ss = new SceneSetup();

            ss.isActive = isActive;
            ss.isLoaded = isLoaded;
            ss.path     = path;
            return(ss);
        }
Exemplo n.º 10
0
            internal SceneSetup ToSceneSetup()
            {
                var ss = new SceneSetup();

                ss.isActive = isActive;
                ss.isLoaded = isLoaded;
                ss.path     = path;
                return(ss);
            }
Exemplo n.º 11
0
        public SceneSetup ToSceneSetup()
        {
            var sceneSetup = new SceneSetup();

            sceneSetup.path     = AssetDatabase.GUIDToAssetPath(guid);
            sceneSetup.isActive = isActive;
            sceneSetup.isLoaded = isLoaded;
            return(sceneSetup);
        }
Exemplo n.º 12
0
 static void LoadMaster()
 {
     SceneSetup[] sceneSetup = new SceneSetup[1];
     sceneSetup[0]          = new SceneSetup();
     sceneSetup[0].path     = GameMasterSettings.GAMEMASTER_SCENE;
     sceneSetup[0].isLoaded = true;
     sceneSetup[0].isActive = true;
     EditorSceneManager.RestoreSceneManagerSetup(sceneSetup);
 }
Exemplo n.º 13
0
        public SceneSetup[] ToSceneSetups()
        {
            var result = new SceneSetup[sceneSetups.Length];

            for (int i = 0; i < sceneSetups.Length; i++)
            {
                result[i] = sceneSetups[i].ToSceneSetup();
            }
            return(result);
        }
Exemplo n.º 14
0
        private static void CheckHeaderForExits(int f, int headeraddr, Scene scene)
        {
            int  j          = headeraddr;
            int  setupsaddr = -1;
            int  nextlowest = -1;
            byte s;
            var  setup = new SceneSetup();

            scene.Setups.Add(setup);
            while (true)
            {
                byte cmd = RomData.MMFileList[f].Data[j];
                if (cmd == 0x13)
                {
                    setup.ExitListAddress = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                }
                else if (cmd == 0x17)
                {
                    setup.CutsceneListAddress = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                }
                else if (cmd == 0x18)
                {
                    setupsaddr = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                }
                else if (cmd == 0x14)
                {
                    break;
                }
                else
                {
                    if (RomData.MMFileList[f].Data[j + 4] == 0x02)
                    {
                        int p = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j + 4) & 0xFFFFFF;
                        if (((p < nextlowest) || (nextlowest == -1)) && ((p > setupsaddr) && (setupsaddr != -1)))
                        {
                            nextlowest = p;
                        }
                    }
                }
                j += 8;
            }
            if ((setupsaddr != -1) && nextlowest != -1)
            {
                j = setupsaddr;
                s = RomData.MMFileList[f].Data[j];
                while (s == 0x02)
                {
                    int p = (int)ReadWriteUtils.Arr_ReadU32(RomData.MMFileList[f].Data, j) & 0xFFFFFF;
                    CheckHeaderForExits(f, p, scene);
                    j += 4;
                    s  = RomData.MMFileList[f].Data[j];
                }
            }
        }
        private static SceneSetup[] ConvertRuntimeToEditorSceneSetups(RuntimeSceneSetup[] RuntimeSceneSetups)
        {
            SceneSetup[] sceneSetups = new SceneSetup[RuntimeSceneSetups.Length];

            for (int i = 0; i < RuntimeSceneSetups.Length; ++i)
            {
                sceneSetups[i] = RuntimeSceneSetups[i].ConvertToSceneSetup();
            }

            return(sceneSetups);
        }
Exemplo n.º 16
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (Instance != this)
     {
         DestroyImmediate(gameObject);
     }
 }
Exemplo n.º 17
0
        public PlayerState(SceneSetup setup)
        {
            this.setup = setup;

            Equipment = new Dictionary <string, EquipmentState>();
            Bag       = new Dictionary <RewardType, int>();
            foreach (var equipment in setup.Equipment)
            {
                Equipment[equipment.Identifier] = new EquipmentState()
                {
                    Level = equipment.StartingLevel
                };
            }
        }
Exemplo n.º 18
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();                     // For non hidden inspector fields to be displayed
        SceneSetup sceneSetup = (SceneSetup)target; // Set reference to main SceneSetup script

        // Draw checkboxes for bools
        sceneSetup.overrideFarClip = EditorGUILayout.Toggle("Override Far Clip", sceneSetup.overrideFarClip);

        // Show overrride for far clip plane
        if (sceneSetup.overrideFarClip)
        {
            sceneSetup.farDistanceOverride = EditorGUILayout.IntSlider("Far Distance Override", sceneSetup.farDistanceOverride, 1, 2000);
        }
    }
Exemplo n.º 19
0
 static void AddMaster()
 {
     SceneSetup[] sceneSetupRaw = EditorSceneManager.GetSceneManagerSetup();
     //Array.Resize(ref sceneSetup, sceneSetup.Length + 1);
     SceneSetup[] sceneSetup = new SceneSetup[sceneSetupRaw.Length + 1];
     for (int i = 0; i < sceneSetupRaw.Length; i++)
     {
         sceneSetup[i + 1] = sceneSetupRaw[i];
     }
     sceneSetup[0]          = new SceneSetup();
     sceneSetup[0].path     = GameMasterSettings.GAMEMASTER_SCENE;
     sceneSetup[0].isLoaded = true;
     sceneSetup[0].isActive = false;
     EditorSceneManager.RestoreSceneManagerSetup(sceneSetup);
 }
        public static void RestoreSetup(EditorSceneSetup editorSetup)
        {
            SceneSetup[] setups = new SceneSetup[editorSetup.LoadedScenes.Length];

            for (int i = 0; i < setups.Length; i++)
            {
                setups[i] = new SceneSetup();
                string path = AssetDatabase.GetAssetPath(editorSetup.LoadedScenes[i].Scene);
                setups[i].path     = path;
                setups[i].isLoaded = editorSetup.LoadedScenes[i].Loaded;
                setups[i].isActive = (editorSetup.ActiveScene == i);
            }

            EditorSceneManager.RestoreSceneManagerSetup(setups);
        }
Exemplo n.º 21
0
        public static void RestoreState(SceneState state)
        {
            var scenes = new SceneSetup[state.Scenes.Length];

            for (var i = 0; i < state.Scenes.Length; i++)
            {
                scenes[i] = new SceneSetup {
                    isActive = state.Scenes[i].IsActive, isLoaded = state.Scenes[i].IsLoaded, path = state.Scenes[i].Path
                }
            }
            ;

            EditorSceneManager.RestoreSceneManagerSetup(scenes);
        }

        #endregion
    }
Exemplo n.º 22
0
        public void Execute(List <Entity> entities)
        {
            var hero       = entities.SingleEntity();
            var levelExits = _levelExitsGroup.GetEntities();

            if (levelExits.Any(x => x.position.Value == hero.position.Value))
            {
                try
                {
                    // TODO: FIX SO THAT NEXT LEVEL IS LOADED!
                    SceneSetup.LoadScene("Play");
                }
                catch (Exception)
                {
                    SceneManager.LoadScene("gameover");
                }
            }
        }
Exemplo n.º 23
0
    void Start()
    {
        // PieceActionsDictionary = new Dictionary<string, PieceAction>();//LoadTextResource<PieceAction>();
        //  PieceEventsDictionary = new Dictionary<string, PieceEvent>();//LoadTextResource<PieceEvent>();
        //PieceModelObjectsDictionary = LoadTextResource<PieceModelObject>();
        //PieceModelTextPanelsDictionary = LoadTextResource<PieceModelTextPanel>();
        //TrackedTagsDictionary = LoadTextResource<TrackedTag>();

        //PieceModelTextPanelsDictionary.Values.ForEach(pm => pm.ModelType = "PieceModelTextPanel");

        PieceActions = ResourcesMaster.JsonToList <PieceAction>("PieceActions");
        string lcsp = ResourcesMaster.ListToJson <PieceAction>(PieceActions);

        foreach (PieceAction pa in PieceActions)
        {
            pa.FullyLoad();
            //PieceActionsDictionary.Add(pa.Name, pa);
        }
        //ResourcesMaster.WriteUp("PieceActions", lcsp);

        SceneSetup = ResourcesMaster.JsonToObject <SceneSetup>("SceneSetup_Torno");
        string sss = ResourcesMaster.ObjectToJson <SceneSetup>(SceneSetup);

        ResourcesMaster.WriteUp("SceneSetupBackup", sss);

        foreach (TrackedAnimationTag Tk in SceneSetup.TrackedAnimationTags)
        {
            foreach (PieceModel Panel in Tk.Panels)
            {
                Panel.FullyLoad();
            }
            foreach (PieceModel Model in Tk.Models)
            {
                Model.FullyLoad();
            }
        }



        //
    }
Exemplo n.º 24
0
        public static bool OnOpenMultiSceneSetup(int instanceID, int line)
        {
            Object openObject = EditorUtility.InstanceIDToObject(instanceID);

            if (!(openObject is MultiSceneSetup))
            {
                return(false);
            }
            MultiSceneSetup multiSceneSetup = openObject as MultiSceneSetup;

            SceneSetup[] sceneSetup = new SceneSetup[multiSceneSetup.scenePaths.Length];
            for (int i = 0; i < sceneSetup.Length; i++)
            {
                sceneSetup[i]          = new SceneSetup();
                sceneSetup[i].path     = "Assets/" + multiSceneSetup.scenePaths[i];
                sceneSetup[i].isActive = multiSceneSetup.indexActiveScene == i;
                sceneSetup[i].isLoaded = true;
            }
            EditorSceneManager.RestoreSceneManagerSetup(sceneSetup);
            return(true);
        }
Exemplo n.º 25
0
        public void Start()
        {
            SceneSetup.CurrentScene     = "MainMenu";
            SceneSetup.OnSceneChanging += OnSceneChanging;

            var canvas = GameObject.Find("Canvas");

            _uiPool = Pools.ui;

            _systems = SceneSetup.CreateSystem().Add <ReloadSystem>()
                       .Add(_uiPool.CreateSystem <AddOrRemoveViewSystem>())
                       .Add(_uiPool.CreateSystem <ConnectMenuItemToParentSystem>())
                       .Add(_uiPool.CreateSystem <CursorClickMenuItemSystem>())
                       .Add(_uiPool.CreateSystem <SelectedItemAnimationSystem>())
                       .Add(_uiPool.CreateSystem <DestroySystem>());

            _uiPool.CreateMenuItems(canvas,
                                    new Tuple <string, Action>("New Game", () => SceneSetup.LoadScene("Play")),
                                    new Tuple <string, Action>("Editor", () => SceneSetup.LoadScene("Editor")));

            _systems.Initialize();
        }
    public static void LoadEditorScenes(MultiSceneController.ScenePathList scenePathList)
    {
        var scenePaths = scenePathList.scenePaths;
        var scenes     = new List <SceneSetup>(scenePaths.Length);

        for (int i = 0; i < scenePaths.Length; ++i)
        {
            if (string.IsNullOrEmpty(scenePaths[i]))
            {
                continue;
            }

            var scene = new SceneSetup();
            scene.path     = scenePaths[i];
            scene.isActive = i == scenePathList.activeSceneIndex;
            scene.isLoaded = true;
            scenes.Add(scene);
        }

        Debug.LogFormat("Restoring {0} editor scenes.", scenes.Count);
        EditorSceneManager.RestoreSceneManagerSetup(scenes.ToArray());
    }
Exemplo n.º 27
0
 static bool ValidateInstantiatePrefabs()
 {
     return(SceneSetup.DoPrefabsExist());
 }
Exemplo n.º 28
0
 static void InstantiatePrefabs()
 {
     SceneSetup.SetupScene();
 }
Exemplo n.º 29
0
 public void LoadScene()
 {
     SceneSetup.LoadScene("MainMenu");
 }
Exemplo n.º 30
0
 void Start()
 {
     _sceneSetUp = GameObject.FindGameObjectWithTag("MainManager").GetComponent <SceneSetup>();
     levelOverPanel.SetActive(false);
 }