static void Demo3D()
        {
            ManagerPackage package = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/ManagerPackage.asset", typeof(ManagerPackage)) as ManagerPackage;

            if (package != null)
            {
                package.AssignManagers();
                AdventureCreator.RefreshActions();

                if (!ACInstaller.IsInstalled())
                {
                    ACInstaller.DoInstall();
                }

                if (UnityVersionHandler.GetCurrentSceneName() != "Basement")
                {
                                        #if UNITY_5_3 || UNITY_5_4 || UNITY_5_3_OR_NEWER
                    bool canProceed = EditorUtility.DisplayDialog("Open demo scene", "Would you like to open the 3D Demo scene, Basement, now?", "Yes", "No");
                    if (canProceed)
                    {
                        if (UnityVersionHandler.SaveSceneIfUserWants())
                        {
                            UnityEditor.SceneManagement.EditorSceneManager.OpenScene("Assets/AdventureCreator/Demo/Scenes/Basement.unity");
                        }
                    }
                                        #else
                    ACDebug.Log("3D Demo managers loaded - you can now run the 3D Demo scene in 'Assets/AdventureCreator/Demo/Scenes/Basement.unity'");
                                        #endif
                }

                AdventureCreator.Init();
            }
        }
示例#2
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);
            }
        }
示例#3
0
        private void OnGUI()
        {
            GUILayout.BeginVertical(CustomStyles.thinBox, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();
            GUILayout.Space(20f);

            if (Resource.ACLogo)
            {
                GUI.DrawTexture(new Rect(80, 25, 256, 128), Resource.ACLogo);
                GUILayout.Space(132f);
            }
            else
            {
                GUILayout.Label("Adventure Creator", CustomStyles.managerHeader);
            }

            GUILayout.Label("By Chris Burton, ICEBOX Studios", CustomStyles.managerHeader);

            if (GUILayout.Button("www.adventurecreator.org", CustomStyles.linkCentre))
            {
                Application.OpenURL(Resource.websiteLink);
            }
            GUILayout.Label("<b>v" + AdventureCreator.version + "</b>", CustomStyles.smallCentre);
            GUILayout.Space(12f);

            GUI.enabled = !UpdateChecker.IsChecking();
            if (GUILayout.Button("Check for updates"))
            {
                UpdateChecker.CheckForUpdate();
            }
            GUI.enabled = true;

            if (GUILayout.Button("Documentation"))
            {
                Application.OpenURL(Resource.manualLink);
            }

            if (GUILayout.Button("Tutorials"))
            {
                Application.OpenURL(Resource.tutorialsLink);
            }

            /*if (GUILayout.Button ("Asset Store page"))
             * {
             *      Application.OpenURL (Resource.assetLink);
             * }*/

            if (!ACInstaller.IsInstalled())
            {
                if (GUILayout.Button("Auto-configure Unity project settings"))
                {
                    ACInstaller.DoInstall();
                }
            }
            else
            {
                if (GUILayout.Button("New Game Wizard"))
                {
                    this.Close();
                    NewGameWizardWindow.Init();
                }
            }

            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
示例#4
0
        private void OnGUI()
        {
            GUILayout.BeginVertical(CustomStyles.thinBox, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();

            GUILayout.BeginVertical();
            GUILayout.Space(20f);

            if (Resource.ACLogo)
            {
                GUILayout.Label(Resource.ACLogo);
            }
            else
            {
                GUILayout.Label("Adventure Creator", CustomStyles.managerHeader);
            }

            GUILayout.Label("By Chris Burton, ICEBOX Studios", CustomStyles.managerHeader);

            GUILayout.Label("<b>" + AdventureCreator.version + "</b>", CustomStyles.smallCentre);
            GUILayout.Space(12f);

            if (GUILayout.Button("Documentation"))
            {
                Application.OpenURL(Resource.manualLink);
            }

            if (GUILayout.Button("Website"))
            {
                Application.OpenURL(Resource.websiteLink);
            }

            if (GUILayout.Button("Asset Store page"))
            {
                Application.OpenURL(Resource.assetLink);
            }

            if (!ACInstaller.IsInstalled())
            {
                if (GUILayout.Button("Auto-configure Unity project settings"))
                {
                    ACInstaller.DoInstall();
                }
            }
            else
            {
                if (GUILayout.Button("New Game Wizard"))
                {
                    NewGameWizardWindow.Init();
                }
            }

            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }