Exemple #1
0
        public void InitEditorData(int instanceIndex)
        {
            if (this.GameDesignerEditorProfile == null)
            {
                var GameDesignerEditorProfiles = AssetFinder.SafeAssetFind <GameDesignerEditorProfile>("t:" + typeof(GameDesignerEditorProfile).Name);
                foreach (var GameDesignerEditorProfile in GameDesignerEditorProfiles)
                {
                    if (GameDesignerEditorProfile.GameDesignerProfileInstanceIndex == instanceIndex)
                    {
                        this.GameDesignerEditorProfile = GameDesignerEditorProfile;
                        break;
                    }
                }

                if (this.GameDesignerEditorProfile == null)
                {
                    var CreatedGameDesignerEditorProfile = (GameDesignerEditorProfile)GameDesignerEditorProfile.CreateInstance(typeof(GameDesignerEditorProfile));
                    CreatedGameDesignerEditorProfile.GameDesignerProfileInstanceIndex = instanceIndex;
                    AssetDatabase.CreateAsset(CreatedGameDesignerEditorProfile, GameDesignerProfilePath + "/GameDesignerEditorProfile_" + instanceIndex + ".asset");
                    this.GameDesignerEditorProfile = CreatedGameDesignerEditorProfile;
                }
            }
            if (this.GameDesignerEditorProfile != null)
            {
                if (this.ChoiceTree == null)
                {
                    this.ChoiceTree = new GameDesignerChoiceTree(this.GameDesignerEditorProfile);
                }
            }
        }
Exemple #2
0
 public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
 {
     if (GUILayout.Button("CREATE LEVEL IN EDITOR"))
     {
         GameCreationWizard.InitWithSelected(nameof(PuzzleLevelCreationWizard));
     }
 }
Exemple #3
0
        public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
        {
            this.OnEnabled();
            var rawSelectedObj     = GameDesignerHelper.GetCurrentSceneSelectedObject();
            C   currentSelectedObj = default(C);

            if (rawSelectedObj != null)
            {
                currentSelectedObj = rawSelectedObj.GetComponent <C>();
            }

            if (currentSelectedObj == null)
            {
                this.cachedEditor = null;
            }
            if (currentSelectedObj != null)
            {
                if (currentSelectedObj != this.lastFrameObj)
                {
                    CreateEditor(currentSelectedObj);
                }

                if (GUILayout.Button("REFRESH", GUILayout.Width(50f)))
                {
                    CreateEditor(currentSelectedObj);
                }

                if (this.cachedEditor != null)
                {
                    this.cachedEditor.OnInspectorGUI();
                }
            }
            this.lastFrameObj = currentSelectedObj;
        }
Exemple #4
0
 public virtual void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
 {
     this.currentSelectedObjet = GameDesignerHelper.GetCurrentSceneSelectedObject();
     this.prefabToAdd          = (T)EditorGUILayout.ObjectField(this.prefabToAdd, typeof(T), false);
     EditorGUI.BeginDisabledGroup(!this.IsAbleToAdd());
     if (GUILayout.Button("ADD TO SCENE"))
     {
         if (this.prefabToAdd != null)
         {
             var parent = this.ParentGameObject.Invoke();
             if (parent != null)
             {
                 PrefabUtility.InstantiatePrefab(this.prefabToAdd, this.ParentGameObject.Invoke().transform);
             }
             else
             {
                 Debug.LogError("Parent not found.");
             }
         }
         else
         {
             Debug.LogError("Prefab not set.");
         }
     }
     EditorGUI.EndDisabledGroup();
 }
Exemple #5
0
 public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
 {
     if (GUILayout.Button("CREATE IN EDITOR"))
     {
         GameCreationWizard.InitGenericCreator(typeof(CONFIGURATION));
     }
 }
Exemple #6
0
 public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
 {
     if (GUILayout.Button("CREATE IN EDITOR"))
     {
         // GameCreationWizard.InitGenericCreator(typeof(CREATION_WIZARD));
         GameCreationWizard.InitWithSelected(typeof(CREATION_WIZARD).Name);
     }
 }
Exemple #7
0
 public virtual void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
 {
     this.currentSelectedObjet = GameDesignerHelper.GetCurrentSceneSelectedObject();
     EditorGUI.BeginDisabledGroup(this.IsDisabled());
     if (GUILayout.Button("EDIT"))
     {
         this.OnEdit(this.currentSelectedObjet.GetComponent <T>());
         EditorUtility.SetDirty(this.currentSelectedObjet);
     }
     EditorGUI.EndDisabledGroup();
 }
Exemple #8
0
        public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
        {
            var currentSelectedObj = GameDesignerHelper.GetCurrentSceneSelectedObject();

            this.ModelObject = (GameObject)EditorGUILayout.ObjectField("New Model : ", this.ModelObject, typeof(GameObject), false);

            EditorGUI.BeginDisabledGroup(this.ModelObject == null || currentSelectedObj == null || currentSelectedObj.GetComponent <T>() == null);
            if (GUILayout.Button("SET MODEL"))
            {
                this.OnClick(currentSelectedObj);
            }
            EditorGUI.EndDisabledGroup();
        }
Exemple #9
0
        public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
        {
            var obj = Selection.activeObject as GameObject;

            if (obj != null && obj.scene == null)
            {
                obj = null;
            }

            EditorGUILayout.ObjectField(obj, typeof(Object), false);
            if (GUILayout.Button("SET GROUND EFFECT"))
            {
                if (obj != null)
                {
                    if (obj.GetComponent <GroundEffectType>() == null)
                    {
                        obj.AddComponent <GroundEffectType>();
                    }

                    obj.layer = LayerMask.NameToLayer(LayerConstants.PUZZLE_GROUND_LAYER);
                }
            }
        }
Exemple #10
0
        public void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile)
        {
            if (CommonGameConfigurations == null)
            {
                CommonGameConfigurations = new CommonGameConfigurations();
                EditorInformationsHelper.InitProperties(ref CommonGameConfigurations);
            }

            if (this.GameDesignerEditorProfile == null)
            {
                this.GameDesignerEditorProfile = GameDesignerEditorProfile;
            }

            if (GameDesignerEditorProfileSO == null)
            {
                GameDesignerEditorProfileSO = new SerializedObject(this.GameDesignerEditorProfile);
            }

            currentSelectedObjet = GameDesignerHelper.GetCurrentSceneSelectedObject();
            selectedModuleIndex  = EditorGUILayout.Popup(selectedModuleIndex, AvailableModules.ConvertAll(t => t.Name).ToArray());
            EditorGUILayout.HelpBox(POIModuleDescription(AvailableModules[selectedModuleIndex]), MessageType.None);

            T selectedPointOfIterestType = null;

            if (currentSelectedObjet != null)
            {
                selectedPointOfIterestType = currentSelectedObjet.GetComponent <T>();
            }

            var additionalEditAllowed = AdditionalEditCondition(AvailableModules[selectedModuleIndex]);

            EditorGUILayout.BeginHorizontal();
            var newAdd    = GUILayout.Toggle(add, "ADD", EditorStyles.miniButtonLeft);
            var newRemove = GUILayout.Toggle(remove, "REMOVE", EditorStyles.miniButtonRight);

            if (newAdd && newRemove)
            {
                if (add && !remove)
                {
                    add    = false;
                    remove = true;
                }
                else if (!add && remove)
                {
                    add    = true;
                    remove = false;
                }
                else
                {
                    add    = newAdd;
                    remove = newRemove;
                }
            }
            else
            {
                add    = newAdd;
                remove = newRemove;
            }

            EditorGUILayout.EndHorizontal();


            EditorGUI.BeginDisabledGroup(IsDisabled() || !additionalEditAllowed);
            if (GUILayout.Button("EDIT"))
            {
                OnEnabled();
                OnEdit(selectedPointOfIterestType, AvailableModules[selectedModuleIndex]);
                EditorUtility.SetDirty(currentSelectedObjet);
            }

            EditorGUI.EndDisabledGroup();

            if (currentSelectedObjet != null && selectedPointOfIterestType != null)
            {
                DoModuleListing(selectedPointOfIterestType);
            }

            GameDesignerEditorProfileSO.ApplyModifiedProperties();
            GameDesignerEditorProfileSO.Update();
        }
Exemple #11
0
 public abstract void GUITick(ref GameDesignerEditorProfile GameDesignerEditorProfile);
Exemple #12
0
 public GameDesignerChoiceTree(GameDesignerEditorProfile gameDesignerEditorProfileRef)
 {
     GameDesignerEditorProfileRef = gameDesignerEditorProfileRef;
 }