コード例 #1
0
        public static void ProgressionGain(bool isHarvestable, ProgressionGain progressionGain, bool isCombatant = false)
        {
            GUILayout.BeginHorizontal();
            RPGMakerGUI.Label(isHarvestable ? "Gains on Harvest:" : "Gains On Kill:");
            progressionGain.GainExp = EditorGUILayout.ToggleLeft(" Exp?", progressionGain.GainExp, GUILayout.Width(55));
            GUILayout.Space(15);
            progressionGain.GainSkillPoints = EditorGUILayout.ToggleLeft(" Skill Points?", progressionGain.GainSkillPoints, GUILayout.Width(90));
            GUILayout.Space(15);
            progressionGain.GainTraitExp = EditorGUILayout.ToggleLeft(" Trait Exp?", progressionGain.GainTraitExp, GUILayout.Width(90));
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            if (progressionGain.GainExp)
            {
                if (isCombatant && RPGMakerGUI.Toggle("Gain Exp with Exp Definition?", ref progressionGain.GainExpWithDefinition))
                {
                    RPGMakerGUI.PopupID <ExpDefinition>("Exp Definition:", ref progressionGain.GainExpWithDefinitionID, "ID", "Name", "ExpGained");
                }
                else
                {
                    progressionGain.ExpGained = RPGMakerGUI.IntField("- Exp ", progressionGain.ExpGained);
                }
            }

            if (progressionGain.GainSkillPoints)
            {
                if (isCombatant && RPGMakerGUI.Toggle("Gain Skill Points with Exp Definition?", ref progressionGain.GainSkillWithDefinition))
                {
                    RPGMakerGUI.PopupID <ExpDefinition>("Exp Definition:", ref progressionGain.GainSkillWithDefinitionID, "ID", "Name", "ExpGained");
                }
                else
                {
                    progressionGain.SkillPointsGained = RPGMakerGUI.IntField("- Skill Points: ", progressionGain.SkillPointsGained);
                }
            }

            if (progressionGain.GainTraitExp)
            {
                if (isCombatant && RPGMakerGUI.Toggle("Gain Trait Exp with Exp Definition?", ref progressionGain.GainTraitWithDefinition))
                {
                    RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait:", ref progressionGain.TraitID);
                    RPGMakerGUI.PopupID <ExpDefinition>("Exp Definition:", ref progressionGain.GainTraitWithDefinitionID, "ID", "Name", "ExpGained");
                }
                else
                {
                    RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait:", ref progressionGain.TraitID);
                    progressionGain.TraitExpGained = RPGMakerGUI.IntField("- Trait EXP: ", progressionGain.TraitExpGained);
                }
            }
        }
コード例 #2
0
        public static void VendorShops(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            leftAreaB   = new Rect(leftArea.xMax + 5, leftArea.y, leftArea.width, leftArea.height);
            mainAreaAlt = new Rect(leftAreaB.xMax + 5, leftArea.y, mainArea.width - (leftAreaB.width + 5),
                                   leftArea.height);

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(leftAreaB, "", "backgroundBox");
            GUI.Box(mainAreaAlt, "", "backgroundBox");


            var list = Rm_RPGHandler.Instance.Repositories.Vendor.AllVendors;

            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.ListArea(list, ref selectedVendorShop, Rm_ListAreaType.VendorShops, false, true);
            GUILayout.EndArea();

            GUILayout.BeginArea(leftAreaB);
            if (selectedVendorShop != null)
            {
                RPGMakerGUI.ListArea(selectedVendorShop.VendorShopItems, ref selectedVendorShopItem, Rm_ListAreaType.VendorShopItem, false, false, Rme_ListButtonsToShow.AllExceptHelp, true);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(mainAreaAlt);
            RPGMakerGUI.Title("Vendor Shops");
            if (selectedVendorShop != null)
            {
                selectedVendorShop.Name = RPGMakerGUI.TextField("Name: ", selectedVendorShop.Name);
                if (selectedVendorShopItem != null)
                {
                    //todo: replace with PopupID
                    RPGMakerGUI.SubTitle("Selected Vendor Shop Item");
                    var allItems = Rm_RPGHandler.Instance.Repositories.Items.AllItems;
                    if (string.IsNullOrEmpty(selectedVendorShopItem.ItemID))
                    {
                        selecteVendorItem = 0;
                    }
                    else
                    {
                        var stillExists =
                            allItems.FirstOrDefault(a => a.ID == selectedVendorShopItem.ItemID);
                        selecteVendorItem = stillExists != null?allItems.IndexOf(stillExists) : 0;
                    }
                    selecteVendorItem = EditorGUILayout.Popup("Item:", selecteVendorItem,
                                                              allItems.Select((q, indexOf) => indexOf + ". " + q.Name).
                                                              ToArray());

                    if (allItems.Count > 0)
                    {
                        selectedVendorShopItem.ItemID = allItems[selecteVendorItem].ID;

                        var stackable = allItems[selecteVendorItem] as IStackable;
                        if (stackable != null)
                        {
                            selectedVendorShopItem.InfiniteStock = RPGMakerGUI.Toggle("Infinite Stock?",
                                                                                      selectedVendorShopItem.
                                                                                      InfiniteStock);


                            if (!selectedVendorShopItem.InfiniteStock)
                            {
                                selectedVendorShopItem.QuantityRemaining = RPGMakerGUI.IntField("Quantity:",
                                                                                                selectedVendorShopItem.
                                                                                                QuantityRemaining);
                            }
                        }
                    }
                    else
                    {
                        RPGMakerGUI.Label("No Items Found.");
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise Vendor Shops.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #3
0
        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();
        }