コード例 #1
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");

            GUILayout.BeginArea(fullArea);
            optionsScrollPos = GUILayout.BeginScrollView(optionsScrollPos);
            RPGMakerGUI.Title("Stat Options");
            RPGMakerGUI.SubTitle("Exp Options");
            RPGMakerGUI.Toggle("Allow Exp To Overflow", ref ASVT.AllowExpToOverflow);
            RPGMakerGUI.SubTitle("Stat Options");
            ASVT.RegenInterval = RPGMakerGUI.FloatField("RegenInterval:", ASVT.RegenInterval);

            RPGMakerGUI.SubTitle("Titles");
            ASVT.AttributeNameTitle = RPGMakerGUI.TextField("Attribute Title:", ASVT.AttributeNameTitle);
            ASVT.StatisticNameTitle = RPGMakerGUI.TextField("Statistic Title:", ASVT.StatisticNameTitle);
            ASVT.VitalNameTitle     = RPGMakerGUI.TextField("Vital Title:", ASVT.VitalNameTitle);
            ASVT.TraitNameTitle     = RPGMakerGUI.TextField("Trait Title:", ASVT.TraitNameTitle);

            RPGMakerGUI.SubTitle("Movement");
            ASVT.JumpHeight           = RPGMakerGUI.FloatField("Player Jump Height:", ASVT.JumpHeight);
            ASVT.BaseMovementSpeed    = RPGMakerGUI.FloatField("Base Player Movement Speed:", ASVT.BaseMovementSpeed);
            ASVT.BaseNpcMovementSpeed = RPGMakerGUI.FloatField("Base NPC Movement Speed:", ASVT.BaseNpcMovementSpeed);
            if (RPGMakerGUI.Toggle("Use Stat as Movement Multiplier?", ref ASVT.UseStatForMovementSpeed))
            {
                RPGMakerGUI.PopupID <Rm_StatisticDefintion>("Statistic:", ref ASVT.StatForMovementID, 1);
                RPGMakerGUI.Help("Move Speed = BaseMoveSpeed * Stat:", 1);
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #2
0
        public static void Quests(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.ListArea(AllSingleQuestsList, ref selectedQuest, Rm_ListAreaType.Quests, false, false);
            GUILayout.EndArea();


            GUILayout.BeginArea(mainArea);
            questScrollPos = GUILayout.BeginScrollView(questScrollPos);

            RPGMakerGUI.Title("Quests");
            if (selectedQuest != null)
            {
                QuestDetails(selectedQuest, false);
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise quests.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        private static void ShowQuestRewardInfo(ref bool show, string prefix, QuestReward reward)
        {
            RPGMakerGUI.FoldoutList(ref show, prefix, reward.Items, Rm_RPGHandler.Instance.Repositories.Items.AllItems, "+ItemReward",
                                    "", "Click +ItemReward to add an item as a reward.", "ItemID");
            RPGMakerGUI.FoldoutList(ref show, prefix + " (Craftable Items)", reward.CraftableItems, Rm_RPGHandler.Instance.Repositories.CraftableItems.AllItems, "+CraftItemReward",
                                    "", "Click +CraftItemReward to add a craftable item as a reward.", "ItemID");
            RPGMakerGUI.FoldoutList(ref show, prefix + " (Quest Items)", reward.QuestItems, Rm_RPGHandler.Instance.Repositories.QuestItems.AllItems, "+QuestItemReward",
                                    "", "Click +QuestItemReward to add a quest item as a reward.", "ItemID");

            reward.Exp  = RPGMakerGUI.IntField("Exp Reward:", reward.Exp);
            reward.Gold = RPGMakerGUI.IntField("Gold Reward:", reward.Gold);

            if (RPGMakerGUI.Toggle("Gives Reputation?", ref reward.GivesReputation))
            {
                RPGMakerGUI.PopupID <ReputationDefinition>("- Reputation", ref reward.Reputation.ReputationID);
                reward.Reputation.Value = RPGMakerGUI.IntField("- Amount", reward.Reputation.Value);
            }
            if (RPGMakerGUI.Toggle("Gives Trait Exp?", ref reward.GivesTraitExp))
            {
                RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait", ref reward.TraitID);
                reward.TraitExp = RPGMakerGUI.IntField("- Amount", reward.TraitExp);
            }
            if (RPGMakerGUI.Toggle("Unlocks Skill?", ref reward.UnlocksSkill))
            {
                RPGMakerGUI.PopupID <Skill>("- Skill", ref reward.SkillID);
            }
            if (RPGMakerGUI.Toggle("Applys Status Effect?", ref reward.ApplysStatusEffect))
            {
                RPGMakerGUI.PopupID <StatusEffect>("- Status Effect", ref reward.StatusEffectID);
            }
        }
コード例 #5
0
        public static void Enemies(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            var list = Rm_RPGHandler.Instance.Repositories.Enemies.AllEnemies;

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

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


            GUILayout.BeginArea(mainArea);
            RPGMakerGUI.Title("Enemies");
            if (selectedCharInfo != null)
            {
                RPGMakerGUI.BeginScrollView();
                if (RPGMakerGUI.Foldout(ref mainInfoFoldout, "Main Info"))
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical(GUILayout.MaxWidth(85));
                    selectedCharInfo.Image = RPGMakerGUI.ImageSelector("", selectedCharInfo.Image,
                                                                       ref selectedCharInfo.ImagePath);

                    GUILayout.EndVertical();
                    GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                    selectedCharInfo.ID   = RPGMakerGUI.TextField("ID: ", selectedCharInfo.ID);
                    selectedCharInfo.Name = RPGMakerGUI.TextField("Name: ", selectedCharInfo.Name);
                    GUILayout.BeginHorizontal();
                    gameObject = RPGMakerGUI.PrefabSelector("Enemy Prefab:", gameObject, ref selectedCharInfo.CharPrefabPath);
                    gameObject = RPGMakerGUI.PrefabGeneratorButton(Rmh_PrefabType.Enemy, gameObject, ref selectedCharInfo.CharPrefabPath, null, selectedCharInfo.ID);
                    GUILayout.EndHorizontal();

                    Rme_Combatants.CombatantDetails(selectedCharInfo);
                    GUILayout.Space(5);

                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }
                if (mainInfoFoldout)
                {
                    RPGMakerGUI.EndFoldout();
                }

                Rme_Combatants.Projectile(selectedCharInfo);
                Rme_Combatants.Animations(selectedCharInfo);
                Rme_Combatants.CombatStats(selectedCharInfo);
                Rme_Combatants.Loot(selectedCharInfo);

                RPGMakerGUI.EndScrollView();
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise Enemy Characters.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #6
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");

            GUILayout.BeginArea(fullArea);
            RPGMakerGUI.Title("Interactables - Options");
            Interact.InteractDistance = RPGMakerGUI.FloatField("Interact Distance: ", Interact.InteractDistance);
            RPGMakerGUI.Toggle("Add Harvested Items to Inventory?", ref Interact.AddHarvestItemsToInventory);
            GUILayout.EndArea();
        }
コード例 #7
0
        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();
        }
コード例 #8
0
        private void OnGUIx()
        {
            if (Links.Count + Warnings.Length + Info.Length < 1)
            {
                Close();
            }

            GUI.skin = null;
            GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin;
            GUILayout.BeginVertical("backgroundBox");

            RPGMakerGUI.Title("Important Update Info");
            foreach (var text in Links)
            {
                GUILayout.BeginVertical();
                EditorGUILayout.HelpBox(text.Key, MessageType.Error);
                if (GUILayout.Button("Click Here For More Information", "genericButton", GUILayout.Height(20)))
                {
                    Process.Start(text.Value);
                }
                GUILayout.EndVertical();
                GUILayout.Space(5);
            }
            GUILayout.Space(10);
            foreach (var text in Warnings)
            {
                EditorGUILayout.HelpBox(text, MessageType.Warning);
                GUILayout.Space(5);
            }
            foreach (var text in Info)
            {
                EditorGUILayout.HelpBox(text, MessageType.Info);
                GUILayout.Space(5);
            }


            GUILayout.FlexibleSpace();

            if (EditorApplication.timeSinceStartup >= _timeToEnable)
            {
                if (GUILayout.Button("Close", "genericButton", GUILayout.Height(20)))
                {
                    Close();
                }
            }
            else
            {
                GUI.enabled = false;
                GUILayout.Button("Can close in " + (_timeToEnable - EditorApplication.timeSinceStartup).ToString("F2") + " seconds", "genericButton", GUILayout.Height(20));
                GUI.enabled = false;
            }
            GUILayout.EndVertical();
        }
コード例 #9
0
        public static void QuestChains(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");



            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            var selected = selectedQuestChain;

            RPGMakerGUI.ListArea(questChainList, ref selectedQuestChain, Rm_ListAreaType.QuestChains, false, false);
            if (selected != selectedQuestChain)
            {
                booleanArrayForToggles = new bool[999];
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(leftAreaB);
            if (selectedQuestChain != null)
            {
                var rect = RPGMakerGUI.ListArea(selectedQuestChain.QuestsInChain, ref selectedQuestChainQuest, Rm_ListAreaType.Quests, false, false, Rme_ListButtonsToShow.AllExceptHelp, true, selectedQuestChain.ID);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(mainAreaAlt);
            questChainScrollPos = GUILayout.BeginScrollView(questChainScrollPos);
            RPGMakerGUI.Title("Quest Chains");
            if (selectedQuestChain != null)
            {
                selectedQuestChain.Name = RPGMakerGUI.TextField("Name: ", selectedQuestChain.Name);
                if (selectedQuestChainQuest != null)
                {
                    var quest = selectedQuestChainQuest;
                    QuestDetails(quest, true);
                }
                else
                {
                    EditorGUILayout.HelpBox("Select a quest in the quest chain to begin editing it.", MessageType.Info);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise quest chains.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #10
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");

            GUILayout.BeginArea(fullArea);
            RPGMakerGUI.Title("Objectives - Options");

            RPGMakerGUI.Toggle("Show Quest Markers?", ref Questing.ShowQuestMarkers);
            Questing.QuestStarted.Audio  = RPGMakerGUI.AudioClipSelector("Quest Started Sound:", Questing.QuestStarted.Audio, ref Questing.QuestStarted.AudioPath);
            Questing.QuestComplete.Audio = RPGMakerGUI.AudioClipSelector("Quest Completed Sound:", Questing.QuestComplete.Audio, ref Questing.QuestComplete.AudioPath);

            GUILayout.EndArea();
        }
コード例 #11
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);
                }
            }
        }
コード例 #12
0
        public static void InteractableObjects(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            var list = Rm_RPGHandler.Instance.Repositories.Interactable.AllInteractables;

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

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


            GUILayout.BeginArea(mainArea);
            RPGMakerGUI.Title("Interactables");
            if (selectedInteractable != null)
            {
                RPGMakerGUI.TextField("ID: ", selectedInteractable.ID);
                selectedInteractable.Name = RPGMakerGUI.TextField("Name: ", selectedInteractable.Name);
                GUILayout.BeginHorizontal();
                gameObject = RPGMakerGUI.PrefabSelector("Prefab:", gameObject, ref selectedInteractable.PrefabPath);
                gameObject = RPGMakerGUI.PrefabGeneratorButton(Rmh_PrefabType.Interactable, gameObject, ref selectedInteractable.PrefabPath, null, selectedInteractable.ID);
                GUILayout.EndHorizontal();

                selectedInteractable.Image = RPGMakerGUI.ImageSelector("Image", selectedInteractable.Image, ref selectedInteractable.ImagePath, true);
                if (GUILayout.Button("Open Interaction Window", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == selectedInteractable.ID);
                    if (existingTree == null)
                    {
                        existingTree      = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                        existingTree.ID   = selectedInteractable.ID;
                        existingTree.Name = selectedInteractable.Name;
                        trees.Add(existingTree);
                    }

                    DialogNodeWindow.ShowWindow(selectedInteractable.ID);
                    selectedInteractable.ConversationNodeId = existingTree.ID;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise interactables.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #13
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");

            GUILayout.BeginArea(fullArea);
            optionsScrollPos = GUILayout.BeginScrollView(optionsScrollPos);
            RPGMakerGUI.Title("Enemy - Options");

            var result = RPGMakerGUI.FoldoutToolBar(ref showMonsterTypes, "Monster Types",
                                                    new[] { "+Monster Type" });

            if (showMonsterTypes)
            {
                for (int index = 0; index < Enemy.MonsterTypes.Count; index++)
                {
                    var def = Enemy.MonsterTypes[index];
                    GUILayout.BeginHorizontal();
                    def.Name = RPGMakerGUI.TextField("", def.Name);
                    if (RPGMakerGUI.DeleteButton(25))
                    {
                        Enemy.MonsterTypes.Remove(def);
                        index--;
                    }
                    GUILayout.EndHorizontal();
                }

                if (result == 0)
                {
                    Enemy.MonsterTypes.Add(new MonsterTypeDefinition());
                }

                if (Enemy.MonsterTypes.Count == 0)
                {
                    EditorGUILayout.HelpBox(
                        "You can define monster types to use elsewhere such as Boss, Miniboss, etc.",
                        MessageType.Info);
                }
            }
            if (showMonsterTypes)
            {
                RPGMakerGUI.EndFoldout();
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #14
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.Title("List 1");

            RPGMakerGUI.Title("List 2");
            RPGMakerGUI.Title("List 3");

            GUILayout.EndArea();


            GUILayout.BeginArea(mainArea);
            RPGMakerGUI.Title("Game page.");
            RPGMakerGUI.Title("UI - OPTIONS");
            GUILayout.EndArea();
        }
コード例 #15
0
        public static void Options(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");
            GUILayout.BeginArea(fullArea);
            RPGMakerGUI.Title("Game Options");

            RPGMakerGUI.SubTitle("General");

            Customise.GameHasAchievements = RPGMakerGUI.Toggle("Enable Achievements?", Customise.GameHasAchievements,
                                                               GUILayout.Width(300));
            Customise.AchievementUnlockedSound.Audio = RPGMakerGUI.AudioClipSelector("Achievement Unlocked Sound:", Customise.AchievementUnlockedSound.Audio, ref Customise.AchievementUnlockedSound.AudioPath);
            Customise.LoadingScreen.Image            = RPGMakerGUI.ImageSelector("Loading Screen:", Customise.LoadingScreen.Image, ref Customise.LoadingScreen.ImagePath);

            RPGMakerGUI.SubTitle("Enable Popups");
            RPGMakerGUI.Toggle("Exp Gained", ref Customise.EnableExpGainedPopup);
            RPGMakerGUI.Toggle("Level Reached", ref Customise.EnableLevelReachedPopup);
            RPGMakerGUI.Toggle("Skill Exp Gained", ref Customise.EnableSkillExpGainedPopup);

            RPGMakerGUI.SubTitle("Tooltip");
            RPGMakerGUI.Toggle("Follow Mouse Position", ref Customise.TooltipFollowsCursor);

            GUILayout.EndArea();
        }
コード例 #16
0
        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();
        }
コード例 #17
0
        public static void HarvestableObjects(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            var list = Rm_RPGHandler.Instance.Harvesting.HarvestableDefinitions;

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

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


            GUILayout.BeginArea(mainArea);
            areaScrollPos = GUILayout.BeginScrollView(areaScrollPos);

            RPGMakerGUI.Title("Harvestable Objects");
            if (selectedHarvestable != null)
            {
                RPGMakerGUI.TextField("ID: ", selectedHarvestable.ID);
                selectedHarvestable.Name = RPGMakerGUI.TextField("Name: ", selectedHarvestable.Name);
                GUILayout.BeginHorizontal();
                gameObject = RPGMakerGUI.PrefabSelector("Prefab:", gameObject, ref selectedHarvestable.PrefabPath);
                gameObject = RPGMakerGUI.PrefabGeneratorButton(Rmh_PrefabType.Harvest, gameObject, ref selectedHarvestable.PrefabPath, null, selectedHarvestable.ID);
                GUILayout.EndHorizontal();

                if (RPGMakerGUI.Toggle("Regenerates harvestables?", ref selectedHarvestable.RegensResources))
                {
                    selectedHarvestable.TimeInSecToRegen  = RPGMakerGUI.FloatField("Time before regen:", selectedHarvestable.TimeInSecToRegen);
                    selectedHarvestable.AmountRegenerated = RPGMakerGUI.IntField("Amount regenerated:", selectedHarvestable.AmountRegenerated);
                    selectedHarvestable.MaxAtOnce         = RPGMakerGUI.IntField("Max At Once:", selectedHarvestable.MaxAtOnce);
                }
                else
                {
                    selectedHarvestable.MinObtainable = RPGMakerGUI.IntField("Min Total Quantity Obtainable:", selectedHarvestable.MinObtainable);
                    selectedHarvestable.MaxObtainable = RPGMakerGUI.IntField("Max Total Quantity Obtainable:", selectedHarvestable.MaxObtainable);
                }

                if (RPGMakerGUI.Toggle("Is Quest Item?", ref selectedHarvestable.IsQuestItem))
                {
                    RPGMakerGUI.PopupID <Quest>("Accepted Quest Required To Loot:", ref selectedHarvestable.QuestAcceptedID);
                    RPGMakerGUI.PopupID <Item>("Harvested Quest Item:", ref selectedHarvestable.HarvestedObjectID, "ID", "Name", "Quest");
                    if (!string.IsNullOrEmpty(selectedHarvestable.HarvestedObjectID))
                    {
                        var item      = Rm_RPGHandler.Instance.Repositories.QuestItems.AllItems.First(i => i.ID == selectedHarvestable.HarvestedObjectID);
                        var stackable = item as IStackable;
                        if (stackable != null)
                        {
                            selectedHarvestable.MinAmountGained = RPGMakerGUI.IntField("Min Quantity Gained:", selectedHarvestable.MinAmountGained);
                            selectedHarvestable.MaxAmountGained = RPGMakerGUI.IntField("Max Quantity Gained:", selectedHarvestable.MaxAmountGained);
                        }
                    }
                }
                else
                {
                    RPGMakerGUI.PopupID <Item>("Harvested Item:", ref selectedHarvestable.HarvestedObjectID);
                    if (!string.IsNullOrEmpty(selectedHarvestable.HarvestedObjectID))
                    {
                        var item      = Rm_RPGHandler.Instance.Repositories.Items.AllItems.First(i => i.ID == selectedHarvestable.HarvestedObjectID);
                        var stackable = item as IStackable;
                        if (stackable != null)
                        {
                            selectedHarvestable.MinAmountGained = RPGMakerGUI.IntField("Min Quantity Gained:", selectedHarvestable.MinAmountGained);
                            selectedHarvestable.MaxAmountGained = RPGMakerGUI.IntField("Max Quantity Gained:", selectedHarvestable.MaxAmountGained);
                        }
                    }
                }

                selectedHarvestable.HarvestSound  = RPGMakerGUI.AudioClipSelector("Harvesting Sound:", selectedHarvestable.HarvestSound, ref selectedHarvestable.HarvestingSoundPath);
                selectedHarvestable.TimeToHarvest = RPGMakerGUI.FloatField("Time to harvest:", selectedHarvestable.TimeToHarvest);
                if (RPGMakerGUI.Toggle("Require Level To Harvest:", ref selectedHarvestable.RequireLevel))
                {
                    selectedHarvestable.LevelRequired = RPGMakerGUI.IntField("- Required Level", selectedHarvestable.LevelRequired);
                }

                if (RPGMakerGUI.Toggle("Require Trait Level To Harvest:", ref selectedHarvestable.RequireTraitLevel))
                {
                    RPGMakerGUI.PopupID <Rm_TraitDefintion>("- Trait", ref selectedHarvestable.RequiredTraitID);
                    selectedHarvestable.TraitLevelRequired = RPGMakerGUI.IntField("- Required Trait Level", selectedHarvestable.TraitLevelRequired);
                }



                Rme_Main_General.ProgressionGain(true, selectedHarvestable.ProgressionGain);

                if (RPGMakerGUI.Foldout(ref showHarvestAnims, "Animations"))
                {
                    foreach (var classHarvestAnim in selectedHarvestable.ClassHarvestingAnims)
                    {
                        var classInfo = RPG.Player.GetCharacterDefinition(classHarvestAnim.ClassID);
                        var className = classInfo.Name;
                        if (classInfo.AnimationType == RPGAnimationType.Legacy)
                        {
                            classHarvestAnim.LegacyAnim = RPGMakerGUI.TextField(className + " Animation:", classHarvestAnim.LegacyAnim);
                        }
                        else
                        {
                            GUILayout.BeginHorizontal();
                            classHarvestAnim.AnimNumber = RPGMakerGUI.IntField(className + "Anim AnimNumber:", classHarvestAnim.AnimNumber);
                            GUILayout.EndHorizontal();
                        }
                    }

                    RPGMakerGUI.EndFoldout();
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise harvestable objects.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #18
0
        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();
        }
コード例 #19
0
    void OnGUI()
    {
        try
        {
            GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin;

            GUILayout.BeginHorizontal();
            GUILayout.BeginVertical();

            foreach (var element in GUIElements)
            {
                if (element.Type == GUIType.Textfield)
                {
                    element.StringValue = GUILayout.TextField(element.StringValue, element.LayoutOptions);
                }

                if (element.Type == GUIType.EditorTextfield)
                {
                    element.StringValue = EditorGUILayout.TextField(element.EditorGUILabel, element.StringValue);
                }

                if (element.Type == GUIType.BeginHorizontal)
                {
                    GUILayout.BeginHorizontal();
                }
                if (element.Type == GUIType.EndHorizontal)
                {
                    GUILayout.EndHorizontal();
                }
                if (element.Type == GUIType.BeginVertical)
                {
                    GUILayout.BeginVertical();
                }
                if (element.Type == GUIType.EndVertical)
                {
                    GUILayout.EndVertical();
                }
            }
            GUILayout.EndVertical();

            GUILayout.BeginVertical(GUILayout.MaxWidth(180));
            var rect = RPGMakerGUI.ListArea(GUIElements, ref selectedGUIelement, Rm_ListAreaType.Vitals, true, true);
            var evt  = Event.current;
            if (evt.type == EventType.MouseDown)
            {
                var mousePos = evt.mousePosition;
                if (rect.Contains(mousePos))
                {
                    var menu = new GenericMenu();
                    foreach (var typeOf in addableElements)
                    {
                        menu.AddItem(new GUIContent(typeOf.ToString()), false, AddGUIElement(), typeOf);
                    }
                    menu.ShowAsContext();
                    evt.Use();
                }
            }
            if (selectedGUIelement != null)
            {
                RPGMakerGUI.SubTitle("GUI Element Settings");
                if (selectedGUIelement.Type == GUIType.Textfield)
                {
                    selectedGUIelement.MaxWidth = RPGMakerGUI.IntField("Max Width", selectedGUIelement.MaxWidth);
                }
                if (selectedGUIelement.Type == GUIType.EditorTextfield)
                {
                    selectedGUIelement.EditorGUILabel = RPGMakerGUI.TextField("Prefix Label:", selectedGUIelement.EditorGUILabel);
                }

                if (GUILayout.Button("Save(tesT)"))
                {
                    var b = GeneralMethods.CopyObject(selectedGUIelement);
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndVertical();



            GUILayout.EndHorizontal();
        }
        catch (Exception e)
        {
            Debug.Log(e.StackTrace);
        }
    }
コード例 #20
0
        public static void Reputations(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            var list = Rm_RPGHandler.Instance.Repositories.Quests.AllReputations;

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.ListArea(list, ref selectedReputation, Rm_ListAreaType.Reputations, false, false);
            GUILayout.EndArea();


            GUILayout.BeginArea(mainArea);
            RPGMakerGUI.Title("Reputations");
            if (selectedReputation != null)
            {
                GUILayout.BeginHorizontal();
                GUILayout.BeginVertical(GUILayout.MaxWidth(85));
                selectedReputation.Image = RPGMakerGUI.ImageSelector("", selectedReputation.Image,
                                                                     ref selectedReputation.ImagePath);

                GUILayout.EndVertical();
                GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                selectedReputation.Name                    = RPGMakerGUI.TextField("Name: ", selectedReputation.Name);
                selectedReputation.StartingValue           = RPGMakerGUI.IntField("Starting Value: ", selectedReputation.StartingValue);
                selectedReputation.ValueLossForNPCAttack   = RPGMakerGUI.IntField("Loss on NPC Attack: ", selectedReputation.ValueLossForNPCAttack);
                selectedReputation.IsTrackable             = RPGMakerGUI.Toggle("Trackable?", selectedReputation.IsTrackable);
                selectedReputation.AttackIfBelowReputation = RPGMakerGUI.Toggle("Attack if below Rep?", selectedReputation.AttackIfBelowReputation);
                if (selectedReputation.AttackIfBelowReputation)
                {
                    selectedReputation.BelowReputationValue = RPGMakerGUI.IntField("Attack if Below: ", selectedReputation.BelowReputationValue);
                }

                GUILayout.Space(40);
                GUILayout.Label("Enemy Factions:");
                if (Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.Count > 1) //As we include the current reputation
                {
                    foreach (var d in Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.Where(r => r.ID != selectedReputation.ID))
                    {
                        var faction = selectedReputation.EnemyFactions.FirstOrDefault(a => a.ID == d.ID);
                        if (faction == null)
                        {
                            var factionToAdd = new FactionStatus()
                            {
                                ID     = d.ID,
                                IsTrue = false
                            };

                            selectedReputation.EnemyFactions.Add(factionToAdd);
                        }
                    }

                    for (int index = 0; index < selectedReputation.EnemyFactions.Count; index++)
                    {
                        var v           = selectedReputation.EnemyFactions[index];
                        var stillExists =
                            Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.FirstOrDefault(
                                a => a.ID == v.ID);

                        if (stillExists == null)
                        {
                            selectedReputation.EnemyFactions.Remove(v);
                            index--;
                        }
                    }

                    foreach (var v in selectedReputation.EnemyFactions)
                    {
                        var prefix =
                            Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.First(a => a.ID == v.ID).
                            Name;
                        RPGMakerGUI.Toggle(prefix, ref v.IsTrue);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("No other factions.", MessageType.Info);
                }

                #region "AlliedFactions"
                //                GUILayout.Label("Allied Factions:");
//                if (Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.Count > 1) //As we include the current reputation
//                {
//                    foreach (var d in Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.Where(r => r.ID != selectedReputation.ID))
//                    {
//                        var faction = selectedReputation.AlliedFactions.FirstOrDefault(a => a.ID == d.ID);
//                        if (faction == null)
//                        {
//                            var factionToAdd = new FactionStatus()
//                            {
//                                ID = d.ID,
//                                IsTrue = false
//                            };
//
//                            selectedReputation.AlliedFactions.Add(factionToAdd);
//                        }
//                    }
//
//                    for (int index = 0; index < selectedReputation.AlliedFactions.Count; index++)
//                    {
//                        var v = selectedReputation.AlliedFactions[index];
//                        var stillExists =
//                            Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.FirstOrDefault(
//                                a => a.ID == v.ID);
//
//                        if (stillExists == null)
//                        {
//                            selectedReputation.AlliedFactions.Remove(v);
//                            index--;
//                        }
//                    }
//
//                    foreach (var v in selectedReputation.AlliedFactions)
//                    {
//                        var prefix =
//                            Rm_RPGHandler.Instance.Repositories.Quests.AllReputations.First(a => a.ID == v.ID).
//                                Name;
//                        RPGMakerGUI.Toggle(prefix, ref v.IsTrue);
//                    }
//                }
//                else
//                {
//                    EditorGUILayout.HelpBox("No other factions.", MessageType.Info);
                //                }
                #endregion

                var result = RPGMakerGUI.FoldoutToolBar(ref showRanks, "Faction Ranks", "+Rank");
                if (showRanks)
                {
                    for (int index = 0; index < selectedReputation.Ranks.Count; index++)
                    {
                        var rank = selectedReputation.Ranks[index];
                        GUILayout.BeginHorizontal();
                        rank.Name        = EditorGUILayout.TextField("", rank.Name);
                        rank.Requirement = EditorGUILayout.IntField("Requirement:", rank.Requirement);
                        GUI.enabled      = selectedReputation.Ranks.Count > 1;
                        if (RPGMakerGUI.DeleteButton(25))
                        {
                            selectedReputation.Ranks.RemoveAt(index);
                            index--;
                        }
                        GUI.enabled = true;
                        GUILayout.EndHorizontal();
                    }

                    RPGMakerGUI.EndFoldout();
                }

                if (result == 0)
                {
                    selectedReputation.Ranks.Add(new FactionRank());
                }

                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise reputations.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #21
0
        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");
        }
コード例 #22
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();
        }
コード例 #23
0
ファイル: Rme_Main.cs プロジェクト: Vjutal/Game1747
    private void OnGUIx()
    {
        GUI.skin = null;
        GUI.skin = Resources.Load("RPGMakerAssets/EditorSkinRPGMaker") as GUISkin;

        if (PlayerSettings.colorSpace == ColorSpace.Linear)
        {
            GUI.backgroundColor = new Color(1, 1, 1, 0.3f);
        }
        else
        {
            GUI.backgroundColor = new Color(1, 1, 1, 1);
        }

        var subMenuHeight = 30;
        var workingArea   = new Rect(5, 5, Window.position.width - 10, Window.position.height - 10);
        var topbarArea    = new Rect(10, 10, workingArea.width - 10, 30);
        var topbarAreaTwo = new Rect(10, topbarArea.yMax + 5, topbarArea.width, 25);

        if (ShowSubMenu)
        {
            topbarAreaTwo = new Rect(10, topbarArea.yMax + 5, topbarArea.width, 25 + subMenuHeight);
        }
        var subMenu = new Rect(10, topbarAreaTwo.yMax - subMenuHeight, topbarArea.width, subMenuHeight);

        var bottomAreaHeight = 35;
        var leftBar          = new Rect(10, topbarAreaTwo.yMax + 5,
                                        180, Window.position.height - 10 - (topbarAreaTwo.yMax + bottomAreaHeight + 5 + 5));
        var bottomArea = new Rect(10, leftBar.yMax + 5, topbarArea.width, bottomAreaHeight);
        var mainArea   = new Rect(leftBar.xMax + 5, leftBar.y, topbarArea.width - (leftBar.width + 5), leftBar.height);
        var fullArea   = new Rect(leftBar.x, leftBar.y, topbarArea.width, leftBar.height);

        GUI.Box(workingArea, "", "workingAreaBox");
        GUI.Box(bottomArea, "", "backgroundBox");

        GUILayout.BeginArea(PadRect(topbarArea, 0, 0), "", "topAreaBackground");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("", "LogicSpawnIcon"))
        {
            Application.OpenURL("http://rpgaio.logicspawn.co.uk/");
        }
        //GUILayout.Label(RpgVersion);
        var isMobile = "";

#if (UNITY_IOS || UNITY_ANDROID)
        isMobile = " - Mobile Mode";
#endif
        if (GUILayout.Button(RpgVersion + isMobile, "Label"))
        {
            Application.OpenURL("http://rpgaio.logicspawn.co.uk/");
        }
        GUILayout.FlexibleSpace();
        GUILayout.Label(Rm_RPGHandler.Instance.GameInfo.GameTitle + " by " + Rm_RPGHandler.Instance.GameInfo.GameCompany);
        GUILayout.EndHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.EndArea();

        GUILayout.BeginArea(PadRect(topbarAreaTwo, 0, 0), "", "backgroundBox");
        GUILayout.BeginHorizontal();
        for (int i = 0; i < Pages.Length; i++)
        {
            if (GUILayout.Button(Pages[i].ToString(), "menuButton"))
            {
                if (ShowSubMenu && CurrentSubMenu == Pages[i])
                {
                    ShowSubMenu = false;
                }
                else
                {
                    CurrentSubMenu = Pages[i];
                    ShowSubMenu    = true;
                }
            }
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();

        switch (CurrentPage)
        {
        case CurrentPage.Main:
            if (CurrentPageIndex == Array.IndexOf(MainPages, "Home"))
            {
                Rme_Main_Main.Home(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(MainPages, "Preferences"))
            {
                Rme_Main_Main.Preferences(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Game:
            if (CurrentPageIndex == Array.IndexOf(GamePages, "Options"))
            {
                Rme_Main_Game.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Game Info"))
            {
                Rme_Main_Main.GameInfo(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Settings and Controls"))
            {
                Rme_Main_Main.GameSettings(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Save Options"))
            {
                Rme_Main_Main.SaveOptions(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Credits"))
            {
                Rme_Main_Main.Credits(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Global Playlist"))
            {
                Rme_Main_Game.GlobalPlaylist(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "Minimap"))
            {
                Rme_Main_Main.Minimap(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(GamePages, "World Map"))
            {
                Rme_Main_Game.WorldMap(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Stats:
            if (CurrentPageIndex == Array.IndexOf(StatsPages, "Options"))
            {
                Rme_Main_Stats.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Attributes"))
            {
                Rme_Main_Stats.Attributes(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Vitals"))
            {
                Rme_Main_Stats.Vitals(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Statistics"))
            {
                Rme_Main_Stats.Statistics(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Traits"))
            {
                Rme_Main_Stats.Traits(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(StatsPages, "Experience"))
            {
                Rme_Main_Player.Experience(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Player:
            if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Options"))
            {
                Rme_Main_Player.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Class-Names"))
            {
                Rme_Main_Player.ClassNames(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Races"))
            {
                Rme_Main_Player.Races(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Sub-Races"))
            {
                Rme_Main_Player.SubRaces(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Meta-Datas"))
            {
                Rme_Main_Player.MetaDatas(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Characters"))
            {
                Rme_Main_Player.Classes(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Genders"))
            {
                Rme_Main_Player.Genders(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(PlayerPages, "Pets"))
            {
                Rme_Main_Player.Pets(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Enemies:
            if (CurrentPageIndex == Array.IndexOf(EnemiesPages, "Options"))
            {
                Rme_Main_Enemies.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(EnemiesPages, "Enemies"))
            {
                Rme_Main_Enemies.Enemies(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.NPC:
            if (CurrentPageIndex == Array.IndexOf(NPCPages, "NPCs"))
            {
                Rme_Main_NPC.NPCs(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(NPCPages, "Vendor Shops"))
            {
                Rme_Main_NPC.VendorShops(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(NPCPages, "Reputations"))
            {
                Rme_Main_NPC.Reputations(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Items:
            if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Options"))
            {
                Rme_Main_Items.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Item DB"))
            {
                Rme_Main_Items.ItemDB(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Craftable Items"))
            {
                Rme_Main_Items.CraftableItems(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Craft Lists"))
            {
                Rme_Main_Items.CraftLists(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Dismantling"))
            {
                Rme_Main_Items.Dismantling(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Quest Items"))
            {
                Rme_Main_Items.QuestItems(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Loot-Tables"))
            {
                Rme_Main_Items.LootTables(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Costume Designer"))
            {
                Rme_Main_Items_CostumeDesigner.Main(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ItemsPages, "Tiers"))
            {
                Rme_Main_Items.Tiers(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Combat:
            if (CurrentPageIndex == Array.IndexOf(CombatPages, "Options"))
            {
                Rme_Main_Combat.Options(fullArea, leftBar, mainArea, Window);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Skills"))
            {
                Rme_Main_Combat.Skills(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Talents"))
            {
                Rme_Main_Combat.Talents(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Talent Groups"))
            {
                Rme_Main_Combat.TalentGroups(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Status Effects"))
            {
                Rme_Main_Combat.StatusEffects(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(CombatPages, "Visualiser"))
            {
                Rme_Main_Combat_SkillVisualiser.Main(fullArea, leftBar, mainArea, Window);
            }
            break;

        case CurrentPage.Objectives:
            if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Quest Chains"))
            {
                Rme_Main_Questing.QuestChains(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Options"))
            {
                Rme_Main_Questing.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(ObjectivesPages, "Quests"))
            {
                Rme_Main_Questing.Quests(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Interactables:
            if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Options"))
            {
                Rme_Main_Interactables.Options(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Interactable Objects"))
            {
                Rme_Main_Interactables.InteractableObjects(fullArea, leftBar, mainArea);
            }
            else if (CurrentPageIndex == Array.IndexOf(InteractablesPages, "Harvestable Objects"))
            {
                Rme_Main_Interactables.HarvestableObjects(fullArea, leftBar, mainArea);
            }
            break;

        case CurrentPage.Custom:
            if (CurrentPageIndex == Array.IndexOf(CustomPages, "Custom Variables"))
            {
                Rme_Main_Custom.CustomVariables(fullArea, leftBar, mainArea);
            }
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }

        if (ShowSubMenu)
        {
            GUI.Box(subMenu, "");
            GUILayout.BeginArea(PadRect(subMenu, 0, 0), "", "subMenuBackground");

            String[] arrayToUse;
            switch (CurrentSubMenu)
            {
            case CurrentPage.Main:
                arrayToUse = MainPages;
                break;

            case CurrentPage.Game:
                arrayToUse = GamePages;
                break;

            case CurrentPage.Stats:
                arrayToUse = StatsPages;
                break;

            case CurrentPage.Player:
                arrayToUse = PlayerPages;
                break;

            case CurrentPage.Enemies:
                arrayToUse = EnemiesPages;
                break;

            case CurrentPage.NPC:
                arrayToUse = NPCPages;
                break;

            case CurrentPage.Items:
                arrayToUse = ItemsPages;
                break;

            case CurrentPage.Combat:
                arrayToUse = CombatPages;
                break;

            case CurrentPage.Objectives:
                arrayToUse = ObjectivesPages;
                break;

            case CurrentPage.Interactables:
                arrayToUse = InteractablesPages;
                break;

            case CurrentPage.Custom:
                arrayToUse = CustomPages;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            for (int i = 0; i < arrayToUse.Length; i++)
            {
                if (GUILayout.Button(arrayToUse[i], "subMenuButton"))
                {
                    CurrentPageIndex = Array.IndexOf(arrayToUse, arrayToUse[i]);
                    CurrentPage      = CurrentSubMenu;
                    ShowSubMenu      = false;
                    GUI.FocusControl("");
                    RPGMakerGUI.ResetScrollPositions();
                }
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndArea();
        }

        GUILayout.BeginArea(PadRect(bottomArea, 5, 5));
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();

        if (GUILayout.Button("Save Data", "genericButton"))
        {
            EditorGameDataSaveLoad.SaveGameData();
            GameSettingsSaveLoadManager.Instance.SaveSettings();
        }
        if (GUILayout.Button("Reload Data", "genericButton"))
        {
            Rm_RPGHandler.Instance = null;
            EditorGameDataSaveLoad.LoadGameDataFromEditor();
            GameSettingsSaveLoadManager.Instance.LoadSettings();
            AssetDatabase.Refresh();
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
コード例 #24
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();
        }
コード例 #25
0
        public static void Main(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");



            GUILayout.BeginArea(PadRect(leftArea, 1, 1));

            if (classPrefabs == null)
            {
                classPrefabs = Resources.LoadAll <GameObject>("Prefabs/Classes");
            }

            try
            {
                //Get class prefabs in class prefab location
                foreach (var classPrefab in classPrefabs)
                {
                    var ifSelected = selectedClass == classPrefab ? "listItemSelected" : "listItem";
                    if (GUILayout.Button(classPrefab.name, ifSelected))
                    {
                        selectedClass = classPrefab;
                        Debug.Log("clicked class  " + selectedClass.name);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log("Failed loading class for costume designer, reloading class prefabs");
                classPrefabs = Resources.LoadAll <GameObject>("Prefabs/Classes");
                GUILayout.EndArea();
                return;
            }


            GUILayout.FlexibleSpace();

            if (GUILayout.Button("- Reload Classes -", "listItem"))
            {
                classPrefabs = Resources.LoadAll <GameObject>("Prefabs/Classes");
            }

            GUILayout.EndArea();

            GUILayout.BeginArea(PadRect(leftAreaB, 1, 2));
            GUILayout.BeginHorizontal();

            GUILayout.Label("Filter:", GUILayout.Width(35));
            GUI.SetNextControlName("searchTerm");
            _searchTerm = GUILayout.TextField(_searchTerm, "nodeTextField");
            GUILayout.Space(1);
            GUILayout.EndHorizontal();
            if (Event.current.type == EventType.Repaint)
            {
                if (GUI.GetNameOfFocusedControl() == "searchTerm" && _searchTerm == _searchTermPlaceholder)
                {
                    _searchTerm = "";
                }
            }

            hierarchyScrollView = GUILayout.BeginScrollView(hierarchyScrollView);
            if (selectedClass != null)
            {
                var children = selectedClass.GetAllChildren <Transform>();
                if (_searchTerm != _searchTermPlaceholder)
                {
                    children = children.Where(n => n.name.ToLower().Contains(_searchTerm.ToLower())).ToArray();
                }
                foreach (var child in children)
                {
                    var ifSelected = selectedChildTransform == child ? "listItemSelected" : "listItem";
                    if (GUILayout.Button(child.name, ifSelected))
                    {
                        selectedChildTransform = child;
                    }
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Pick a class to choose a child transform to enable/disable depending on an equipped item.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();

            GUILayout.BeginArea(mainAreaAlt);
            if (selectedChildTransform != null)
            {
                var classDef = Rm_RPGHandler.Instance.Player.CharacterDefinitions.FirstOrDefault(c => c.Name == selectedClass.name);
                if (classDef != null)
                {
                    var result = RPGMakerGUI.FoldoutToolBar(ref showItems, "Items required to show", "+Item");
                    if (showItems)
                    {
                        var defs = classDef.EquipmentInfo.Definitions.Where(d => d.NameOfTransform == selectedChildTransform.name).ToList();

                        for (int i = 0; i < defs.Count; i++)
                        {
                            var dynamicDef = defs[i];
                            GUILayout.BeginHorizontal();
                            //RPGMakerGUI.PopupID<Item>("Item:", ref dynamicDef.RequiredEquippedItemId);
                            RPGMakerGUI.PopupID <Item>("Item:", ref dynamicDef.RequiredEquippedItemId, "ID", "Name", "CraftItemAndQuest");

                            if (RPGMakerGUI.DeleteButton(25))
                            {
                                classDef.EquipmentInfo.Definitions.Remove(dynamicDef);
                                i--;
                            }

                            GUILayout.EndHorizontal();
                            RPGMakerGUI.Toggle("Only In Weapon Slot?", ref dynamicDef.OnlyWeaponSlot);
                            if (!dynamicDef.OnlyWeaponSlot && RPGMakerGUI.Toggle("Only In Specific Slot?", ref dynamicDef.SpecificSlot))
                            {
                                RPGMakerGUI.PopupID <SlotDefinition>("Slot:", ref dynamicDef.SlotId);
                            }

                            GUILayout.Space(20);
                        }
                        foreach (var dynamicDef in defs)
                        {
                        }

                        if (result == 0)
                        {
                            classDef.EquipmentInfo.Definitions.Add(new DynamicEquipmentDefinition(selectedChildTransform.name));
                        }

                        if (!classDef.EquipmentInfo.Definitions.Any())
                        {
                            EditorGUILayout.HelpBox("Click +Item to add an item which will activate this transform", MessageType.Info);
                        }

                        RPGMakerGUI.EndFoldout();
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("This class does not exist in your class definitions. Rename the prefab in 'Resources/Prefabs/Classes' to be the same as your class.", MessageType.Error);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Pick a child transform to choose an item for it to depend on.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #26
0
        public static void NPCs(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            var list = Rm_RPGHandler.Instance.Repositories.Interactable.AllNpcs;

            GUI.Box(leftArea, "", "backgroundBox");
            GUI.Box(mainArea, "", "backgroundBoxMain");

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

            GUILayout.BeginArea(mainArea);
            RPGMakerGUI.Title("NPCs");
            if (selectedCharInfo != null)
            {
                RPGMakerGUI.BeginScrollView();
                if (RPGMakerGUI.Foldout(ref mainInfoFoldout, "Main Info"))
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.BeginVertical(GUILayout.MaxWidth(85));
                    selectedCharInfo.Image = RPGMakerGUI.ImageSelector("", selectedCharInfo.Image,
                                                                       ref selectedCharInfo.ImagePath);

                    GUILayout.EndVertical();
                    GUILayout.BeginVertical(GUILayout.ExpandWidth(true));
                    RPGMakerGUI.TextField("ID: ", selectedCharInfo.ID);
                    selectedCharInfo.Name = RPGMakerGUI.TextField("Name: ", selectedCharInfo.Name);
                    GUILayout.BeginHorizontal();
                    gameObject = RPGMakerGUI.PrefabSelector("NPC Prefab:", gameObject, ref selectedCharInfo.CharPrefabPath);
                    gameObject = RPGMakerGUI.PrefabGeneratorButton(Rmh_PrefabType.NPC, gameObject, ref selectedCharInfo.CharPrefabPath, null, selectedCharInfo.ID);
                    GUILayout.EndHorizontal();


                    if (GUILayout.Button("Open Interaction Window", "genericButton", GUILayout.MaxHeight(30)))
                    {
                        var trees        = Rm_RPGHandler.Instance.Nodes.DialogNodeBank.NodeTrees;
                        var existingTree = trees.FirstOrDefault(t => t.ID == selectedCharInfo.ID);
                        if (existingTree == null)
                        {
                            existingTree      = NodeWindow.GetNewTree(NodeTreeType.Dialog);
                            existingTree.ID   = selectedCharInfo.ID;
                            existingTree.Name = selectedCharInfo.Name;
                            trees.Add(existingTree);
                        }

                        DialogNodeWindow.ShowWindow(selectedCharInfo.ID);
                        selectedNPCInfo.Interaction.ConversationNodeId = existingTree.ID;
                    }
                    if (Rm_RPGHandler.Instance.Combat.NPCsCanFight)
                    {
                        if (RPGMakerGUI.Toggle("This NPC Can Fight?", ref selectedNPCInfo.CanFight))
                        {
                            selectedNPCInfo.CanBeKilled = RPGMakerGUI.Toggle("Can be Perma-killed? ", selectedNPCInfo.CanBeKilled);
                            Rme_Combatants.CombatantDetails(selectedNPCInfo);
                        }
                    }
                    GUILayout.Space(5);
                    GUILayout.EndVertical();
                    GUILayout.EndHorizontal();
                }
                if (mainInfoFoldout)
                {
                    RPGMakerGUI.EndFoldout();
                }


                Rme_Combatants.Animations(selectedNPCInfo);



                if (Rm_RPGHandler.Instance.Combat.NPCsCanFight && selectedNPCInfo.CanFight)
                {
                    Rme_Combatants.CombatStats(selectedNPCInfo);
                    Rme_Combatants.Loot(selectedNPCInfo);
                }

                RPGMakerGUI.EndScrollView();
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise Enemy Characters.", MessageType.Info);
            }
            GUILayout.EndArea();
        }
コード例 #27
0
        public static void WorldMap(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");



            GUILayout.BeginArea(PadRect(leftArea, 0, 0));
            RPGMakerGUI.ListArea(worldAreaList, ref selectedWorldArea, Rm_ListAreaType.WorldAreas, false, false);
            GUILayout.EndArea();

            GUILayout.BeginArea(leftAreaB);
            if (selectedWorldArea != null)
            {
                var rect = RPGMakerGUI.ListArea(selectedWorldArea.Locations, ref selectedWorldAreaLocation, Rm_ListAreaType.Location, false, false, Rme_ListButtonsToShow.AllExceptHelp, true, selectedWorldArea.ID);
            }
            GUILayout.EndArea();

            GUILayout.BeginArea(mainAreaAlt);
            worldAreaScrollPos = GUILayout.BeginScrollView(worldAreaScrollPos);
            RPGMakerGUI.Title("World Areas (Not Finished)");
            if (selectedWorldArea != null)
            {
                selectedWorldArea.Name = RPGMakerGUI.TextField("Name: ", selectedWorldArea.Name);
                selectedWorldArea.ImageContainer.Image = RPGMakerGUI.ImageSelector("Image:", selectedWorldArea.ImageContainer.Image, ref selectedWorldArea.ImageContainer.ImagePath);
                if (GUILayout.Button("Open Interaction Node Tree", "genericButton", GUILayout.MaxHeight(30)))
                {
                    var trees        = Rm_RPGHandler.Instance.Nodes.WorldMapNodeBank.NodeTrees;
                    var existingTree = trees.FirstOrDefault(t => t.ID == selectedWorldArea.ID);
                    if (existingTree == null)
                    {
                        existingTree    = NodeWindow.GetNewTree(NodeTreeType.WorldMap);
                        existingTree.ID = selectedWorldArea.ID;

                        Debug.Log(existingTree.ID + ":::" + existingTree.Name);
                        existingTree.Name = selectedWorldArea.Name;
                        trees.Add(existingTree);
                    }

                    WorldMapNodeWindow.ShowWindow(selectedWorldArea.ID);
                }
            }

            if (selectedWorldArea != null)
            {
                RPGMakerGUI.SubTitle("Location Info:");
                if (selectedWorldAreaLocation != null)
                {
                    var loc = selectedWorldAreaLocation;
                    loc.Name = RPGMakerGUI.TextField("Name:", loc.Name);
                    loc.ImageContainer.Image = RPGMakerGUI.ImageSelector("Name:", loc.ImageContainer.Image, ref loc.ImageContainer.ImagePath);
                    loc.Description          = RPGMakerGUI.TextField("Description:", loc.Description);
                    RPGMakerGUI.SceneSelector("Scene:", ref loc.SceneName);
                    if (RPGMakerGUI.Toggle("Use Custom Spawn Location?", ref loc.UseCustomLocation))
                    {
                        loc.CustomSpawnLocation = EditorGUILayout.Vector3Field("Location:", loc.CustomSpawnLocation);
                    }
                }
                else
                {
                    EditorGUILayout.HelpBox("Select a location in the world area to begin editing it.", MessageType.Info);
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Add or select a new field to customise world areas.", MessageType.Info);
            }
            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #28
0
        public static void GlobalPlaylist(Rect fullArea, Rect leftArea, Rect mainArea)
        {
            GUI.Box(fullArea, "", "backgroundBox");
            GUILayout.BeginArea(fullArea);
            playlistScrollPos = GUILayout.BeginScrollView(playlistScrollPos);
            RPGMakerGUI.Title("Global Music Playlist");
            RPGMakerGUI.SubTitle("Audio Options");
            Audio.PlayThroughSceneSwitch = RPGMakerGUI.Toggle("Persist Through Scenes?", Audio.PlayThroughSceneSwitch,
                                                              GUILayout.Width(300));

            Audio.LoadAllAudioOnLoad = RPGMakerGUI.Toggle("Load All Audio On Load?", Audio.LoadAllAudioOnLoad, GUILayout.Width(300));
            Audio.FadeOutMusic       = RPGMakerGUI.Toggle("Fade Out Tracks?", Audio.FadeOutMusic, GUILayout.Width(300));
            Audio.FadeOutTime        = RPGMakerGUI.FloatField("Fade Out Time:", Audio.FadeOutTime, 1, GUILayout.Width(300));
            Audio.FadeInMusic        = RPGMakerGUI.Toggle("Fade In Tracks?", Audio.FadeInMusic, GUILayout.Width(300));
            Audio.FadeInTime         = RPGMakerGUI.FloatField("Fade In Time:", Audio.FadeInTime, 1, GUILayout.Width(300));
            RPGMakerGUI.Toggle("Shuffle Playlist?", ref Audio.ShufflePlaylist, GUILayout.Width(300));
            var result = RPGMakerGUI.FoldoutToolBar(ref showPlaylist, "Global Playlist", new[] { "+ Music" });

            if (showPlaylist)
            {
                if (result == 0)
                {
                    Audio.GlobalPlaylist.Add(new AudioContainer());
                }
                GUILayout.Space(5);
                for (int index = 0; index < Audio.GlobalPlaylist.Count; index++)
                {
                    var music = Audio.GlobalPlaylist[index];
                    GUILayout.BeginHorizontal(GUILayout.Height(30));
                    GUILayout.Space(5);

                    music.Audio = RPGMakerGUI.AudioClipSelector("Music File:", music.Audio, ref music.AudioPath);

                    if (GUILayout.Button(RPGMakerGUI.DelIcon, "genericButton", GUILayout.Width(25), GUILayout.Height(25)))
                    {
                        Audio.GlobalPlaylist.Remove(music);
                        index--;
                    }
                    GUILayout.Space(5);
                    GUILayout.EndHorizontal();
                    GUILayout.Space(5);
                }

                if (Audio.GlobalPlaylist.Count == 0)
                {
                    EditorGUILayout.HelpBox("Click +Music to add bg music to be played when scene music is not found.", MessageType.Info);
                }
                RPGMakerGUI.EndFoldout();
            }

            if (RPGMakerGUI.Toggle("Unique scene music?", ref Audio.PlayUniqueMusicForScenes))
            {
                var battleResult = RPGMakerGUI.FoldoutToolBar(ref showScenePlaylists, "Scene Playlists", new[] { "+ Scene" });
                if (showScenePlaylists)
                {
                    if (battleResult == 0)
                    {
                        Audio.ScenePlaylists.Add(new SceneMusic());
                    }
                    GUILayout.Space(5);
                    for (int index = 0; index < Audio.ScenePlaylists.Count; index++)
                    {
                        var sceneMusic = Audio.ScenePlaylists[index];
                        GUILayout.BeginHorizontal(GUILayout.Height(30));
                        GUILayout.Space(5);

                        sceneMusic.Music.Audio = RPGMakerGUI.AudioClipSelector("Music File:", sceneMusic.Music.Audio, ref sceneMusic.Music.AudioPath);
                        sceneMusic.SceneName   = RPGMakerGUI.SceneSelector("Scene:", ref sceneMusic.SceneName);

                        if (GUILayout.Button(RPGMakerGUI.DelIcon, "genericButton", GUILayout.Width(25), GUILayout.Height(25)))
                        {
                            Audio.ScenePlaylists.Remove(sceneMusic);
                            index--;
                        }
                        GUILayout.Space(5);
                        GUILayout.EndHorizontal();
                        GUILayout.Space(5);
                    }

                    if (Audio.ScenePlaylists.Count == 0)
                    {
                        EditorGUILayout.HelpBox("Click +Music to add music to be played during battles.", MessageType.Info);
                    }
                    RPGMakerGUI.EndFoldout();
                }
            }

            if (RPGMakerGUI.Toggle("Unique battle music?", ref Audio.PlayUniqueMusicForBattles))
            {
                var battleResult = RPGMakerGUI.FoldoutToolBar(ref showBattlePlaylist, "Battle Playlist", new[] { "+ Music" });
                if (showBattlePlaylist)
                {
                    if (battleResult == 0)
                    {
                        Audio.BattlePlaylist.Add(new AudioContainer());
                    }
                    GUILayout.Space(5);
                    for (int index = 0; index < Audio.BattlePlaylist.Count; index++)
                    {
                        var music = Audio.BattlePlaylist[index];
                        GUILayout.BeginHorizontal(GUILayout.Height(30));
                        GUILayout.Space(5);

                        music.Audio = RPGMakerGUI.AudioClipSelector("Music File:", music.Audio, ref music.AudioPath);

                        if (GUILayout.Button(RPGMakerGUI.DelIcon, "genericButton", GUILayout.Width(25), GUILayout.Height(25)))
                        {
                            Audio.BattlePlaylist.Remove(music);
                            index--;
                        }
                        GUILayout.Space(5);
                        GUILayout.EndHorizontal();
                        GUILayout.Space(5);
                    }

                    if (Audio.BattlePlaylist.Count == 0)
                    {
                        EditorGUILayout.HelpBox("Click +Music to add music to be played during battles.", MessageType.Info);
                    }
                    RPGMakerGUI.EndFoldout();
                }
            }

            if (RPGMakerGUI.Toggle("Unique music on Player Death?", ref Audio.PlayUniqueMusicForDeath))
            {
                Audio.DeathMusic.Audio = RPGMakerGUI.AudioClipSelector("- Music File:", Audio.DeathMusic.Audio, ref Audio.DeathMusic.AudioPath);
            }

            GUILayout.EndScrollView();
            GUILayout.EndArea();
        }
コード例 #29
0
        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);
        }