private void OnGUI() { minSize = new Vector2(350, 350); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUIStyle.none, GUI.skin.verticalScrollbar); EditorGUILayout.LabelField("New Melee Attack", CustomStyles.titles); EditorGUILayout.Space(); attackName = EditorGUILayout.TextField("Attack Name", attackName); EditorGUILayout.Space(); attackDescription = EditorGUILayout.TextField("Attack Description", attackDescription); EditorGUILayout.Space(); baseDamage = EditorGUILayout.FloatField("Base Damage", baseDamage); if (baseDamage < 0) { baseDamage = 0; } EditorGUILayout.Space(); isAreaAttack = EditorGUILayout.Toggle("Is Area Attack?", isAreaAttack); EditorGUILayout.Space(); isMultipleAttack = EditorGUILayout.Toggle("Is Multiple Attack?", isMultipleAttack); if (isMultipleAttack) { EditorGUILayout.Space(); attackQty = EditorGUILayout.IntField("Attacks Quantity", attackQty); if (attackQty < 2) { attackQty = 2; } } else { attackQty = 1; } EditorGUILayout.Space(); levelRequirement = EditorGUILayout.IntField("Level Requirement", levelRequirement); if (levelRequirement < 0) { levelRequirement = 0; } EditorGUILayout.Space(); jobRequirement = (JobsEnum.Jobs)EditorGUILayout.EnumPopup("Job Requirement", jobRequirement); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Color")) { colorList.Add(ColorsEnum.Colors.BLUE); colorIndex.Add(colorList.Count); } if (colorIndex.Count > 0) { if (GUILayout.Button("Remove Color")) { colorList.RemoveAt(colorIndex.Count - 1); colorIndex.RemoveAt(colorIndex.Count - 1); } } EditorGUILayout.EndHorizontal(); foreach (int actualColor in colorIndex) { int index = colorIndex.IndexOf(actualColor); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("color " + actualColor + ":"); colorList[index] = (ColorsEnum.Colors)EditorGUILayout.EnumPopup(colorList[index]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Tag")) { tagList.Add(AttackTagsEnum.Tags.SLASH); tagIndex.Add(tagList.Count); } if (colorIndex.Count > 0) { if (GUILayout.Button("Remove Tag")) { tagList.RemoveAt(tagIndex.Count - 1); tagIndex.RemoveAt(tagIndex.Count - 1); } } EditorGUILayout.EndHorizontal(); foreach (int actualTag in tagIndex) { int index = tagIndex.IndexOf(actualTag); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Tag " + actualTag + ":"); tagList[index] = (AttackTagsEnum.Tags)EditorGUILayout.EnumPopup(tagList[index]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create")) { if (attackName == null) { ShowError("Attack must have a name"); } else { CreateAttack(); } } if (GUILayout.Button("Return")) { AttackWindow.OpenWindow(); Close(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(15); EditorGUILayout.EndScrollView(); }
private void OnGUI() { minSize = new Vector2(350, 350); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUIStyle.none, GUI.skin.verticalScrollbar); EditorGUILayout.LabelField("Edit Melee Attack", CustomStyles.titles); EditorGUILayout.Space(); if (baseAttack != null) { EditorGUILayout.LabelField(baseAttack.attackName, CustomStyles.subtitles); EditorGUILayout.Space(); EditorGUILayout.Space(); baseAttack.attackDescription = EditorGUILayout.TextField("Attack Description", baseAttack.attackDescription); EditorGUILayout.Space(); baseAttack.baseDamage = EditorGUILayout.FloatField("Base Damage", baseAttack.baseDamage); if (baseAttack.baseDamage < 0) { baseAttack.baseDamage = 0; } EditorGUILayout.Space(); baseAttack.isAreaAttack = EditorGUILayout.Toggle("Is Area Attack?", baseAttack.isAreaAttack); EditorGUILayout.Space(); isMultiple = EditorGUILayout.Toggle("Is Multiple Attack?", isMultiple); if (isMultiple) { EditorGUILayout.Space(); baseAttack.attackQty = EditorGUILayout.IntField("Attacks Quantity", baseAttack.attackQty); if (baseAttack.attackQty < 2) { baseAttack.attackQty = 2; } } else { baseAttack.attackQty = 1; } EditorGUILayout.Space(); baseAttack.levelRequirement = EditorGUILayout.IntField("Level Requirement", baseAttack.levelRequirement); if (baseAttack.levelRequirement < 0) { baseAttack.levelRequirement = 0; } EditorGUILayout.Space(); baseAttack.jobsRequirement = (JobsEnum.Jobs)EditorGUILayout.EnumPopup("Job Requirement", baseAttack.jobsRequirement); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Color")) { baseAttack.listOfColors.Add(ColorsEnum.Colors.BLUE); colorIndex.Add(baseAttack.listOfColors.Count); } if (colorIndex.Count > 0) { if (GUILayout.Button("Remove Color")) { baseAttack.listOfColors.RemoveAt(colorIndex.Count - 1); colorIndex.RemoveAt(colorIndex.Count - 1); } } EditorGUILayout.EndHorizontal(); foreach (int actualColor in colorIndex) { int index = colorIndex.IndexOf(actualColor); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("color" + actualColor + ":"); baseAttack.listOfColors[index] = (ColorsEnum.Colors)EditorGUILayout.EnumPopup(baseAttack.listOfColors[index]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Tag")) { baseAttack.listOfTags.Add(AttackTagsEnum.Tags.SLASH); tagIndex.Add(baseAttack.listOfTags.Count); } if (colorIndex.Count > 0) { if (GUILayout.Button("Remove Tag")) { baseAttack.listOfTags.RemoveAt(tagIndex.Count - 1); tagIndex.RemoveAt(tagIndex.Count - 1); } } EditorGUILayout.EndHorizontal(); foreach (int actualTag in tagIndex) { int index = tagIndex.IndexOf(actualTag); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Tag " + actualTag + ":"); baseAttack.listOfTags[index] = (AttackTagsEnum.Tags)EditorGUILayout.EnumPopup(baseAttack.listOfTags[index]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Changes")) { Save(); } if (GUILayout.Button("Cancel")) { AttackWindow.OpenWindow(); Close(); } EditorGUILayout.EndHorizontal(); GUILayout.Space(15); } EditorGUILayout.EndScrollView(); }
private void OnGUI() { minSize = new Vector2(350, 350); scrollPosition = GUILayout.BeginScrollView(scrollPosition, false, true, GUIStyle.none, GUI.skin.verticalScrollbar); EditorGUILayout.LabelField("Edit Combination Attack", CustomStyles.titles); EditorGUILayout.Space(); baseAttack.attackName = EditorGUILayout.TextField("Attack Name", baseAttack.attackName); EditorGUILayout.Space(); baseAttack.attackDescription = EditorGUILayout.TextField("Attack Description", baseAttack.attackDescription); EditorGUILayout.Space(); baseAttack.isBuff = EditorGUILayout.Toggle("Is Buff?", baseAttack.isBuff); EditorGUILayout.Space(); if (!baseAttack.isBuff) { baseAttack.baseDamage = EditorGUILayout.FloatField("Base Damage", baseAttack.baseDamage); if (baseAttack.baseDamage < 0) { baseAttack.baseDamage = 0; } EditorGUILayout.Space(); } isMultipleAttack = EditorGUILayout.Toggle("Is Multiple Attack?", isMultipleAttack); if (isMultipleAttack) { EditorGUILayout.Space(); baseAttack.attackQty = EditorGUILayout.IntField("Attacks Quantity", baseAttack.attackQty); if (baseAttack.attackQty < 2) { baseAttack.attackQty = 2; } } else { baseAttack.attackQty = 1; } EditorGUILayout.Space(); baseAttack.isAreaAttack = EditorGUILayout.Toggle("Is Area Attack?", baseAttack.isAreaAttack); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Add Color")) { baseAttack.listOfColors.Add(ColorsEnum.Colors.BLUE); colorIndex.Add(baseAttack.listOfColors.Count); } if (colorIndex.Count > 0) { if (GUILayout.Button("Remove Color")) { baseAttack.listOfColors.RemoveAt(colorIndex.Count - 1); colorIndex.RemoveAt(colorIndex.Count - 1); } } EditorGUILayout.EndHorizontal(); foreach (int actualColor in colorIndex) { int index = colorIndex.IndexOf(actualColor); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("color" + actualColor + ":"); baseAttack.listOfColors[index] = (ColorsEnum.Colors)EditorGUILayout.EnumPopup(baseAttack.listOfColors[index]); EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); if (baseAttack.combinationOfAttacks.Count == 2) { if (GUILayout.Button("Add Attack")) { attacksIndex.Add(2); baseAttack.combinationOfAttacks.Add(null); } } else { if (baseAttack.combinationOfAttacks.Count == 3) { if (GUILayout.Button("Remove Attack")) { attacksIndex.Remove(2); baseAttack.combinationOfAttacks.RemoveAt(2); } } } foreach (int actualAttack in attacksIndex) { int index = attacksIndex.IndexOf(actualAttack); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Attack" + actualAttack + ":"); baseAttack.combinationOfAttacks[index] = (BaseAttack)EditorGUILayout.ObjectField(baseAttack.combinationOfAttacks[index], typeof(BaseAttack), true);; EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Save Changes")) { foreach (BaseAttack actualAttack in baseAttack.combinationOfAttacks) { if (actualAttack == null) { ShowError("ThereĀ“s a null attack"); OnGUI(); } } Save(); } if (GUILayout.Button("Return")) { AttackWindow.OpenWindow(); Close(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndScrollView(); }