using UnityEngine; using UnityEditor; using System; using System.Collections; using System.Collections.Generic; namespace TBTK{ [CustomEditor(typeof(PerkManager))] public class I_PerkManagerEditor : TBEditorInspector { private PerkManager instance; public override void Awake(){ base.Awake(); instance = (PerkManager)target; } public override void OnInspectorGUI(){ Undo.RecordObject(instance, "GameControl"); base.OnInspectorGUI(); EditorGUILayout.Space(); EditorGUIUtility.labelWidth=170; cont=new GUIContent("In Game Scene:", "Check to indicate the PerkManager is intended for in game scene\nIf not it will be treated as a stand alone or pre-game perk screen where the effect won't actually get applied"); instance.inGameScene=EditorGUILayout.Toggle(cont, instance.inGameScene); cont=new GUIContent("Load From Cache On Start:", "Check to load the progress from previous scene\nIf the PerkManager in any scene prior to this has 'Save To Cache On End' checked, the progress made will be carried over"); instance.loadProgressFromCache=EditorGUILayout.Toggle(cont, instance.loadProgressFromCache); cont=new GUIContent("Save To Cache On End:", "Check to cache the progress for coming scene\nIf the PerkManager in the next (or any scene) after this has 'Load From Cache On Start' checked, any progress made in this scene will be carried over"); instance.saveProgressToCache=EditorGUILayout.Toggle(cont, instance.saveProgressToCache); EditorGUILayout.Space(); cont=new GUIContent("Currency:", "The starting value of the currency used to unlock perk"); instance.currency=EditorGUILayout.IntField(cont, instance.currency); EditorGUIUtility.labelWidth=0; EditorGUILayout.Space(); DrawPerkList(); EditorGUILayout.Space(); //DrawDefaultInspector(); GameControl.inspector=DefaultInspector(GameControl.inspector); } private bool showPerkList=true; void DrawPerkList(){ //EditorGUILayout.BeginHorizontal(); //EditorGUILayout.LabelField("", GUILayout.MaxWidth(10)); showPerkList=EditorGUILayout.Foldout(showPerkList, "Show Perk List"); //EditorGUILayout.EndHorizontal(); if(showPerkList){ EditorGUILayout.BeginHorizontal(); if(GUILayout.Button("EnableAll") && !Application.isPlaying){ instance.unavailableIDList.Clear(); } if(GUILayout.Button("DisableAll") && !Application.isPlaying){ instance.unlockedIDList.Clear(); instance.unavailableIDList=PerkDB.GetPrefabIDList(); } EditorGUILayout.EndHorizontal(); for(int i=0; i