public static void Init() { // Get existing open window or if none, make a new one: window = (CollectibleManagerWindow)EditorWindow.GetWindow(typeof (CollectibleManagerWindow)); window.minSize=new Vector2(375, 449); window.maxSize=new Vector2(375, 800); EditorCollectibleList eCollectibleList=LoadCollectible(); prefab=eCollectibleList.prefab; collectibleList=prefab.collectibleList; foreach(CollectibleTB collectible in collectibleList){ collectibleIDList.Add(collectible.prefabID); } }
void LoadCollectible() { EditorCollectibleList eCollectibleList = CollectibleManagerWindow.LoadCollectible(); CollectibleListPrefab prefab = eCollectibleList.prefab; //~ CollectibleListPrefab prefab=CollectibleManagerWindow.LoadCollectible(); collectibleList = new List <CollectibleTB>(); collectibleNameList = new string[prefab.collectibleList.Count]; for (int i = 0; i < prefab.collectibleList.Count; i++) { collectibleList.Add(prefab.collectibleList[i]); collectibleNameList[i] = prefab.collectibleList[i].collectibleName; } }
public static void Init() { // Get existing open window or if none, make a new one: window = (CollectibleEditorWindow)EditorWindow.GetWindow(typeof(CollectibleEditorWindow)); window.minSize = new Vector2(615, 250); window.maxSize = new Vector2(615, 251); EditorCollectibleList eCollectibleList = CollectibleManagerWindow.LoadCollectible(); prefab = eCollectibleList.prefab; collectibleList = prefab.collectibleList; nameList = eCollectibleList.nameList; int enumLength = Enum.GetValues(typeof(_EffectAttrType)).Length; effectTypeLabel = new string[enumLength]; effectTypeTooltip = new string[enumLength]; for (int i = 0; i < enumLength; i++) { effectTypeLabel[i] = ((_EffectAttrType)i).ToString(); } for (int i = 0; i < enumLength; i++) { effectTypeTooltip[i] = ""; } effectTypeTooltip[0] = "Reduce target's HP"; effectTypeTooltip[1] = "Restore target's HP"; effectTypeTooltip[2] = "Reduce target's AP"; effectTypeTooltip[3] = "Restore target's AP"; effectTypeTooltip[4] = "Increase/decrease target's damage"; effectTypeTooltip[5] = "Increase/decrease target's movement range"; effectTypeTooltip[6] = "Increase/decrease target's attack range"; effectTypeTooltip[7] = "Increase/decrease target's speed"; effectTypeTooltip[8] = "Increase/decrease target's attack"; effectTypeTooltip[9] = "Increase/decrease target's defend"; effectTypeTooltip[10] = "Increase/decrease target's critical chance"; effectTypeTooltip[11] = "Increase/decrease target's critical immunity"; effectTypeTooltip[12] = "Increase/decrease target's attack per turn"; effectTypeTooltip[13] = "Increase/decrease target's counter attack limit "; effectTypeTooltip[14] = "Stun target, stop target from doing anything"; effectTypeTooltip[15] = "Prevent target from attack"; effectTypeTooltip[16] = "Prevent target from moving"; effectTypeTooltip[17] = "Prevent target from using ability"; effectTypeTooltip[18] = "Faction gain points"; }
public static void Init() { // Get existing open window or if none, make a new one: window = (CollectibleManagerWindow)EditorWindow.GetWindow(typeof(CollectibleManagerWindow)); window.minSize = new Vector2(375, 449); window.maxSize = new Vector2(375, 800); EditorCollectibleList eCollectibleList = LoadCollectible(); prefab = eCollectibleList.prefab; collectibleList = prefab.collectibleList; foreach (CollectibleTB collectible in collectibleList) { collectibleIDList.Add(collectible.prefabID); } }
void OnGUI() { if (window == null) { Init(); } Rect visibleRect = new Rect(0, 0, window.position.width, window.position.height); Rect contentRect = new Rect(0, 0, window.position.width - 15, contentHeight); scrollPos = GUI.BeginScrollView(visibleRect, scrollPos, contentRect); GUI.changed = false; if (GUI.Button(new Rect(window.position.width - 130, 5, 120, 25), "CollectibleManager")) { this.Close(); CollectibleManagerWindow.Init(); } startX = 3; startY = 3; height = 15; spaceY = 17; if (collectibleList.Count > 0) { GUI.SetNextControlName("CollectibleSelect"); index = EditorGUI.Popup(new Rect(startX, startY, 300, height), "Collectible:", index, nameList); if (GUI.changed) { GUI.FocusControl("CollectibleSelect"); } CollectibleTB collectible = collectibleList[index]; Effect effect = collectible.effect; EditorGUI.LabelField(new Rect(340, startY, 70, height), "Icon: "); collectible.icon = (Texture)EditorGUI.ObjectField(new Rect(380, startY, 70, 70), collectible.icon, typeof(Texture), false); effect.icon = collectible.icon; //~ cont=new GUIContent("PointCost:", "The cost of unit"); //~ unit.pointCost = EditorGUI.IntField(new Rect(startX, startY+=spaceY, 300, height), cont, unit.pointCost); cont = new GUIContent("Name:", "The name for the unit ability"); //~ EditorGUI.LabelField(new Rect(startX, startY+=20, 200, 20), "Name: "); collectible.collectibleName = EditorGUI.TextField(new Rect(startX, startY += spaceY, 300, height), cont, collectible.collectibleName); effect.name = collectible.collectibleName; startY += 7; //~ cont=new GUIContent("Is Buff:", "Check if the collectible gives buff effect, this is merely for GUI purpose"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont); //~ effect.isBuff=EditorGUI.Toggle(new Rect(startX, startY+=spaceY, 300, height), cont, effect.isBuff); cont = new GUIContent("Enable AOE:", "Check if the collectible has an area of effect (affects more than single tile)"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont); collectible.enableAOE = EditorGUI.Toggle(new Rect(startX, startY += spaceY, 300, height), cont, collectible.enableAOE); if (collectible.enableAOE) { cont = new GUIContent("AOE Range:", "The range of aoe in term of tile"); //~ EditorGUI.LabelField(new Rect(startX, startY+=18, 200, 20), cont); collectible.aoeRange = EditorGUI.IntField(new Rect(startX, startY += spaceY, 300, height), cont, collectible.aoeRange); } else { startY += spaceY; } startY += 3; if (GUI.Button(new Rect(startX, startY += spaceY, 100, height), "add effect")) { if (effect.effectAttrs.Count < 4) { effect.effectAttrs.Add(new EffectAttr()); } else { Debug.Log("Cannot have more than 4 effects"); } } for (int i = 0; i < effect.effectAttrs.Count; i++) { EffectAttrConfigurator(effect, i, startX, startY); startX += 135; } startX = 3; //~ startY+=150; //~ EditorGUI.LabelField(new Rect(startX, startY+=5, 300, 25), "Collectible Description (for runtime UI): "); //~ collectible.effect.desp=EditorGUI.TextArea(new Rect(startX, startY+=17, window.position.width-20, 50), collectible.effect.desp); //~ startY+=60; contentHeight = startY; if (GUI.changed) { if (GUI.changed) { EditorUtility.SetDirty(collectible); } if (onCollectibleUpdateE != null) { onCollectibleUpdateE(); } } } else { EditorGUI.LabelField(new Rect(startX, startY, 450, height), "No Collectible has been assigned, please do so in the CollectibleManager"); } GUI.EndScrollView(); }
static void OpenCollectibleManagerWindow() { CollectibleManagerWindow.Init(); }