private void CopyBuffDebuffProperty(BuffDebuffProperty prop) { eStat stat = new eStat(); stat = prop.stat; eElement res = new eElement(); res = prop.resistance; MinMaxValue[] values = new MinMaxValue[5]; int[] durations = new int[5]; for (int i = 0; i < 5; i++) { MinMaxValue val = new MinMaxValue(prop.valuePerLevel [i].min, prop.valuePerLevel [i].max); values [i] = val; } for (int i = 0; i < 5; i++) { int val = prop.durationPerLevel [i]; durations [i] = val; } bool isResist = prop.isResistanceModifier; bool resistable = prop.resistable; bool isBuff = prop.isBuff; bool targetCaster = prop.targetCasterOverride; bool affectCaster = prop.affectsCaster; bool allies = prop.affectsAllyPlayers; bool allySummon = prop.affectsAllySummons; bool enemies = prop.affectsEnemyPlayers; bool enemySummon = prop.affectsAllySummons; BuffDebuffProperty newProp = new BuffDebuffProperty(); newProp.isResistanceModifier = isResist; newProp.isBuff = isBuff; newProp.resistable = resistable; newProp.resistance = res; newProp.stat = stat; newProp.valuePerLevel = values; newProp.targetCasterOverride = targetCaster; newProp.affectsCaster = affectCaster; newProp.affectsAllyPlayers = allies; newProp.affectsAllySummons = allySummon; newProp.affectsEnemyPlayers = enemies; newProp.affectsEnemySummons = enemySummon; ability.critBuffDebuffEffects.Add(newProp); }
private void DisplayBuffDebuffLabel(BuffDebuffProperty prop) { string buffType = prop.isBuff ? "Buff:" : "Debuff:"; EditorGUILayout.LabelField(buffType, EditorStyles.boldLabel, GUILayout.MaxWidth(100)); string stat = "Invalid Parameter"; bool valid = false; GUIStyle fontColour = new GUIStyle(); fontColour.fontStyle = FontStyle.Bold; if (!prop.isResistanceModifier) { switch (prop.stat) { case eStat.MAX_AP: stat = " AP"; valid = true; break; case eStat.MAX_MP: stat = " MP"; valid = true; break; case eStat.STR: stat = " Strength"; valid = true; break; case eStat.INT: stat = " Intelligence"; valid = true; break; case eStat.AGI: stat = " Agility"; valid = true; break; case eStat.RES: stat = " Resolve"; valid = true; break; } } else { stat = ToUppercaseStart(prop.resistance.ToString().ToLower()); switch (prop.resistance) { case eElement.FIRE: fontColour.normal.textColor = fire; break; case eElement.EARTH: fontColour.normal.textColor = earth; break; case eElement.AIR: fontColour.normal.textColor = air; break; case eElement.WATER: fontColour.normal.textColor = water; break; } valid = true; stat += " Resistance"; } if (valid) { if (prop.valuePerLevel [showLevel - 1].min != prop.valuePerLevel [showLevel - 1].max) { EditorGUILayout.LabelField(prop.valuePerLevel [showLevel - 1].min + " - " + prop.valuePerLevel [showLevel - 1].max, EditorStyles.boldLabel, GUILayout.MaxWidth(50)); } else { EditorGUILayout.LabelField(prop.valuePerLevel [showLevel - 1].min.ToString(), EditorStyles.boldLabel, GUILayout.MaxWidth(30)); } EditorGUILayout.LabelField(stat, fontColour, GUILayout.MaxWidth(100)); EditorGUILayout.LabelField("at level " + showLevel, GUILayout.MinWidth(60)); } else { fontColour.normal.textColor = Color.red; fontColour.fontStyle = FontStyle.Normal; EditorGUILayout.LabelField("Invalid Parameter", fontColour); } }
void DrawBuffDebuffProperty(BuffDebuffProperty prop, int index, bool crit) { int propID = crit ? critTotal + total : total; EditorGUILayout.BeginVertical("box"); GUILayout.Space(5); EditorGUILayout.BeginHorizontal(); GUILayout.Space(5); DisplayBuffDebuffLabel(prop); if (editEffectIndex == propID) { if (GUILayout.Button("Hide", EditorStyles.miniButtonLeft, GUILayout.Width(60))) { editEffectIndex = int.MaxValue; } } else { if (GUILayout.Button("Show", EditorStyles.miniButtonLeft, GUILayout.Width(60))) { editEffectIndex = propID; } } if (GUILayout.Button("Remove", EditorStyles.miniButtonRight, GUILayout.Width(60))) { if (!crit) { ability.buffDebuffEffects.RemoveAt(index); total--; } else { ability.critBuffDebuffEffects.RemoveAt(index); critTotal--; } return; } GUILayout.Space(5); EditorGUILayout.EndHorizontal(); GUILayout.Space(2); if (editEffectIndex == propID) { if ((prop.stat != eStat.MAX_AP && prop.stat != eStat.MAX_MP) || prop.isResistanceModifier) { prop.resistable = false; } GUILayout.Space(4); EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); if (!prop.isResistanceModifier) { EditorGUILayout.LabelField("Affected Stat:", GUILayout.Width(100)); prop.stat = (eStat)EditorGUILayout.EnumPopup(prop.stat, GUILayout.Width(80), GUILayout.Height(15)); } else { EditorGUILayout.LabelField("Resitance:", GUILayout.Width(100)); prop.resistance = (eElement)EditorGUILayout.EnumPopup(prop.resistance, GUILayout.Width(80), GUILayout.Height(15)); } GUILayout.Space(30); prop.resistable = EditorGUILayout.ToggleLeft("Reistable", prop.resistable, GUILayout.MaxWidth(80)); prop.isBuff = EditorGUILayout.ToggleLeft("Buff", prop.isBuff, GUILayout.MaxWidth(80)); prop.isResistanceModifier = EditorGUILayout.ToggleLeft("Resist Mod", prop.isResistanceModifier, GUILayout.MaxWidth(80)); EditorGUILayout.EndHorizontal(); GUILayout.Space(2); for (int i = 0; i < 5; i++) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(4); EditorGUILayout.LabelField("Level " + (i + 1) + ":", GUILayout.Width(60)); GUILayout.Label("Min Value:"); prop.valuePerLevel[i].min = EditorGUILayout.IntField(prop.valuePerLevel[i].min, GUILayout.Width(40)); GUILayout.Space(40); GUILayout.Label("Max Value:"); prop.valuePerLevel[i].max = EditorGUILayout.IntField(prop.valuePerLevel[i].max, GUILayout.Width(40)); GUILayout.Space(40); GUILayout.Label("Duration:"); prop.durationPerLevel[i] = EditorGUILayout.IntField(prop.durationPerLevel[i], GUILayout.Width(40)); GUILayout.Space(40); EditorGUILayout.EndHorizontal(); } GUILayout.Space(5); } //Affected Units. DrawAffectedUnitsPanel(propID, ref prop.targetCasterOverride, ref prop.affectsCaster, ref prop.affectsAllyPlayers, ref prop.affectsAllySummons, ref prop.affectsEnemyPlayers, ref prop.affectsEnemySummons); EditorGUILayout.EndVertical(); }