Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            ManagerPackage _target = (ManagerPackage)target;

            CustomGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Manager asset files", EditorStyles.boldLabel);
            _target.sceneManager     = (SceneManager)EditorGUILayout.ObjectField("Scene manager:", _target.sceneManager, typeof(SceneManager), false);
            _target.settingsManager  = (SettingsManager)EditorGUILayout.ObjectField("Settings manager:", _target.settingsManager, typeof(SettingsManager), false);
            _target.actionsManager   = (ActionsManager)EditorGUILayout.ObjectField("Actions manager:", _target.actionsManager, typeof(ActionsManager), false);
            _target.variablesManager = (VariablesManager)EditorGUILayout.ObjectField("Variables manager:", _target.variablesManager, typeof(VariablesManager), false);
            _target.inventoryManager = (InventoryManager)EditorGUILayout.ObjectField("Inventory manager:", _target.inventoryManager, typeof(InventoryManager), false);
            _target.speechManager    = (SpeechManager)EditorGUILayout.ObjectField("Speech manager:", _target.speechManager, typeof(SpeechManager), false);
            _target.cursorManager    = (CursorManager)EditorGUILayout.ObjectField("Cursor manager:", _target.cursorManager, typeof(CursorManager), false);
            _target.menuManager      = (MenuManager)EditorGUILayout.ObjectField("Menu manager:", _target.menuManager, typeof(MenuManager), false);
            CustomGUILayout.EndVertical();

            EditorGUILayout.Space();

            if (GUILayout.Button("Assign managers"))
            {
                Undo.RecordObject(AdvGame.GetReferences(), "Assign managers");
                _target.AssignManagers();
                AdventureCreator.RefreshActions();
                AdventureCreator.Init();
            }

            EditorUtility.SetDirty(_target);
        }
Exemplo n.º 2
0
        static void Demo3D()
        {
            ManagerPackage package = AssetDatabase.LoadAssetAtPath("Assets/AdventureCreator/Demo/ManagerPackage.asset", typeof(ManagerPackage)) as ManagerPackage;

            package.AssignManagers();
            AdventureCreator.RefreshActions();
        }
Exemplo n.º 3
0
        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();
            }
        }
 public static bool OnOpenAsset(int instanceID, int line)
 {
     if (Selection.activeObject is ManagerPackage)
     {
         ManagerPackage managerPackage = (ManagerPackage)Selection.activeObject as ManagerPackage;
         Undo.RecordObject(AdvGame.GetReferences(), "Assign managers");
         managerPackage.AssignManagers();
         AdventureCreator.RefreshActions();
         return(true);
     }
     return(false);
 }
        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;

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

            AdventureCreator.Init();
        }
Exemplo n.º 6
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);
        }