Esempio n. 1
0
        public void OnEnable()
        {
            if (!thisWindowReference)
            {
                thisWindowReference = this;
                EditorApplication.playModeStateChanged += Return;
            }
            else
            {
                DestroyImmediate(thisWindowReference);
                return;
            }

            if (!Language.Initialized)
            {
                Language.Initialize();
            }

            if (!Controller.Instance.Initialized)
            {
                Controller.ResetInstance();
                Controller.Instance.Init();
            }

            var initialScene = AssetDatabase.LoadAssetAtPath <SceneAsset>("Assets/uAdventure/Scenes/_Scene1.unity");

            if (initialScene)
            {
                EditorSceneManager.playModeStartScene = initialScene;
            }
            else
            {
                var title = "EditorWindow.MainSceneNotFound.Title".Traslate();
                var body  = "EditorWindow.MainSceneNotFound.Body".Traslate();
                var ok    = "GeneralText.OK".Traslate();
                EditorUtility.DisplayDialog(title, body, ok);
            }


            if (!redoTexture)
            {
                redoTexture = Resources.Load <Texture2D>("EAdventureData/img/icons/redo");
            }
            if (!undoTexture)
            {
                undoTexture = Resources.Load <Texture2D>("EAdventureData/img/icons/undo");
            }
            if (!adaptationTexture)
            {
                adaptationTexture = Resources.Load <Texture2D>("EAdventureData/img/icons/adaptationProfiles");
            }

            fileMenu          = new FileMenu();
            editMenu          = new EditMenu();
            adventureMenu     = new AdventureMenu();
            chaptersMenu      = new ChaptersMenu();
            configurationMenu = new ConfigurationMenu();
            aboutMenu         = new AboutMenu();
        }
        public void OnEnable()
        {
            if (!thisWindowReference)
            {
                thisWindowReference = this;
            }
            else
            {
                DestroyImmediate(thisWindowReference);
            }

            if (!Controller.getInstance().Initialized())
            {
                Controller.resetInstance();
                Language.Initialize();
                Controller.getInstance().init();
            }

            if (!redoTexture)
            {
                redoTexture = (Texture2D)Resources.Load("EAdventureData/img/icons/redo", typeof(Texture2D));
            }
            if (!undoTexture)
            {
                undoTexture = (Texture2D)Resources.Load("EAdventureData/img/icons/undo", typeof(Texture2D));
            }
            if (!adaptationTexture)
            {
                adaptationTexture = (Texture2D)Resources.Load("EAdventureData/img/icons/adaptationProfiles", typeof(Texture2D));
            }

            fileMenu          = new FileMenu();
            editMenu          = new EditMenu();
            adventureMenu     = new AdventureMenu();
            chaptersMenu      = new ChaptersMenu();
            runMenu           = new RunMenu();
            configurationMenu = new ConfigurationMenu();
            aboutMenu         = new AboutMenu();
        }