Vector2 DrawAbilityConfigurator(float startX, float startY, Ability item) { float maxX = startX; startY = TDE.DrawBasicInfo(startX, startY, item); TDE.Label(startX, startY += spaceY, width, height, "Hide In Inspector:", ""); item.hideInInspector = EditorGUI.Toggle(new Rect(startX + width, startY, width, height), item.hideInInspector); startY = DrawGeneralSetting(startX, startY + 10, item); startY += spaceY * 2; string text = "Ability Stats "; //+(!foldStats ? "(show)" : "(hide)"); foldStats = EditorGUI.Foldout(new Rect(startX, startY, spaceX, height), foldStats, text, TDE.foldoutS); if (foldStats) { int effType = (int)item.effectType; TDE.Label(startX + 12, startY += spaceY, width, height, "Effect Type:", "Indicate what does the ability do"); contL = TDE.SetupContL(effTypeLabel, effTypeTooltip); effType = EditorGUI.Popup(new Rect(startX + spaceX + 12, startY, width, height), new GUIContent(""), effType, contL); item.effectType = (Ability._EffectType)effType; startY += 10; if (item.effectType != Ability._EffectType.Default || item.effectDelay <= 0) { GUI.color = Color.grey; } TDE.Label(startX + 12, startY += spaceY, width, height, "Effect Delay:", "Delay in second before the effects apply to target\n\nFor any visual effect to play out"); item.effectDelay = EditorGUI.FloatField(new Rect(startX + spaceX + 12, startY, widthS, height), item.effectDelay); GUI.color = item.effectType == Ability._EffectType.Default ? Color.white : Color.grey; startY = DrawStats(startX, startY, item.stats, _EType.Ability); GUI.color = Color.white; } else { startY += spaceY; } startY = DrawVisualSetting(startX, startY, item) + spaceY; startY += spaceY; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Unit description (for runtime and editor): ", ""); EditorGUI.LabelField(new Rect(startX, startY, 400, 20), cont); item.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), item.desp, style); return(new Vector2(maxX, startY + 170)); }
Vector2 DrawEffectConfigurator(float startX, float startY, Effect item) { float maxX = startX; startY = TDE.DrawBasicInfo(startX, startY, item); spaceX += 12; TDE.Label(startX, startY += spaceY, width, height, "Stackable:", "Check if the effect can stack if apply on a same unit with repeatably"); item.stackable = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), item.stackable); TDE.Label(startX, startY += spaceY, width, height, "Duration:", "The long the effect will last (in second)"); item.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), item.duration); startY += 10; TDE.Label(startX, startY += spaceY, width, height, "Effect Attributes:", "", TDE.headerS); startX += 12; spaceX -= 12; if (GUI.Button(new Rect(startX + spaceX, startY, widthS * 2, height), "Reset")) { item.Reset(); } TDE.Label(startX, startY += spaceY, width, height, "Stun Target:", "Check if the effect effect will stun its target"); item.stun = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), item.stun); startY += 10; startX -= 12; spaceX -= 12; int type = (int)item.effType; contL = TDE.SetupContL(effTypeLabel, effTypeTooltip); TDE.Label(startX + 12, startY += spaceY, width, height, "Effect Type:", "", TDE.headerS); type = EditorGUI.Popup(new Rect(startX + spaceX + 23, startY, 2 * widthS + 3, height), new GUIContent(""), type, contL); item.effType = (Effect._EffType)type; if (GUI.Button(new Rect(startX + spaceX + 23 + 2 * widthS + 5, startY, widthS * 2 - 12, height), "Reset")) { item.Reset(); } //TDE.Label(startX, startY+=spaceY, width, height, "Multipliers:", "", TDE.headerS); startY = DrawStats(startX, startY += spaceY, item.stats, _EType.Effect); startY += spaceY; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Unit description (for runtime and editor): ", ""); EditorGUI.LabelField(new Rect(startX, startY, 400, height), cont); item.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), item.desp, style); return(new Vector2(maxX, startY + 170)); }
private Vector2 DrawUnitConfigurator(float startX, float startY, UnitTower unit) { startY = TDE.DrawBasicInfo(startX, startY, unit); TDE.Label(startX + 12, startY, width, height, "Hide In Inspector:", "Check to hide the tower in Inspector (It won't be showing up in TowerManager)"); unit.hideInInspector = EditorGUI.Toggle(new Rect(startX + spaceX + 12, startY, width, height), unit.hideInInspector); int type = (int)unit.towerType; cont = new GUIContent("Tower Type:", "Type of the tower. Each type of tower serve a different function"); contL = TDE.SetupContL(towerTypeLabel, towerTypeTooltip); EditorGUI.LabelField(new Rect(startX + 12, startY += spaceY, width, height), cont); type = EditorGUI.Popup(new Rect(startX + spaceX + 12, startY, width, height), new GUIContent(""), type, contL); unit.towerType = (UnitTower._TowerType)type; showTypeDesp = EditorGUI.ToggleLeft(new Rect(startX + spaceX + width + 12, startY, width, 20), "Show Description", showTypeDesp); if (showTypeDesp) { EditorGUI.HelpBox(new Rect(startX, startY += spaceY, width + spaceX, 40), towerTypeTooltip[(int)unit.towerType], MessageType.Info); startY += 45 - height; } cont = new GUIContent("MaxCount In Scene:", "The maximum number of this tower prefab is allowed in any particular scene.\nSet to >0 to take effect"); EditorGUI.LabelField(new Rect(startX + 12, startY += spaceY, width, height), cont); GUI.color = unit.limitInScene > 0 ? Color.white : Color.grey; unit.limitInScene = EditorGUI.IntField(new Rect(startX + spaceX + 12, startY, widthS, height), unit.limitInScene); GUI.color = Color.white; startY = DrawGeneralSetting(startX, startY + 10, unit); if (unit.statsList.Count == 0) { unit.statsList.Add(new Stats()); } startY = DrawTowerStats(startX, startY + spaceY, unit); startY = DrawTowerVisualEffect(startX, startY + spaceY, unit) + spaceY; startY = DrawUnitAnimation(startX, startY, unit) + spaceY; startY += spaceY; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Unit description (for runtime and editor): ", ""); EditorGUI.LabelField(new Rect(startX, startY, 400, 20), cont); unit.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), unit.desp, style); return(new Vector2(maxX, startY + 170)); }
Vector2 DrawPerkConfigurator(float startX, float startY, Perk item) { float maxX = startX; startY = TDE.DrawBasicInfo(startX, startY, item); int type = (int)item.type; contL = TDE.SetupContL(perkTypeLabel, perkTypeTooltip); TDE.Label(startX, startY += spaceY + 5, width, height, "Perk Type:", "Specify what the perk do"); type = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), new GUIContent(""), type, contL); item.type = (_PerkType)type; showTypeDesp = EditorGUI.ToggleLeft(new Rect(startX + spaceX + width + 2, startY, width, 20), "Show Description", showTypeDesp); if (showTypeDesp) { EditorGUI.HelpBox(new Rect(startX, startY += spaceY, width + spaceX, 40), perkTypeTooltip[(int)item.type], MessageType.Info); startY += 45 - height; } startY += 10; startY = DrawBasicSetting(startX, startY, item) + 10; startY = DrawEffectSetting(startX, startY, item); startY += spaceY; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Perk description (for runtime and editor): ", ""); EditorGUI.LabelField(new Rect(startX, startY, 400, 20), cont); item.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), item.desp, style); return(new Vector2(maxX, startY + 170)); }
private Vector2 DrawUnitConfigurator(float startX, float startY, UnitCreep unit) { float maxX = startX; startY = TDE.DrawBasicInfo(startX, startY, unit); int type = (int)unit.creepType; cont = new GUIContent("Creep Type:", "Type of the creep. Each type of creep serve a different function"); contL = TDE.SetupContL(creepTypeLabel, creepTypeTooltip); EditorGUI.LabelField(new Rect(startX + 12, startY, width, height), cont); type = EditorGUI.Popup(new Rect(startX + spaceX + 12, startY, width, height), new GUIContent(""), type, contL); unit.creepType = (UnitCreep._CreepType)type; showTypeDesp = EditorGUI.ToggleLeft(new Rect(startX + spaceX + width + 12, startY, width, 20), "Show Description", showTypeDesp); if (showTypeDesp) { EditorGUI.HelpBox(new Rect(startX, startY += spaceY, width + spaceX, 40), creepTypeTooltip[(int)unit.creepType], MessageType.Info); startY += 45 - height; } startY = DrawGeneralSetting(startX, startY + spaceY + 10, unit); startY = DrawMovementSetting(startX, startY + spaceY, unit); startY += spaceY * 2; _EType cType = _EType.CDefault; if (unit.IsTurret()) { cType = _EType.CTurret; } else if (unit.IsAOE()) { cType = _EType.CAOE; } else if (unit.IsSupport()) { cType = _EType.CSupport; } else if (unit.IsSpawner()) { cType = _EType.CSpawner; } string text = "Unit Stats "; //+ !foldStats ? "(show)" : "(hide)" ; foldStats = EditorGUI.Foldout(new Rect(startX, startY, spaceX, height), foldStats, text, TDE.foldoutS); if (foldStats) { startY = DrawStats(startX, startY + spaceY, unit.statsList[0], cType) - spaceY; if (unit.IsSpawner()) { startX += 12; startY += 10; TDE.Label(startX, startY += spaceY, width, height, "Spawn Prefab:", "Creep prefab to be spawned"); int idx = CreepDB.GetPrefabIndex(unit.spawnerPrefab); idx = EditorGUI.Popup(new Rect(startX + spaceX, startY, width, height), idx, CreepDB.label); unit.spawnerPrefab = CreepDB.GetItem(idx); if (unit.spawnerPrefab == unit) { unit.spawnerPrefab = null; } if (GUI.Button(new Rect(startX + spaceX + width + 10, startY, height, height), "-")) { unit.spawnOnDestroyed = null; } TDE.Label(startX, startY += spaceY, width, height, " - Num to Spawn:", "The amount of SpawnOnDestroyed creep to spawn when this unit is destroyed"); if (unit.spawnerPrefab != null) { unit.spawnerCount = EditorGUI.IntField(new Rect(startX + spaceX, startY, widthS, height), unit.spawnerCount); } else { TDE.Label(startX + spaceX, startY, widthS, height, "-"); } bool valid = unit.spawnerPrefab != null && unit.spawnerCount > 0; startY = DrawSpawnOverride(startX, startY, unit.spawnerOverride, valid, foldSpawnerOverride, SetFoldSpawnerOverride); startX -= 12; } } startY = DrawCreepVisualEffect(startX, startY + spaceY, unit); startY = DrawUnitAnimation(startX, startY + spaceY, unit); startY += spaceY; GUIStyle style = new GUIStyle("TextArea"); style.wordWrap = true; cont = new GUIContent("Unit description (for runtime and editor): ", ""); EditorGUI.LabelField(new Rect(startX, startY += spaceY, 400, 20), cont); unit.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 270, 150), unit.desp, style); return(new Vector2(maxX, startY + 170)); }