public static void Attributes(Rect fullArea, Rect leftArea, Rect mainArea) { var list = Rm_RPGHandler.Instance.ASVT.AttributesDefinitions; GUI.Box(leftArea, "", "backgroundBox"); GUI.Box(mainArea, "", "backgroundBoxMain"); GUILayout.BeginArea(PadRect(leftArea, 2, 2)); RPGMakerGUI.ListArea(list, ref selectedAttrInfo, Rm_ListAreaType.Attributes, false, true); GUILayout.EndArea(); GUILayout.BeginArea(mainArea); RPGMakerGUI.Title("Attributes"); if (selectedAttrInfo != null) { GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); selectedAttrInfo.Name = RPGMakerGUI.TextField("Name: ", selectedAttrInfo.Name); selectedAttrInfo.Description = RPGMakerGUI.TextField("Description: ", selectedAttrInfo.Description); selectedAttrInfo.DefaultValue = RPGMakerGUI.IntField("Default Value: ", selectedAttrInfo.DefaultValue); selectedAttrInfo.Color = (Rm_UnityColors)RPGMakerGUI.EnumPopup("Color: ", selectedAttrInfo.Color); if (RPGMakerGUI.Toggle("Has Max Value?", ref selectedAttrInfo.HasMaxValue)) { selectedAttrInfo.MaxValue = RPGMakerGUI.IntField("Max Value: ", selectedAttrInfo.MaxValue, 1); } selectedAttrInfo.Image = RPGMakerGUI.ImageSelector("Image:", selectedAttrInfo.Image, ref selectedAttrInfo.ImagePath, true); GUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("Add or select a new field to customise attributes.", MessageType.Info); } GUILayout.EndArea(); }
public static void CustomVariables(Rect fullArea, Rect leftArea, Rect mainArea) { var list = Rm_RPGHandler.Instance.DefinedVariables.Vars; GUI.Box(leftArea, "", "backgroundBox"); GUI.Box(mainArea, "", "backgroundBoxMain"); GUILayout.BeginArea(PadRect(leftArea, 0, 0)); RPGMakerGUI.ListArea(list, ref selectedInfo, Rm_ListAreaType.CustomVaraibles, false, false); GUILayout.EndArea(); GUILayout.BeginArea(mainArea); RPGMakerGUI.Title("Defined Variables"); if (selectedInfo != null) { selectedInfo.Name = RPGMakerGUI.TextField("Name: ", selectedInfo.Name); var prevSelIndex = selectedInfo.VariableType; selectedInfo.VariableType = (Rmh_CustomVariableType)RPGMakerGUI.EnumPopup("Type:", selectedInfo.VariableType); if (prevSelIndex != selectedInfo.VariableType) { GUI.FocusControl(""); } switch (selectedInfo.VariableType) { case Rmh_CustomVariableType.Float: selectedInfo.FloatValue = RPGMakerGUI.FloatField("Default Value:", selectedInfo.FloatValue); break; case Rmh_CustomVariableType.Int: selectedInfo.IntValue = RPGMakerGUI.IntField("Default Value:", selectedInfo.IntValue); break; case Rmh_CustomVariableType.String: selectedInfo.StringValue = RPGMakerGUI.TextField("Default Value:", selectedInfo.StringValue); break; case Rmh_CustomVariableType.Bool: selectedBooleanResult = selectedInfo.BoolValue ? 0 : 1; selectedBooleanResult = RPGMakerGUI.Popup("Default Value:", selectedBooleanResult, new[] { "True", "False" }); selectedInfo.BoolValue = selectedBooleanResult == 0; break; default: throw new ArgumentOutOfRangeException(); } } else { RPGMakerGUI.Title("Add or select a new field to customise credits."); } GUILayout.EndArea(); }
public static void Traits(Rect fullArea, Rect leftArea, Rect mainArea) { var list = Rm_RPGHandler.Instance.ASVT.TraitDefinitions; GUI.Box(leftArea, "", "backgroundBox"); GUI.Box(mainArea, "", "backgroundBoxMain"); GUILayout.BeginArea(PadRect(leftArea, 0, 0)); RPGMakerGUI.ListArea(list, ref selectedTraitInfo, Rm_ListAreaType.Traits, false, false); GUILayout.EndArea(); GUILayout.BeginArea(mainArea); RPGMakerGUI.Title("Traits"); if (selectedTraitInfo != null) { GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); selectedTraitInfo.Name = RPGMakerGUI.TextField("Name: ", selectedTraitInfo.Name); selectedTraitInfo.Description = RPGMakerGUI.TextArea("Description: ", selectedTraitInfo.Description); RPGMakerGUI.PopupID <ExpDefinition>("Exp Definition:", ref selectedTraitInfo.ExpDefinitionID, "ID", "Name", "Trait"); selectedTraitInfo.StartingLevel = RPGMakerGUI.IntField("Starting Level: ", selectedTraitInfo.StartingLevel); selectedTraitInfo.Color = (Rm_UnityColors)RPGMakerGUI.EnumPopup("Color: ", selectedTraitInfo.Color); selectedTraitInfo.Image = RPGMakerGUI.ImageSelector("Image:", selectedTraitInfo.Image, ref selectedTraitInfo.ImagePath, true); GUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("Add or select a new field to customise traits.", MessageType.Info); EditorGUILayout.HelpBox("What is a trait? A trait is a stat that has a Level with exp to level." + "\nExample use: Sword Mastery (Exp gained with Combat Node check that current" + " weapon is of type Sword)", MessageType.Info); } GUILayout.EndArea(); }
private void OnGUIx() { GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin; GUILayout.BeginVertical(); GUILayout.BeginHorizontal(); GUILayout.Space(1); GUILayout.Label("Prefab Browser", "mainTitle", GUILayout.Height(40)); GUILayout.Space(1); GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.BeginHorizontal(); GUILayout.Space(2); #region "Categories" GUILayout.BeginVertical("backgroundBox", GUILayout.Width(180), GUILayout.ExpandHeight(true)); GUILayout.Label("Categories"); var categories = Enum.GetNames(typeof(Rmh_PrefabType)); var ifShowAll = showAll ? "listItemSelected" : "listItem"; if (GUILayout.Button("All", ifShowAll, GUILayout.Height(25))) { showAll = true; return; } foreach (var cat in categories) { var ifSelected = selectedCategory.ToString() == cat && !showAll ? "listItemSelected" : "listItem"; if (GUILayout.Button(cat.Replace('_', ' '), ifSelected, GUILayout.Height(25))) { selectedCategory = (Rmh_PrefabType)Enum.Parse(typeof(Rmh_PrefabType), cat); showAll = false; return; } } GUILayout.EndVertical(); #endregion GUILayout.Space(2); #region "MainArea" GUILayout.BeginVertical("backgroundBoxMain"); GUILayout.BeginHorizontal(); GUILayout.Label("Filter:", GUILayout.Width(35)); GUI.SetNextControlName("searchTerm"); _searchTerm = GUILayout.TextField(_searchTerm, "nodeTextField", GUILayout.Width(200)); GUILayout.Space(1); if (!showAll && !new [] { Rmh_PrefabType.Enemy, Rmh_PrefabType.NPC, Rmh_PrefabType.Harvest }.Any(c => c == selectedCategory)) { if (GUILayout.Button("+ Create New", "genericButton", GUILayout.Height(25))) { if (selectedCategory == Rmh_PrefabType.Skill) { Rme_PrefabGenerator.GeneratePrefab(selectedCategory, selectedSkillType); } else { Rme_PrefabGenerator.GeneratePrefab(selectedCategory); } UpdatePrefabs(); } if (selectedCategory == Rmh_PrefabType.Skill) { selectedSkillType = (SkillType)RPGMakerGUI.EnumPopup("Skill Type:", selectedSkillType); } } else if (!showAll) { if (GUILayout.Button("+ Create New In RPGMaker", "genericButton", GUILayout.Height(25))) { Rme_Main.Init(); } } GUILayout.EndHorizontal(); if (Event.current.type == EventType.Repaint) { if (GUI.GetNameOfFocusedControl() == "searchTerm" && _searchTerm == _searchTermPlaceholder) { _searchTerm = ""; } } List <PrefabInfo> objectsFiltered = objects; if (_searchTerm != _searchTermPlaceholder) { if (showAll) { objectsFiltered = objects.Where(o => o.Identifier != null && ((o.Identifier.SearchName.ToLower().Contains(_searchTerm.ToLower()) || o.Identifier.PrefabType.ToString().ToLower().Contains(_searchTerm.ToLower()))) ).ToList(); } else { objectsFiltered = objects.Where(o => o.Identifier != null && ((o.Identifier.SearchName.ToLower().Contains(_searchTerm.ToLower()) || o.Identifier.PrefabType.ToString().ToLower().Contains(_searchTerm.ToLower())) && o.Identifier.PrefabType == selectedCategory) ).ToList(); } } content = objectsFiltered.Select(s => new GUIContent(s.Identifier.SearchName + (showTriangles ? s.Details : ""), s.Preview)).ToArray(); scrollPos = GUILayout.BeginScrollView(scrollPos); selectedObjectIndex = GUILayout.SelectionGrid(selectedObjectIndex, content, Window.position.width > 520 ? (int)((Window.position.width - 520) / 120).RoundToNearest(1) : 1, "prefabWindowGrid"); if (selectedObjectIndex > content.Length - 1) { selectedObjectIndex = 0; } var oldSelectedObject = selectedObject; selectedObject = selectedObjectIndex != -1 && objectsFiltered.Count > 0 ? objectsFiltered[selectedObjectIndex] : null; if (selectedObject != oldSelectedObject) { GUI.FocusControl(""); } GUILayout.EndScrollView(); GUILayout.EndVertical(); #endregion GUILayout.Space(2); #region "Properties" GUILayout.BeginVertical("backgroundBox", GUILayout.Width(200), GUILayout.ExpandHeight(false)); GUILayout.Space(5); GUILayout.BeginHorizontal(); GUILayout.Space(5); GUILayout.BeginVertical(); GUILayout.Label("Properties"); if (selectedObject != null) { if (selectedObject.Identifier != null) { EditorGUILayout.PrefixLabel("Name:"); selectedObject.Identifier.SearchName = EditorGUILayout.TextField(selectedObject.Identifier.SearchName); EditorGUILayout.PrefixLabel("Type:"); selectedObject.Identifier.PrefabType = (Rmh_PrefabType)EditorGUILayout.EnumPopup(selectedObject.Identifier.PrefabType); EditorGUILayout.LabelField(selectedObject.Identifier.PrefabType.ToString()); if (GUILayout.Button("Spawn To Scene", "genericButton", GUILayout.Height(25))) { var obj = AssetDatabase.LoadAssetAtPath <GameObject>(selectedObject.Path); GeneralMethodsEditor.InstantiateInView(obj); } if (GUILayout.Button("Select in Project Folder", "genericButton", GUILayout.Height(25))) { var obj = AssetDatabase.LoadAssetAtPath <GameObject>(selectedObject.Path); Selection.activeObject = obj; Selection.activeGameObject = obj; } } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.FlexibleSpace(); GUILayout.EndVertical(); #endregion GUILayout.Space(2); GUILayout.EndHorizontal(); GUILayout.Space(2); GUILayout.BeginHorizontal("backgroundBox", GUILayout.Height(30)); GUILayout.Space(5); if (GUILayout.Button("Reload Prefabs", "genericButton", GUILayout.Height(25))) { objects = new List <PrefabInfo>(); UpdatePrefabs(); return; } if (GUILayout.Button("Toggle Tri. Count", "genericButton", GUILayout.Height(25))) { showTriangles = !showTriangles; } GUILayout.FlexibleSpace(); GUILayout.Label(objectsFiltered.Count + " Items", GUILayout.Width(120)); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
public static void Vitals(Rect fullArea, Rect leftArea, Rect mainArea) { var list = Rm_RPGHandler.Instance.ASVT.VitalDefinitions; GUI.Box(leftArea, "", "backgroundBox"); GUI.Box(mainArea, "", "backgroundBoxMain"); GUILayout.BeginArea(PadRect(leftArea, 0, 0)); RPGMakerGUI.ListArea(list, ref selectedVitalInfo, Rm_ListAreaType.Vitals, false, true); GUILayout.EndArea(); GUILayout.BeginArea(mainArea); RPGMakerGUI.Title("Vitals"); if (selectedVitalInfo != null) { GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); selectedVitalInfo.Name = RPGMakerGUI.TextField("Name: ", selectedVitalInfo.Name); selectedVitalInfo.Description = RPGMakerGUI.TextField("Description: ", selectedVitalInfo.Description); selectedVitalInfo.DefaultValue = RPGMakerGUI.IntField("Default Value: ", selectedVitalInfo.DefaultValue); selectedVitalInfo.Color = (Rm_UnityColors)RPGMakerGUI.EnumPopup("Color: ", selectedVitalInfo.Color); GUI.enabled = !selectedVitalInfo.IsHealth; var oldHealth = selectedVitalInfo.IsHealth; selectedVitalInfo.IsHealth = RPGMakerGUI.Toggle("Is Health Vital? ", selectedVitalInfo.IsHealth); GUI.enabled = true; if (oldHealth != selectedVitalInfo.IsHealth) { ASVT.VitalDefinitions.Where(v => v.IsHealth && v.ID != selectedVitalInfo.ID).ToList() .ForEach(vit => vit.IsHealth = false); } selectedVitalInfo.HasUpperLimit = RPGMakerGUI.Toggle("Has Max Value?", selectedVitalInfo.HasUpperLimit); if (selectedVitalInfo.HasUpperLimit) { selectedVitalInfo.UpperLimit = RPGMakerGUI.IntField("Max Value?", selectedVitalInfo.UpperLimit); } if (!selectedVitalInfo.IsHealth) { RPGMakerGUI.Toggle("Always Starts At Zero?", ref selectedVitalInfo.AlwaysStartsAtZero); } else { selectedVitalInfo.AlwaysStartsAtZero = false; } selectedVitalInfo.BaseRegenPercentValue = RPGMakerGUI.FloatField("Base Regen Percent:", selectedVitalInfo.BaseRegenPercentValue); RPGMakerGUI.Toggle("Also Regen While In Combat?", ref selectedVitalInfo.RegenWhileInCombat); /* * public bool ReduceHealthIfZero; * public float ReductionIntervalSeconds; * public bool ReduceByFixedAmount; * public int ReductionFixedAmount; * public float ReductionPercentageAmount;*/ if (!selectedVitalInfo.IsHealth && RPGMakerGUI.Toggle("Reduce Health Vital At Zero?", ref selectedVitalInfo.ReduceHealthIfZero)) { selectedVitalInfo.ReductionIntervalSeconds = RPGMakerGUI.FloatField("Reduce every X seconds:", selectedVitalInfo.ReductionIntervalSeconds, 1); if (RPGMakerGUI.Toggle("Reduce By Fixed Amount?", 1, ref selectedVitalInfo.ReduceByFixedAmount)) { selectedVitalInfo.ReductionFixedAmount = RPGMakerGUI.IntField("Reduce by X:", selectedVitalInfo.ReductionFixedAmount, 1); } else { GUILayout.BeginHorizontal(); selectedVitalInfo.ReductionPercentageAmount = RPGMakerGUI.FloatField("Reduce by X percent of Max HP:", selectedVitalInfo.ReductionPercentageAmount, 1); RPGMakerGUI.Label(selectedVitalInfo.ReductionPercentageAmount.ToString("#0.##%")); GUILayout.EndHorizontal(); } } selectedVitalInfo.Image = RPGMakerGUI.ImageSelector("Image:", selectedVitalInfo.Image, ref selectedVitalInfo.ImagePath, true); GUILayout.EndVertical(); } else { EditorGUILayout.HelpBox("Add or select a new field to customise vitals.", MessageType.Info); } GUILayout.EndArea(); }
private static QuestCondition ShowConditionInfo(QuestCondition condition) { var oldtype = condition.ConditionType; condition.ConditionType = (ConditionType)RPGMakerGUI.EnumPopup("Condition Type:", condition.ConditionType); if (condition.ConditionType != oldtype) { //TODO: if no longer interact node tree than delete that node tree switch (condition.ConditionType) { case ConditionType.Kill: condition = new KillCondition(); break; case ConditionType.Item: condition = new ItemCondition(); break; case ConditionType.Interact: condition = new InteractCondition(); break; case ConditionType.Deliver: condition = new DeliverCondition(); break; case ConditionType.Custom: condition = new CustomCondition(); break; default: throw new ArgumentOutOfRangeException(); } } var killCondition = condition as KillCondition; var itemCondition = condition as ItemCondition; var interactCondition = condition as InteractCondition; var deliverCondition = condition as DeliverCondition; var customCondition = condition as CustomCondition; if (killCondition != null) { if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs) { RPGMakerGUI.Toggle("Is NPC?", ref killCondition.IsNPC); } else { killCondition.IsNPC = false; } if (killCondition.IsNPC) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to Kill:", ref killCondition.CombatantID); } else { RPGMakerGUI.PopupID <CombatCharacter>("Enemy to Kill:", ref killCondition.CombatantID); } killCondition.NumberToKill = RPGMakerGUI.IntField("Number To Kill:", killCondition.NumberToKill); } if (itemCondition != null) { itemCondition.ItemType = (ItemConditionType)RPGMakerGUI.EnumPopup("Required Item Type:", itemCondition.ItemType); if (itemCondition.ItemType == ItemConditionType.CraftItem) { RPGMakerGUI.PopupID <Item>("CraftItem To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Craft"); } else if (itemCondition.ItemType == ItemConditionType.QuestItem) { RPGMakerGUI.PopupID <Item>("Quest Item To Collect:", ref itemCondition.ItemToCollectID, "ID", "Name", "Quest"); if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && Rm_RPGHandler.Instance.Combat.CanAttackNPcs) { RPGMakerGUI.Toggle("NPC Drops Items?", ref itemCondition.NPCDropsItem); } else { itemCondition.NPCDropsItem = false; } if (itemCondition.NPCDropsItem) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC that Drops Item:", ref itemCondition.CombatantIDThatDropsItem); } else { RPGMakerGUI.PopupID <CombatCharacter>("Enemy that Drops Item:", ref itemCondition.CombatantIDThatDropsItem); } } else if (itemCondition.ItemType == ItemConditionType.Item) { RPGMakerGUI.PopupID <Item>("Item To Collect:", ref itemCondition.ItemToCollectID); } itemCondition.NumberToObtain = RPGMakerGUI.IntField("Number To Obtain:", itemCondition.NumberToObtain); } if (interactCondition != null) { if (RPGMakerGUI.Toggle("Talk to NPC?", ref interactCondition.IsNpc)) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to talk to:", ref interactCondition.InteractableID); } else { RPGMakerGUI.PopupID <Interactable>("Object to interact with:", ref interactCondition.InteractableID); } if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == interactCondition.InteractionNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); Debug.Log("ExistingTree null? " + existingTree == null); existingTree.ID = interactCondition.ID; Debug.Log(existingTree.ID + ":::" + existingTree.Name); var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest; //todo: need unique name existingTree.Name = curSelectedQuest.Name + "Interact"; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(interactCondition.ID); interactCondition.InteractionNodeTreeID = existingTree.ID; } } if (deliverCondition != null) { RPGMakerGUI.PopupID <Item>("Quest Item To Deliver:", ref deliverCondition.ItemToDeliverID, "ID", "Name", "Quest"); if (RPGMakerGUI.Toggle("Deliver to NPC?", ref deliverCondition.DeliverToNPC)) { RPGMakerGUI.PopupID <NonPlayerCharacter>("NPC to deliver to:", ref deliverCondition.InteractableToDeliverToID); } else { RPGMakerGUI.PopupID <Interactable>("Object to deliver with:", ref deliverCondition.InteractableToDeliverToID); } if (GUILayout.Button("Open Interaction On Deliver", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == deliverCondition.InteractionNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); existingTree.ID = deliverCondition.ID; //todo: need unique name var curSelectedQuest = Rme_Main.Window.CurrentPageIndex == 1 ? selectedQuestChainQuest : selectedQuest; existingTree.Name = curSelectedQuest.Name + "Interact"; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(deliverCondition.ID); deliverCondition.InteractionNodeTreeID = existingTree.ID; } } if (customCondition != null) { var customVar = customCondition.CustomVariableRequirement; RPGMakerGUI.PopupID <Rmh_CustomVariable>("Custom Variable:", ref customVar.VariableID); var foundCvar = Rm_RPGHandler.Instance.DefinedVariables.Vars.FirstOrDefault(v => v.ID == customCondition.CustomVariableRequirement.VariableID); if (foundCvar != null) { switch (foundCvar.VariableType) { case Rmh_CustomVariableType.Float: customVar.FloatValue = RPGMakerGUI.FloatField("Required Value:", customVar.FloatValue); break; case Rmh_CustomVariableType.Int: customVar.IntValue = RPGMakerGUI.IntField("Required Value:", customVar.IntValue); break; case Rmh_CustomVariableType.String: customVar.StringValue = RPGMakerGUI.TextField("Required Value:", customVar.StringValue); break; case Rmh_CustomVariableType.Bool: selectedVarSetterBoolResult = customVar.BoolValue ? 0 : 1; selectedVarSetterBoolResult = EditorGUILayout.Popup("Required Value:", selectedVarSetterBoolResult, new[] { "True", "False" }); customVar.BoolValue = selectedVarSetterBoolResult == 0; break; default: throw new ArgumentOutOfRangeException(); } } } if (condition.ConditionType != ConditionType.Custom) { RPGMakerGUI.Toggle("Use Custom Tracking Text:", ref condition.UseCustomText); } else { condition.UseCustomText = true; } if (condition.UseCustomText) { condition.CustomText = RPGMakerGUI.TextField("Custom Incomplete Text:", condition.CustomText); condition.CustomCompletedText = RPGMakerGUI.TextField("Custom Completed Text:", condition.CustomCompletedText); } GUILayout.Space(5); return(condition); }
private static void QuestDetails(Quest quest, bool inQuestChain) { if (RPGMakerGUI.Foldout(ref showSelectedQuestDetails, "Selected Quest - Main Details")) { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(GUILayout.MaxWidth(85)); quest.Image.Image = RPGMakerGUI.ImageSelector("", quest.Image.Image, ref quest.Image.ImagePath); GUILayout.EndVertical(); GUILayout.BeginVertical(GUILayout.ExpandWidth(true)); quest.Name = RPGMakerGUI.TextField("Name: ", quest.Name); quest.Description = RPGMakerGUI.TextArea("Description:", quest.Description); quest.ConditionMode = (QuestConditionMode)RPGMakerGUI.EnumPopup("Condition Mode:", quest.ConditionMode); if (GUILayout.Button("Open Dialog/Event On Accept", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == quest.DialogNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); existingTree.ID = quest.ID; existingTree.Name = quest.Name; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(quest.ID); quest.DialogNodeTreeID = existingTree.ID; } if (GUILayout.Button("Open Dialog/Event On Complete", "genericButton", GUILayout.MaxHeight(30))) { var trees = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees; var existingTree = trees.FirstOrDefault(t => t.ID == quest.CompletedDialogNodeTreeID); if (existingTree == null) { existingTree = NodeWindow.GetNewTree(NodeTreeType.Dialog); existingTree.ID = "complete_" + quest.ID; existingTree.Name = "Completed " + quest.Name; trees.Add(existingTree); } DialogNodeWindow.ShowWindow(existingTree.ID); quest.CompletedDialogNodeTreeID = existingTree.ID; } GUILayout.Space(5); RPGMakerGUI.Toggle("Player Keeps Quest Items?", ref quest.PlayerKeepsQuestItems); RPGMakerGUI.Toggle("Is Repeatable?", ref quest.Repeatable); RPGMakerGUI.Toggle("Can Abandon?", ref quest.CanAbandon); if (RPGMakerGUI.Toggle("Has Time Limit?", ref quest.HasTimeLimit)) { quest.TimeLimit = RPGMakerGUI.FloatField("- Time Limit:", quest.TimeLimit); } if (RPGMakerGUI.Toggle("Run Event On Accept?", ref quest.RunEventOnAccept)) { RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnAcceptID); } if (RPGMakerGUI.Toggle("Run Event On Completion?", ref quest.RunEventOnComplete)) { RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnCompletionId); } if (RPGMakerGUI.Toggle("Run Event On Cancel?", ref quest.RunEventOnCancel)) { RPGMakerGUI.PopupID <NodeChain>("- Event:", ref quest.EventOnCancelId); } GUILayout.Space(5); GUILayout.EndVertical(); GUILayout.EndHorizontal(); RPGMakerGUI.EndFoldout(); } if (RPGMakerGUI.Foldout(ref showSelectedQuestReq, "Requirements")) { List <Quest> availableReqQuests = new List <Quest>(); if (inQuestChain) { availableReqQuests = Rm_RPGHandler.Instance.Repositories.Quests.AllQuests.Where(q => selectedQuestChain.QuestsInChain.FirstOrDefault(qu => qu.ID == q.ID) == null).ToList(); } else { availableReqQuests = Rm_RPGHandler.Instance.Repositories.Quests.AllQuests; } RPGMakerGUI.FoldoutList(ref showReqAcceptedQuests, "Required Completed Quests", quest.Requirements.QuestCompletedIDs, availableReqQuests, "+Quest", "", "Click +Quest to add a requirement for a completed quest."); RPGMakerGUI.FoldoutList(ref showCustomVarReqSetters, "Custom Var Requirements", quest.Requirements.CustomRequirements, Rm_RPGHandler.Instance.DefinedVariables.Vars, "+VariableReq", "", "Click +VariableReq to add a varaible requirement", "VariableID", "Name", "ID", "Name", false, "Value"); RPGMakerGUI.SubTitle("More Requirements"); if (RPGMakerGUI.Toggle("Require Player Level:", ref quest.Requirements.RequireLevel)) { quest.Requirements.LevelRequired = RPGMakerGUI.IntField("- Required Level:", quest.Requirements.LevelRequired); } if (RPGMakerGUI.Toggle("Require Player Class:", ref quest.Requirements.RequireClass)) { RPGMakerGUI.PopupID <Rm_ClassNameDefinition>("- Class ID:", ref quest.Requirements.RequiredClassID); } RPGMakerGUI.Toggle("Require Reputation Above Amount :", ref quest.Requirements.ReqRepAboveValue); if (quest.Requirements.ReqRepAboveValue) { quest.Requirements.ReqRepBelowValue = false; } RPGMakerGUI.Toggle("Require Reputation Below Amount :", ref quest.Requirements.ReqRepBelowValue); if (quest.Requirements.ReqRepBelowValue) { quest.Requirements.ReqRepAboveValue = false; } if (quest.Requirements.ReqRepAboveValue || quest.Requirements.ReqRepBelowValue) { RPGMakerGUI.PopupID <ReputationDefinition>("- Reputation Faction:", ref quest.Requirements.ReputationFactionID); var prefix = quest.Requirements.ReqRepAboveValue ? "Above " : "Below "; quest.Requirements.ReputationValue = RPGMakerGUI.IntField("- " + prefix + "Amount:", quest.Requirements.ReputationValue); } if (RPGMakerGUI.Toggle("Require Trait Level?", ref quest.Requirements.RequireTraitLevel)) { RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait:", ref quest.Requirements.RequiredTraitID); quest.Requirements.TraitLevel = RPGMakerGUI.IntField("- Level:", quest.Requirements.TraitLevel); } if (RPGMakerGUI.Toggle("Require Learnt Skill?", ref quest.Requirements.RequireLearntSkill)) { RPGMakerGUI.PopupID <Skill>("- Skill:", ref quest.Requirements.LearntSkillID); } RPGMakerGUI.EndFoldout(); } var result = RPGMakerGUI.FoldoutToolBar(ref showSelectedQuestMainConditions, "Quest Conditions", "+Condition", false, false); if (showSelectedQuestMainConditions) { if (quest.Conditions.Count == 0) { EditorGUILayout.HelpBox("Click +Condition to add a new quest condition.", MessageType.Info); } for (int index = 0; index < quest.Conditions.Count; index++) { GUILayout.BeginVertical("foldoutBox"); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (index > 0 && GUILayout.Button("Move Up", "genericButton")) { GUI.FocusControl(""); var curCondition = quest.Conditions[index]; var prevCondition = quest.Conditions[index - 1]; quest.Conditions[index - 1] = curCondition; quest.Conditions[index] = prevCondition; return; } if (index < quest.Conditions.Count - 1 && GUILayout.Button("Move Down", "genericButton")) { GUI.FocusControl(""); var curCondition = quest.Conditions[index]; var nextCondition = quest.Conditions[index + 1]; quest.Conditions[index + 1] = curCondition; quest.Conditions[index] = nextCondition; return; } GUILayout.EndHorizontal(); quest.Conditions[index] = ShowConditionInfo(quest.Conditions[index]); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Delete", "genericButton", GUILayout.Height(25), GUILayout.Width(100))) { GUI.FocusControl(""); quest.Conditions.RemoveAt(index); index--; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); } if (result == 0) { quest.Conditions.Add(new KillCondition()); } RPGMakerGUI.EndFoldout(); } if (RPGMakerGUI.Foldout(ref showFinalCondition, "Final Condition")) { if (RPGMakerGUI.Toggle("Enable Final Condition?", ref quest.HasFinalCondition)) { quest.FinalCondition = ShowConditionInfo(quest.FinalCondition); } RPGMakerGUI.EndFoldout(); } if (RPGMakerGUI.Foldout(ref showBonusCondition, "Bonus Condition")) { if (RPGMakerGUI.Toggle("Enable Bonus Condition?", ref quest.HasBonusCondition)) { quest.BonusCondition = ShowConditionInfo(quest.BonusCondition); if (RPGMakerGUI.Toggle("- Has Time Limit", ref quest.BonusHasTimeLimit)) { quest.BonusTimeLimit = RPGMakerGUI.FloatField(" - Time Limit:", quest.BonusTimeLimit); } } RPGMakerGUI.EndFoldout(); } if (RPGMakerGUI.Foldout(ref showQuestRewards, "Rewards")) { ShowQuestRewardInfo(ref showQuestMainRewards, "Item Rewards", quest.Rewards); RPGMakerGUI.EndFoldout(); } if (quest.HasBonusCondition) { if (RPGMakerGUI.Foldout(ref showBonusRewards, "Bonus Rewards")) { ShowQuestRewardInfo(ref showQuestBonusRewards, "Bonus Condition Reward", quest.BonusRewards); RPGMakerGUI.EndFoldout(); } } RPGMakerGUI.FoldoutList(ref showCustomVarSetters, "Set Custom Vars on Completion", quest.SetCustomVariablesOnCompletion, Rm_RPGHandler.Instance.DefinedVariables.Vars, "+VariableSetter", "", "Click +VariableSetter to add a varaible setter", "VariableID", "Name", "ID", "Name"); }