Пример #1
0
        public static ActionListAsset CreateAsset()
        {
            ScriptableObject t = CustomAssetUtility.CreateAsset <ActionListAsset> ("New ActionList");

            EditorGUIUtility.PingObject(t);
            return((ActionListAsset)t);
        }
        public static ActionListAsset CreateAsset(string assetName)
        {
            ScriptableObject t = CustomAssetUtility.CreateAsset <ActionListAsset> (assetName);

            EditorGUIUtility.PingObject(t);
            ACDebug.Log("Created ActionList: " + assetName);
            return((ActionListAsset)t);
        }
Пример #3
0
        private void AskToCreate <T> (string obName) where T : ScriptableObject
        {
            EditorStyles.label.wordWrap = true;
            GUILayout.Label("A '" + obName + "' asset is required for the game to run correctly.", EditorStyles.label);

            if (GUILayout.Button("Create new " + obName + " file"))
            {
                try {
                    ScriptableObject t = CustomAssetUtility.CreateAsset <T> (obName);

                    Undo.RecordObject(references, "Assign " + obName);

                    if (t is SceneManager)
                    {
                        references.sceneManager = (SceneManager)t;
                    }
                    else if (t is SettingsManager)
                    {
                        references.settingsManager = (SettingsManager)t;
                    }
                    else if (t is ActionsManager)
                    {
                        references.actionsManager = (ActionsManager)t;
                        RefreshActions();
                    }
                    else if (t is VariablesManager)
                    {
                        references.variablesManager = (VariablesManager)t;
                    }
                    else if (t is InventoryManager)
                    {
                        references.inventoryManager = (InventoryManager)t;
                    }
                    else if (t is SpeechManager)
                    {
                        references.speechManager = (SpeechManager)t;
                    }
                    else if (t is CursorManager)
                    {
                        references.cursorManager = (CursorManager)t;
                    }
                    else if (t is MenuManager)
                    {
                        references.menuManager = (MenuManager)t;
                    }
                }
                catch
                {
                    ACDebug.LogWarning("Could not create " + obName + ".");
                }
            }
        }
Пример #4
0
        private void AskToCreate <T> (string obName) where T : ScriptableObject
        {
            EditorStyles.label.wordWrap = true;
            EditorGUILayout.HelpBox("A '" + obName + "' asset is required for the game to run correctly. Please either click the button below to create one, or use the New Game Wizard to create a set of Managers.", MessageType.Warning);

            if (GUILayout.Button("Create new " + obName + " asset file"))
            {
                try {
                    ScriptableObject t = CustomAssetUtility.CreateAsset <T> (obName);

                    Undo.RecordObject(references, "Assign " + obName);

                    if (t is SceneManager)
                    {
                        references.sceneManager = (SceneManager)t;
                    }
                    else if (t is SettingsManager)
                    {
                        references.settingsManager = (SettingsManager)t;
                    }
                    else if (t is ActionsManager)
                    {
                        references.actionsManager = (ActionsManager)t;
                        RefreshActions();
                    }
                    else if (t is VariablesManager)
                    {
                        references.variablesManager = (VariablesManager)t;
                    }
                    else if (t is InventoryManager)
                    {
                        references.inventoryManager = (InventoryManager)t;
                    }
                    else if (t is SpeechManager)
                    {
                        references.speechManager = (SpeechManager)t;
                    }
                    else if (t is CursorManager)
                    {
                        references.cursorManager = (CursorManager)t;
                    }
                    else if (t is MenuManager)
                    {
                        references.menuManager = (MenuManager)t;
                    }
                }
                catch
                {
                    ACDebug.LogWarning("Could not create " + obName + ".");
                }
            }
        }
Пример #5
0
        public static void ConvertToActionListAsset(MenuCommand command)
        {
            ActionList       actionList = (ActionList)command.context;
            ScriptableObject t          = CustomAssetUtility.CreateAsset <ActionListAsset> (actionList.gameObject.name);

            ActionListAsset actionListAsset = (ActionListAsset)t;

            actionListAsset.CopyFromActionList(actionList);
            AssetDatabase.SaveAssets();
            EditorGUIUtility.PingObject(t);

            EditorUtility.SetDirty(actionListAsset);
        }
Пример #6
0
        public static void MissingReferencesGUI()
        {
            string intendedDirectory = Resource.MainFolderPathRelativeToAssets + Path.DirectorySeparatorChar.ToString() + "Resources";

            EditorStyles.label.wordWrap = true;
            GUILayout.Label("Error - missing References", CustomStyles.managerHeader);
            EditorGUILayout.Space();
            EditorGUILayout.HelpBox("A 'References' file must be present in the directory '" + intendedDirectory + "' - please click to create one.", MessageType.Warning);

            if (GUILayout.Button("Create 'References' file"))
            {
                CustomAssetUtility.CreateAsset <References> ("References", intendedDirectory);
            }
        }
Пример #7
0
        private void CreateManagerPackage(string folder)
        {
            ManagerPackage managerPackage = CustomAssetUtility.CreateAsset <ManagerPackage> ("ManagerPackage", folder);

            AssetDatabase.RenameAsset("Assets/" + folder + "/ManagerPackage.asset", folder + "_ManagerPackage");

            managerPackage.sceneManager     = references.sceneManager;
            managerPackage.settingsManager  = references.settingsManager;
            managerPackage.actionsManager   = references.actionsManager;
            managerPackage.variablesManager = references.variablesManager;

            managerPackage.inventoryManager = references.inventoryManager;
            managerPackage.speechManager    = references.speechManager;
            managerPackage.cursorManager    = references.cursorManager;
            managerPackage.menuManager      = references.menuManager;

            EditorUtility.SetDirty(managerPackage);
            AssetDatabase.SaveAssets();
        }
Пример #8
0
        public static void ConvertToActionListAsset(MenuCommand command)
        {
            ActionList actionList = (ActionList)command.context;

            bool referenceNewAsset = EditorUtility.DisplayDialog("Reference asset?", "Do you want the existing ActionList '" + actionList.name + "' to use the new ActionList asset as it's Actions source?", "Yes", "No");

            ScriptableObject t = CustomAssetUtility.CreateAsset <ActionListAsset> (actionList.gameObject.name);

            ActionListAsset actionListAsset = (ActionListAsset)t;

            actionListAsset.CopyFromActionList(actionList);
            AssetDatabase.SaveAssets();
            EditorGUIUtility.PingObject(t);

            EditorUtility.SetDirty(actionListAsset);

            if (referenceNewAsset)
            {
                actionList.source    = ActionListSource.AssetFile;
                actionList.assetFile = actionListAsset;
            }
        }
Пример #9
0
        private ManagerPackage CreateManagerPackage(string folder, SceneManager sceneManager, SettingsManager settingsManager, ActionsManager actionsManager, VariablesManager variablesManager, InventoryManager inventoryManager, SpeechManager speechManager, CursorManager cursorManager, MenuManager menuManager)
        {
            ManagerPackage managerPackage = CustomAssetUtility.CreateAsset <ManagerPackage> ("ManagerPackage", folder);

            AssetDatabase.RenameAsset("Assets/" + folder + "/ManagerPackage.asset", folder + "_ManagerPackage");

            managerPackage.sceneManager     = sceneManager;
            managerPackage.settingsManager  = settingsManager;
            managerPackage.actionsManager   = actionsManager;
            managerPackage.variablesManager = variablesManager;

            managerPackage.inventoryManager = inventoryManager;
            managerPackage.speechManager    = speechManager;
            managerPackage.cursorManager    = cursorManager;
            managerPackage.menuManager      = menuManager;

            managerPackage.AssignManagers();
            EditorUtility.SetDirty(managerPackage);
            AssetDatabase.SaveAssets();

            AdventureCreator.Init();

            return(managerPackage);
        }
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0]);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }
                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string newCanvasPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                GameObject canvasObInScene = (GameObject)PrefabUtility.InstantiatePrefab(defaultMenu.canvas.gameObject);
                                PrefabUtility.DisconnectPrefabInstance(canvasObInScene);
                                GameObject canvasObNewPrefab = PrefabUtility.CreatePrefab(newCanvasPath, canvasObInScene);

                                newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                DestroyImmediate(canvasObInScene);

                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                            newMenu.hideFlags = HideFlags.HideInHierarchy;

                            references.menuManager.menus.Add(newMenu);
                        }

                        EditorUtility.SetDirty(references.menuManager);
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Setup scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
Пример #11
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch
            {
                Debug.LogWarning("Could not create directory: " + Application.dataPath + "/" + managerPath);
                pageNumber--;
                return;
            }

            try
            {
                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                references.settingsManager.movingTurning     = movingTurning;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager demoActionsManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (demoActionsManager != null)
                {
                    references.actionsManager.defaultClass = demoActionsManager.defaultClass;
                }

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;

                references.speechManager.ClearLanguages();

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                if (wizardMenu != WizardMenu.Blank)
                {
                    CursorManager demoCursorManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                    if (demoCursorManager != null)
                    {
                        foreach (CursorIcon demoIcon in demoCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(demoIcon);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_CursorManager asset to copy from!");
                    }
                    references.cursorManager.allowMainCursor = true;

                    CursorIconBase pointerIcon = new CursorIconBase();
                    pointerIcon.Copy(demoCursorManager.pointerIcon);
                    references.cursorManager.pointerIcon = pointerIcon;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager demoMenuManager = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/Managers/Demo_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (demoMenuManager != null)
                    {
                        references.menuManager.drawOutlines = demoMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = demoMenuManager.drawInEditor;
                        references.menuManager.pauseTexture = demoMenuManager.pauseTexture;

                        if (wizardMenu == WizardMenu.DefaultUnityUI)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu demoMenu in demoMenuManager.menus)
                        {
                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(demoMenu);

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;

                                if (demoMenu.canvas)
                                {
                                    string oldCanvasPath = AssetDatabase.GetAssetPath(demoMenu.canvas);
                                    string newCanvasPath = "Assets/" + gameName + "/UI/" + demoMenu.canvas.name + ".prefab";
                                    if (AssetDatabase.CopyAsset(oldCanvasPath, newCanvasPath))
                                    {
                                        AssetDatabase.ImportAsset(newCanvasPath);
                                        newMenu.canvas = (Canvas)AssetDatabase.LoadAssetAtPath(newCanvasPath, typeof(Canvas));
                                    }
                                }
                            }

                            newMenu.hideFlags = HideFlags.HideInHierarchy;
                            references.menuManager.menus.Add(newMenu);
                            EditorUtility.SetDirty(references.menuManager);
                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                newElement.hideFlags = HideFlags.HideInHierarchy;
                                AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                            }
                            AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                        }
                    }
                    else
                    {
                        Debug.LogWarning("Cannot find Demo_MenuManager asset to copy from!");
                    }
                }

                CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();
                references.sceneManager.InitialiseObjects();
                pageNumber = 0;
            }
            catch
            {
                Debug.LogWarning("Could not create Manager. Does the subdirectory " + Resource.managersDirectory + " exist?");
                pageNumber--;
            }
        }
Пример #12
0
 public static void CreateAsset()
 {
     CustomAssetUtility.CreateAsset <ManagerPackage> ("New ManagerPackage");
 }
Пример #13
0
        /**
         * Assigns its various Manager asset files.
         */
        public void AssignManagers()
        {
            if (AdvGame.GetReferences() != null)
            {
                int numAssigned = 0;

                if (sceneManager)
                {
                    AdvGame.GetReferences().sceneManager = sceneManager;
                    numAssigned++;
                }

                if (settingsManager)
                {
                    AdvGame.GetReferences().settingsManager = settingsManager;
                    numAssigned++;
                }

                if (actionsManager)
                {
                    AdvGame.GetReferences().actionsManager = actionsManager;
                    numAssigned++;
                }

                if (variablesManager)
                {
                    AdvGame.GetReferences().variablesManager = variablesManager;
                    numAssigned++;
                }

                if (inventoryManager)
                {
                    AdvGame.GetReferences().inventoryManager = inventoryManager;
                    numAssigned++;
                }

                if (speechManager)
                {
                    AdvGame.GetReferences().speechManager = speechManager;
                    numAssigned++;
                }

                if (cursorManager)
                {
                    AdvGame.GetReferences().cursorManager = cursorManager;
                    numAssigned++;
                }

                if (menuManager)
                {
                    AdvGame.GetReferences().menuManager = menuManager;
                    numAssigned++;
                }

                                #if UNITY_EDITOR
                if (!Application.isPlaying)
                {
                    KickStarter.ClearManagerCache();
                }

                if (KickStarter.sceneManager)
                {
                    KickStarter.sceneManager.GetPrefabsInScene();
                }

                UnityVersionHandler.CustomSetDirty(AdvGame.GetReferences(), true);
                AssetDatabase.SaveAssets();
                                #endif

                if (this)
                {
                    if (numAssigned == 0)
                    {
                        ACDebug.Log(this.name + " No Mangers assigned.");
                    }
                    else if (numAssigned == 1)
                    {
                        ACDebug.Log(this.name + " - (" + numAssigned.ToString() + ") Manager assigned.", this);
                    }
                    else
                    {
                        ACDebug.Log(this.name + " - (" + numAssigned.ToString() + ") Managers assigned.", this);
                    }
                }
            }
            else
            {
                                #if UNITY_EDITOR
                string intendedDirectory = Resource.MainFolderPathRelativeToAssets + System.IO.Path.DirectorySeparatorChar.ToString() + "Resources";

                bool canProceed = EditorUtility.DisplayDialog("Error - missing References", "A 'References' file must be present in the directory '" + intendedDirectory + "'. Create one?", "OK", "Cancel");
                if (!canProceed)
                {
                    return;
                }

                CustomAssetUtility.CreateAsset <References> ("References", intendedDirectory);

                if (AdvGame.GetReferences() != null)
                {
                    AssignManagers();
                }
                                #else
                ACDebug.LogError("Can't assign managers - no References file found in Resources folder.");
                                #endif
            }
        }
Пример #14
0
        private void Finish()
        {
            if (!references)
            {
                GetReferences();
            }

            if (!references)
            {
                return;
            }

            string managerPath = gameName + "/Managers";

            try
            {
                System.IO.Directory.CreateDirectory(Application.dataPath + "/" + managerPath);
            }
            catch (System.Exception e)
            {
                ACDebug.LogError("Wizard aborted - Could not create directory: " + Application.dataPath + "/" + managerPath + ". Please make sure the Assets direcrory is writeable, and that the intended game name contains no special characters.");
                Debug.LogException(e, this);
                pageNumber--;
                return;
            }

            try
            {
                ShowProgress(0f);

                ScriptableObject t = CustomAssetUtility.CreateAsset <SceneManager> ("SceneManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SceneManager.asset", gameName + "_SceneManager");
                references.sceneManager = (SceneManager)t;

                ShowProgress(0.1f);

                t = CustomAssetUtility.CreateAsset <SettingsManager> ("SettingsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SettingsManager.asset", gameName + "_SettingsManager");
                references.settingsManager = (SettingsManager)t;

                references.settingsManager.saveFileName      = gameName;
                references.settingsManager.cameraPerspective = cameraPerspective;
                references.settingsManager.movingTurning     = movingTurning;
                references.settingsManager.movementMethod    = movementMethod;
                references.settingsManager.inputMethod       = inputMethod;
                references.settingsManager.interactionMethod = interactionMethod;
                references.settingsManager.hotspotDetection  = hotspotDetection;
                if (cameraPerspective == CameraPerspective.TwoPointFiveD)
                {
                    references.settingsManager.forceAspectRatio = true;
                }

                ShowProgress(0.2f);

                t = CustomAssetUtility.CreateAsset <ActionsManager> ("ActionsManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/ActionsManager.asset", gameName + "_ActionsManager");
                references.actionsManager = (ActionsManager)t;
                AdventureCreator.RefreshActions();
                ActionsManager defaultActionsManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_ActionsManager.asset", typeof(ActionsManager)) as ActionsManager;
                if (defaultActionsManager != null)
                {
                    references.actionsManager.defaultClass     = defaultActionsManager.defaultClass;
                    references.actionsManager.defaultClassName = defaultActionsManager.defaultClassName;
                }

                ShowProgress(0.3f);

                t = CustomAssetUtility.CreateAsset <VariablesManager> ("VariablesManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/VariablesManager.asset", gameName + "_VariablesManager");
                references.variablesManager = (VariablesManager)t;

                ShowProgress(0.4f);

                t = CustomAssetUtility.CreateAsset <InventoryManager> ("InventoryManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/InventoryManager.asset", gameName + "_InventoryManager");
                references.inventoryManager = (InventoryManager)t;

                ShowProgress(0.5f);

                t = CustomAssetUtility.CreateAsset <SpeechManager> ("SpeechManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/SpeechManager.asset", gameName + "_SpeechManager");
                references.speechManager = (SpeechManager)t;
                references.speechManager.ClearLanguages();

                ShowProgress(0.6f);

                t = CustomAssetUtility.CreateAsset <CursorManager> ("CursorManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/CursorManager.asset", gameName + "_CursorManager");
                references.cursorManager = (CursorManager)t;

                ShowProgress(0.7f);

                t = CustomAssetUtility.CreateAsset <MenuManager> ("MenuManager", managerPath);
                AssetDatabase.RenameAsset("Assets/" + managerPath + "/MenuManager.asset", gameName + "_MenuManager");
                references.menuManager = (MenuManager)t;

                CursorManager defaultCursorManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_CursorManager.asset", typeof(CursorManager)) as CursorManager;
                if (wizardMenu == WizardMenu.Blank)
                {
                    if (defaultCursorManager != null)
                    {
                        CursorIcon useIcon = new CursorIcon();
                        useIcon.Copy(defaultCursorManager.cursorIcons[0], false);
                        references.cursorManager.cursorIcons.Add(useIcon);
                        EditorUtility.SetDirty(references.cursorManager);
                    }
                }
                else
                {
                    if (defaultCursorManager != null)
                    {
                        foreach (CursorIcon defaultIcon in defaultCursorManager.cursorIcons)
                        {
                            CursorIcon newIcon = new CursorIcon();
                            newIcon.Copy(defaultIcon, false);
                            references.cursorManager.cursorIcons.Add(newIcon);
                        }

                        CursorIconBase pointerIcon = new CursorIconBase();
                        pointerIcon.Copy(defaultCursorManager.pointerIcon);
                        references.cursorManager.pointerIcon = pointerIcon;
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_CursorManager asset to copy from!");
                    }

                    references.cursorManager.allowMainCursor = true;
                    EditorUtility.SetDirty(references.cursorManager);

                    MenuManager defaultMenuManager = AssetDatabase.LoadAssetAtPath(Resource.MainFolderPath + "/Default/Default_MenuManager.asset", typeof(MenuManager)) as MenuManager;
                    if (defaultMenuManager != null)
                    {
                                                #if UNITY_EDITOR
                        references.menuManager.drawOutlines = defaultMenuManager.drawOutlines;
                        references.menuManager.drawInEditor = defaultMenuManager.drawInEditor;
                                                #endif
                        references.menuManager.pauseTexture = defaultMenuManager.pauseTexture;

                        if (wizardMenu != WizardMenu.Blank)
                        {
                            System.IO.Directory.CreateDirectory(Application.dataPath + "/" + gameName + "/UI");
                        }

                        foreach (Menu defaultMenu in defaultMenuManager.menus)
                        {
                            float progress = (float)defaultMenuManager.menus.IndexOf(defaultMenu) / (float)defaultMenuManager.menus.Count;
                            ShowProgress((progress * 0.3f) + 0.7f);

                            Menu newMenu = ScriptableObject.CreateInstance <Menu>();
                            newMenu.Copy(defaultMenu, true, true);
                            newMenu.Recalculate();

                            if (wizardMenu == WizardMenu.DefaultAC)
                            {
                                newMenu.menuSource = MenuSource.AdventureCreator;
                            }
                            else if (wizardMenu == WizardMenu.DefaultUnityUI)
                            {
                                newMenu.menuSource = MenuSource.UnityUiPrefab;
                            }

                            if (defaultMenu.canvas)
                            {
                                string oldPath = AssetDatabase.GetAssetPath(defaultMenu.canvas.gameObject);
                                string newPath = "Assets/" + gameName + "/UI/" + defaultMenu.canvas.name + ".prefab";

                                if (AssetDatabase.CopyAsset(oldPath, newPath))
                                {
                                    AssetDatabase.ImportAsset(newPath);
                                    GameObject canvasObNewPrefab = (GameObject)AssetDatabase.LoadAssetAtPath(newPath, typeof(GameObject));
                                    newMenu.canvas = canvasObNewPrefab.GetComponent <Canvas>();
                                }
                                else
                                {
                                    newMenu.canvas = null;
                                    ACDebug.LogWarning("Could not copy asset " + oldPath + " to " + newPath, defaultMenu.canvas.gameObject);
                                }
                                newMenu.rectTransform = null;
                            }

                            foreach (MenuElement newElement in newMenu.elements)
                            {
                                if (newElement != null)
                                {
                                    AssetDatabase.AddObjectToAsset(newElement, references.menuManager);
                                    newElement.hideFlags = HideFlags.HideInHierarchy;
                                }
                                else
                                {
                                    ACDebug.LogWarning("Null element found in " + newMenu.title + " - the interface may not be set up correctly.");
                                }
                            }

                            if (newMenu != null)
                            {
                                AssetDatabase.AddObjectToAsset(newMenu, references.menuManager);
                                newMenu.hideFlags = HideFlags.HideInHierarchy;

                                references.menuManager.menus.Add(newMenu);
                            }
                            else
                            {
                                ACDebug.LogWarning("Unable to create new Menu from original '" + defaultMenu.title + "'");
                            }
                        }

                        EditorUtility.SetDirty(references.menuManager);

                                                #if CAN_USE_TIMELINE
                        if (references.speechManager != null)
                        {
                            references.speechManager.previewMenuName = "Subtitles";
                            EditorUtility.SetDirty(references.speechManager);
                        }
                                                #endif
                    }
                    else
                    {
                        ACDebug.LogWarning("Cannot find Default_MenuManager asset to copy from!");
                    }
                }

                EditorUtility.ClearProgressBar();
                ManagerPackage newManagerPackage = CreateManagerPackage(gameName);

                AssetDatabase.SaveAssets();

                if (newManagerPackage == null || !newManagerPackage.IsFullyAssigned())
                {
                    EditorUtility.DisplayDialog("Wizard failed", "The New Game Wizard failed to generate a new 'Manager Package' file with all eight Managers assigned. Pleae verify that your Assets directory is writable and try again.", "OK");
                }
                else if (GameObject.FindObjectOfType <KickStarter>() == null)
                {
                    bool initScene = EditorUtility.DisplayDialog("Organise scene?", "Process complete.  Would you like to organise the scene objects to begin working?  This can be done at any time within the Scene Manager.", "Yes", "No");
                    if (initScene)
                    {
                        references.sceneManager.InitialiseObjects();
                    }
                }
            }
            catch (System.Exception e)
            {
                ACDebug.LogWarning("Could not create Manager. Does the subdirectory " + managerPath + " exist?");
                Debug.LogException(e, this);
                pageNumber--;
            }
        }
Пример #15
0
        public static void CreateAsset()
        {
            ScriptableObject t = CustomAssetUtility.CreateAsset <ManagerPackage> ("New ManagerPackage");

            EditorGUIUtility.PingObject(t);
        }
Пример #16
0
        private void OnGUI()
        {
            if (!ACInstaller.IsInstalled())
            {
                ACInstaller.DoInstall();
            }

            if (!references)
            {
                GetReferences();
            }

            if (references)
            {
                GUILayout.Space(10);

                GUILayout.BeginHorizontal();

                if (GUILayout.Toggle(showScene, "Scene", "toolbarbutton", tabWidth))
                {
                    SetTab(0);
                }
                if (GUILayout.Toggle(showSettings, "Settings", "toolbarbutton", tabWidth))
                {
                    SetTab(1);
                }
                if (GUILayout.Toggle(showActions, "Actions", "toolbarbutton", tabWidth))
                {
                    SetTab(2);
                }
                if (GUILayout.Toggle(showGVars, "Variables", "toolbarbutton", tabWidth))
                {
                    SetTab(3);
                }

                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();

                if (GUILayout.Toggle(showInvItems, "Inventory", "toolbarbutton", tabWidth))
                {
                    SetTab(4);
                }
                if (GUILayout.Toggle(showSpeech, "Speech", "toolbarbutton", tabWidth))
                {
                    SetTab(5);
                }
                if (GUILayout.Toggle(showCursor, "Cursor", "toolbarbutton", tabWidth))
                {
                    SetTab(6);
                }
                if (GUILayout.Toggle(showMenu, "Menu", "toolbarbutton", tabWidth))
                {
                    SetTab(7);
                }

                GUILayout.EndHorizontal();
                GUILayout.Space(5);

                scroll = GUILayout.BeginScrollView(scroll);

                if (showScene)
                {
                    GUILayout.Label("Scene manager", CustomStyles.managerHeader);
                    references.sceneManager = (SceneManager)EditorGUILayout.ObjectField("Asset file: ", references.sceneManager, typeof(SceneManager), false);
                    DrawManagerSpace();

                    if (!references.sceneManager)
                    {
                        AskToCreate <SceneManager> ("SceneManager");
                    }
                    else
                    {
                        if (references.sceneManager.name == "Demo_SceneManager" || references.sceneManager.name == "Demo2D_SceneManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.sceneManager.ShowGUI();
                    }
                }

                else if (showSettings)
                {
                    GUILayout.Label("Settings manager", CustomStyles.managerHeader);
                    references.settingsManager = (SettingsManager)EditorGUILayout.ObjectField("Asset file: ", references.settingsManager, typeof(SettingsManager), false);
                    DrawManagerSpace();

                    if (!references.settingsManager)
                    {
                        AskToCreate <SettingsManager> ("SettingsManager");
                    }
                    else
                    {
                        if (references.settingsManager.name == "Demo_SettingsManager" || references.settingsManager.name == "Demo2D_SettingsManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.settingsManager.ShowGUI();
                    }
                }

                else if (showActions)
                {
                    GUILayout.Label("Actions manager", CustomStyles.managerHeader);
                    references.actionsManager = (ActionsManager)EditorGUILayout.ObjectField("Asset file: ", references.actionsManager, typeof(ActionsManager), false);
                    DrawManagerSpace();

                    if (!references.actionsManager)
                    {
                        AskToCreate <ActionsManager> ("ActionsManager");
                    }
                    else
                    {
                        if (references.actionsManager.name == "Demo_ActionsManager" || references.actionsManager.name == "Demo2D_ActionsManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.actionsManager.ShowGUI();
                    }
                }

                else if (showGVars)
                {
                    GUILayout.Label("Variables manager", CustomStyles.managerHeader);
                    references.variablesManager = (VariablesManager)EditorGUILayout.ObjectField("Asset file: ", references.variablesManager, typeof(VariablesManager), false);
                    DrawManagerSpace();

                    if (!references.variablesManager)
                    {
                        AskToCreate <VariablesManager> ("VariablesManager");
                    }
                    else
                    {
                        if (references.variablesManager.name == "Demo_VariablesManager" || references.variablesManager.name == "Demo2D_VariablesManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.variablesManager.ShowGUI();
                    }
                }

                else if (showInvItems)
                {
                    GUILayout.Label("Inventory manager", CustomStyles.managerHeader);
                    references.inventoryManager = (InventoryManager)EditorGUILayout.ObjectField("Asset file: ", references.inventoryManager, typeof(InventoryManager), false);
                    DrawManagerSpace();

                    if (!references.inventoryManager)
                    {
                        AskToCreate <InventoryManager> ("InventoryManager");
                    }
                    else
                    {
                        if (references.inventoryManager.name == "Demo_InventoryManager" || references.inventoryManager.name == "Demo2D_InventoryManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.inventoryManager.ShowGUI();
                    }
                }

                else if (showSpeech)
                {
                    GUILayout.Label("Speech manager", CustomStyles.managerHeader);
                    references.speechManager = (SpeechManager)EditorGUILayout.ObjectField("Asset file: ", references.speechManager, typeof(SpeechManager), false);
                    DrawManagerSpace();

                    if (!references.speechManager)
                    {
                        AskToCreate <SpeechManager> ("SpeechManager");
                    }
                    else
                    {
                        if (references.speechManager.name == "Demo_SpeechManager" || references.speechManager.name == "Demo2D_SpeechManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.speechManager.ShowGUI();
                    }
                }

                else if (showCursor)
                {
                    GUILayout.Label("Cursor manager", CustomStyles.managerHeader);
                    references.cursorManager = (CursorManager)EditorGUILayout.ObjectField("Asset file: ", references.cursorManager, typeof(CursorManager), false);
                    DrawManagerSpace();

                    if (!references.cursorManager)
                    {
                        AskToCreate <CursorManager> ("CursorManager");
                    }
                    else
                    {
                        if (references.cursorManager.name == "Demo_CursorManager" || references.cursorManager.name == "Demo2D_CursorManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.cursorManager.ShowGUI();
                    }
                }

                else if (showMenu)
                {
                    GUILayout.Label("Menu manager", CustomStyles.managerHeader);
                    references.menuManager = (MenuManager)EditorGUILayout.ObjectField("Asset file: ", references.menuManager, typeof(MenuManager), false);
                    DrawManagerSpace();

                    if (!references.menuManager)
                    {
                        AskToCreate <MenuManager> ("MenuManager");
                    }
                    else
                    {
                        if (references.menuManager.name == "Demo_MenuManager" || references.menuManager.name == "Demo2D_MenuManager")
                        {
                            EditorGUILayout.HelpBox("The Demo Managers are for demonstration purposes only.  Modifying them to create your game may result in data loss upon upgrading - instead, use the New Game Wizard to create a new set of Managers.", MessageType.Warning);
                        }

                        references.menuManager.ShowGUI();
                    }
                }

                references.viewingMenuManager = showMenu;

                EditorGUILayout.Separator();
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                GUILayout.Label("Adventure Creator - Version " + AdventureCreator.version, EditorStyles.miniLabel);

                GUILayout.EndScrollView();
            }
            else
            {
                EditorStyles.label.wordWrap = true;
                GUILayout.Label("No 'References' asset found in the resources folder. Please click to create one.", EditorStyles.label);

                if (GUILayout.Button("Create 'References' file"))
                {
                    references = CustomAssetUtility.CreateAsset <References> ("References", "AdventureCreator" + Path.DirectorySeparatorChar.ToString() + "Resources");
                }
            }

            if (GUI.changed)
            {
                if (showActions)
                {
                    RefreshActions();
                }

                EditorUtility.SetDirty(this);
                EditorUtility.SetDirty(references);
            }
        }
Пример #17
0
        private void OnGUI()
        {
            if (!references)
            {
                GetReferences();
            }

            if (references)
            {
                GUILayout.Space(10);

                GUILayout.BeginHorizontal();

                if (GUILayout.Toggle(showScene, "Scene", "toolbarbutton", tabWidth))
                {
                    SetTab(0);
                }
                if (GUILayout.Toggle(showSettings, "Settings", "toolbarbutton", tabWidth))
                {
                    SetTab(1);
                }
                if (GUILayout.Toggle(showActions, "Actions", "toolbarbutton", tabWidth))
                {
                    SetTab(2);
                }
                if (GUILayout.Toggle(showGVars, "Variables", "toolbarbutton", tabWidth))
                {
                    SetTab(3);
                }

                GUILayout.EndHorizontal();
                GUILayout.BeginHorizontal();

                if (GUILayout.Toggle(showInvItems, "Inventory", "toolbarbutton", tabWidth))
                {
                    SetTab(4);
                }
                if (GUILayout.Toggle(showSpeech, "Speech", "toolbarbutton", tabWidth))
                {
                    SetTab(5);
                }
                if (GUILayout.Toggle(showCursor, "Cursor", "toolbarbutton", tabWidth))
                {
                    SetTab(6);
                }
                if (GUILayout.Toggle(showMenu, "Menu", "toolbarbutton", tabWidth))
                {
                    SetTab(7);
                }

                GUILayout.EndHorizontal();
                GUILayout.Space(5);

                scroll = GUILayout.BeginScrollView(scroll);

                if (showScene)
                {
                    GUILayout.Label("Scene manager", EditorStyles.largeLabel);

                    references.sceneManager = (SceneManager)EditorGUILayout.ObjectField("Asset file: ", references.sceneManager, typeof(SceneManager), false);

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.sceneManager)
                    {
                        AskToCreate <SceneManager> ("SceneManager");
                    }
                    else
                    {
                        references.sceneManager.ShowGUI();
                    }
                }

                else if (showSettings)
                {
                    GUILayout.Label("Settings manager", EditorStyles.largeLabel);

                    references.settingsManager = (SettingsManager)EditorGUILayout.ObjectField("Asset file: ", references.settingsManager, typeof(SettingsManager), false);

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.settingsManager)
                    {
                        AskToCreate <SettingsManager> ("SettingsManager");
                    }
                    else
                    {
                        references.settingsManager.ShowGUI();
                    }
                }

                else if (showActions)
                {
                    GUILayout.Label("Actions manager", EditorStyles.largeLabel);

                    references.actionsManager = (ActionsManager)EditorGUILayout.ObjectField("Asset file: ", references.actionsManager, typeof(ActionsManager), false);

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.actionsManager)
                    {
                        AskToCreate <ActionsManager> ("ActionsManager");
                    }
                    else
                    {
                        references.actionsManager.ShowGUI();
                    }
                }

                else if (showGVars)
                {
                    GUILayout.Label("Variables manager", EditorStyles.largeLabel);

                    references.variablesManager = (VariablesManager)EditorGUILayout.ObjectField("Asset file: ", references.variablesManager, typeof(VariablesManager), false);

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.variablesManager)
                    {
                        AskToCreate <VariablesManager> ("VariablesManager");
                    }
                    else
                    {
                        references.variablesManager.ShowGUI();
                    }
                }

                else if (showInvItems)
                {
                    GUILayout.Label("Inventory items manager", EditorStyles.largeLabel);

                    references.inventoryManager = (InventoryManager)EditorGUILayout.ObjectField("Asset file: ", references.inventoryManager, typeof(InventoryManager), false);

                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.inventoryManager)
                    {
                        AskToCreate <InventoryManager> ("InventoryManager");
                    }
                    else
                    {
                        references.inventoryManager.ShowGUI();
                    }
                }

                else if (showSpeech)
                {
                    GUILayout.Label("Speech manager", EditorStyles.largeLabel);


                    references.speechManager = (SpeechManager)EditorGUILayout.ObjectField("Asset file: ", references.speechManager, typeof(SpeechManager), false);
                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.speechManager)
                    {
                        AskToCreate <SpeechManager> ("SpeechManager");
                    }
                    else
                    {
                        references.speechManager.ShowGUI();
                    }
                }

                else if (showCursor)
                {
                    GUILayout.Label("Cursor manager", EditorStyles.largeLabel);


                    references.cursorManager = (CursorManager)EditorGUILayout.ObjectField("Asset file: ", references.cursorManager, typeof(CursorManager), false);
                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.cursorManager)
                    {
                        AskToCreate <CursorManager> ("CursorManager");
                    }
                    else
                    {
                        references.cursorManager.ShowGUI();
                    }
                }

                else if (showMenu)
                {
                    GUILayout.Label("Menu manager", EditorStyles.largeLabel);


                    references.menuManager = (MenuManager)EditorGUILayout.ObjectField("Asset file: ", references.menuManager, typeof(MenuManager), false);
                    EditorGUILayout.Separator();
                    GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

                    if (!references.menuManager)
                    {
                        AskToCreate <MenuManager> ("MenuManager");
                    }
                    else
                    {
                        references.menuManager.ShowGUI();
                    }
                }

                references.viewingMenuManager = showMenu;

                EditorGUILayout.Separator();
                GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
                GUILayout.Label("Adventure Creator - Version " + AdventureCreator.version, EditorStyles.miniLabel);

                GUILayout.EndScrollView();
            }
            else
            {
                EditorStyles.label.wordWrap = true;
                GUILayout.Label("No 'References' asset found in the resources folder. Please click to create one.", EditorStyles.label);

                if (GUILayout.Button("Create 'References' file"))
                {
                    references = CustomAssetUtility.CreateAsset <References> ("References", "AdventureCreator" + Path.DirectorySeparatorChar.ToString() + "Resources");
                }
            }

            if (GUI.changed)
            {
                if (showActions)
                {
                    RefreshActions();
                }

                EditorUtility.SetDirty(this);
                EditorUtility.SetDirty(references);
            }
        }