Ejemplo n.º 1
0
        public static void OnGUI()
        {
            var characters = PartyEditor.GetCharacterList();

            if (characters == null)
            {
                return;
            }
            UI.ActionSelectionGrid(ref selectedIndex,
                                   characters.Select((ch) => ch.CharacterName).ToArray(),
                                   8,
                                   (index) => { BlueprintBrowser.UpdateSearchResults(); },
                                   UI.MinWidth(200));
            var selectedCharacter = GetSelectedCharacter();

            if (selectedCharacter != null)
            {
                UI.Space(10);
                UI.HStack(null, 0, () => {
                    UI.Label($"{GetSelectedCharacter().CharacterName}".orange().bold(), UI.AutoWidth());
                    UI.Space(5);
                    UI.Label("will be used for adding/remove features, buffs, etc ".green());
                });
            }
        }
Ejemplo n.º 2
0
 static void ResetGUI(UnityModManager.ModEntry modEntry)
 {
     settings             = Settings.Load <Settings>(modEntry);
     settings.searchText  = "";
     settings.searchLimit = 100;
     CheapTricks.ResetGUI();
     PartyEditor.ResetGUI();
     CharacterPicker.ResetGUI();
     BlueprintBrowser.ResetGUI();
     QuestEditor.ResetGUI();
     caughtException = null;
 }
Ejemplo n.º 3
0
        static void OnGUI(UnityModManager.ModEntry modEntry)
        {
            Main.modEntry = modEntry;
            if (!Enabled)
            {
                return;
            }
            if (!IsInGame)
            {
                UI.Label("ToyBox has limited functionality from the main menu".yellow().bold());
            }
            try {
                Event e = Event.current;
                userHasHitReturn   = (e.keyCode == KeyCode.Return);
                focusedControlName = GUI.GetNameOfFocusedControl();

                if (caughtException != null)
                {
                    UI.Label("ERROR".red().bold() + $": caught exception {caughtException}");
                    UI.ActionButton("Reset".orange().bold(), () => { ResetGUI(modEntry); }, UI.AutoWidth());
                    return;
                }
#if false
                UI.Label("focused: "
                         + $"{GUI.GetNameOfFocusedControl()}".orange().bold()
                         + "(" + $"{GUIUtility.keyboardControl}".cyan().bold() + ")",
                         UI.AutoWidth());
#endif
                UI.TabBar(ref settings.selectedTab,
                          () => {
                    if (BlueprintBrowser.GetBlueprints() == null)
                    {
                        UI.Label("Blueprints".orange().bold() + " loading: " + BlueprintLoader.progress.ToString("P2").cyan().bold());
                    }
                    else
                    {
                        UI.Space(25);
                    }
                },
                          new NamedAction("Cheap Tricks", () => { CheapTricks.OnGUI(); }),
                          new NamedAction("Party Editor", () => { PartyEditor.OnGUI(); }),
                          new NamedAction("Search 'n Pick", () => { BlueprintBrowser.OnGUI(); }),
                          new NamedAction("Quest Editor", () => { QuestEditor.OnGUI(); })
                          );
            }
            catch (Exception e) {
                Console.Write($"{e}");
                caughtException = e;
            }
        }
Ejemplo n.º 4
0
 private static void ResetGUI(UnityModManager.ModEntry modEntry)
 {
     settings             = UnityModManager.ModSettings.Load <Settings>(modEntry);
     settings.searchText  = "";
     settings.searchLimit = 100;
     BagOfTricks.ResetGUI();
     LevelUp.ResetGUI();
     PartyEditor.ResetGUI();
     CrusadeEditor.ResetGUI();
     CharacterPicker.ResetGUI();
     BlueprintBrowser.ResetGUI();
     QuestEditor.ResetGUI();
     BlueprintExensions.ResetCollationCache();
     caughtException = null;
 }
Ejemplo n.º 5
0
        public static List <BlueprintScriptableObject> BlueprintsOfType(Type type)
        {
            if (blueprintsByType.ContainsKey(type))
            {
                return(blueprintsByType[type]);
            }
            var blueprints = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return(new List <BlueprintScriptableObject>());
            }
            var filtered = blueprints.Where((bp) => bp.GetType().IsKindOf(type)).ToList();

            blueprintsByType[type] = filtered;
            return(filtered);
        }
Ejemplo n.º 6
0
        static public void OnGUI(UnitEntityData ch, List <Spellbook> spellbooks)
        {
            var blueprints = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return;
            }
            OnGUI <Spellbook>("Spellbooks", ch, spellbooks,
                              (sb) => sb.Blueprint,
                              BlueprintExensions.GetBlueprints <BlueprintSpellbook>(),
                              (sb) => sb.Blueprint.GetDisplayName(),
                              (sb) => sb.Blueprint.GetDescription(),
                              null,
                              BlueprintAction.ActionsForType(typeof(BlueprintSpellbook))
                              );
        }
Ejemplo n.º 7
0
        static public void OnGUI(UnitEntityData ch, List <Ability> facts)
        {
            var blueprints = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return;
            }
            OnGUI <Ability>("Abilities", ch, facts,
                            (fact) => fact.Blueprint,
                            BlueprintExensions.GetBlueprints <BlueprintAbility>().Where((bp) => !((BlueprintAbility)bp).IsSpell),
                            (fact) => fact.Name,
                            (fact) => fact.Description,
                            (fact) => fact.GetRank(),
                            BlueprintAction.ActionsForType(typeof(BlueprintAbility))
                            );
        }
Ejemplo n.º 8
0
        static public void OnGUI(UnitEntityData ch, List <Buff> facts)
        {
            var blueprints = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return;
            }
            OnGUI <Buff>("Features", ch, facts,
                         (fact) => fact.Blueprint,
                         BlueprintExensions.GetBlueprints <BlueprintBuff>(),
                         (fact) => fact.Name,
                         (fact) => fact.Description,
                         (fact) => fact.GetRank(),
                         BlueprintAction.ActionsForType(typeof(BlueprintBuff))
                         );
        }
Ejemplo n.º 9
0
        public static List <BlueprintScriptableObject> BlueprintsOfType <BPType>() where BPType : BlueprintScriptableObject
        {
            var type = typeof(BPType);

            if (blueprintsByType.ContainsKey(type))
            {
                return(blueprintsByType[type]);
            }
            var blueprints = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return(new List <BlueprintScriptableObject>());
            }
            var filtered = blueprints.Where((bp) => (bp is BPType) ? true : false).ToList();

            blueprintsByType[type] = filtered;
            return(filtered);
        }
Ejemplo n.º 10
0
        static public void OnGUI(UnitEntityData ch, Spellbook spellbook, int level)
        {
            var spells      = spellbook.GetKnownSpells(level).OrderBy(d => d.Name).ToList();
            var spellbookBP = spellbook.Blueprint;
            var learnable   = spellbookBP.SpellList.GetSpells(level);
            var blueprints  = BlueprintBrowser.GetBlueprints();

            if (blueprints == null)
            {
                return;
            }
            OnGUI <AbilityData>($"Spells.{spellbookBP.Name}", ch, spells,
                                (fact) => fact.Blueprint,
                                learnable,
                                (fact) => fact.Name,
                                (fact) => fact.Description,
                                null,
                                BlueprintAction.ActionsForType(typeof(BlueprintAbility))
                                );
        }
Ejemplo n.º 11
0
        private static void OnGUI(UnityModManager.ModEntry modEntry)
        {
            if (!Enabled)
            {
                return;
            }
            IsModGUIShown = true;
            if (!IsInGame)
            {
                UI.Label("ToyBox has limited functionality from the main menu".yellow().bold());
            }
            if (!UI.IsWide)
            {
                UI.Label("Note ".magenta().bold() + "ToyBox was designed to offer the best user experience at widths of 1920 or higher. Please consider increasing your resolution up of at least 1920x1080 (ideally 4k) and go to Unity Mod Manager 'Settings' tab to change the mod window width to at least 1920.  Increasing the UI scale is nice too when running at 4k".orange().bold());
            }
            try {
                var e = Event.current;
                UI.userHasHitReturn   = e.keyCode == KeyCode.Return;
                UI.focusedControlName = GUI.GetNameOfFocusedControl();
                if (caughtException != null)
                {
                    UI.Label("ERROR".red().bold() + $": caught exception {caughtException}");
                    UI.ActionButton("Reset".orange().bold(), () => { ResetGUI(modEntry); }, UI.AutoWidth());
                    return;
                }
#if false
                using (UI.HorizontalScope()) {
                    UI.Label("Suggestions or issues click ".green(), UI.AutoWidth());
                    UI.LinkButton("here", "https://github.com/cabarius/ToyBox/issues");
                    UI.Space(50);
                    UI.Label("Chat with the Authors, Narria et all on the ".green(), UI.AutoWidth());
                    UI.LinkButton("WoTR Discord", "https://discord.gg/wotr");
                }
#endif
                UI.TabBar(ref settings.selectedTab,
                          () => {
                    if (BlueprintLoader.Shared.IsLoading)
                    {
                        UI.Label("Blueprints".orange().bold() + " loading: " + BlueprintLoader.Shared.progress.ToString("P2").cyan().bold());
                    }
                    else
                    {
                        UI.Space(25);
                    }
                },
                          new NamedAction("Bag of Tricks", () => BagOfTricks.OnGUI()),
                          new NamedAction("Level Up", () => LevelUp.OnGUI()),
                          new NamedAction("Party", () => PartyEditor.OnGUI()),
                          new NamedAction("Loot", () => PhatLoot.OnGUI()),
                          new NamedAction("Enchantment", () => EnchantmentEditor.OnGUI()),
#if false
                          new NamedAction("Playground", () => Playground.OnGUI()),
#endif
                          new NamedAction("Search 'n Pick", () => BlueprintBrowser.OnGUI()),
                          new NamedAction("Crusade", () => CrusadeEditor.OnGUI()),
                          new NamedAction("Armies", () => ArmiesEditor.OnGUI()),
                          new NamedAction("Events/Decrees", () => EventEditor.OnGUI()),
                          new NamedAction("Etudes", () => EtudesEditor.OnGUI()),
                          new NamedAction("Quests", () => QuestEditor.OnGUI()),
                          new NamedAction("Settings", () => SettingsUI.OnGUI())
                          );
            }
            catch (Exception e) {
                Console.Write($"{e}");
                caughtException = e;
            }
        }
Ejemplo n.º 12
0
 private static void ResetSearch() => BlueprintBrowser.ResetSearch();
Ejemplo n.º 13
0
 static void ResetSearch()
 {
     BlueprintBrowser.ResetSearch();
 }