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()); }); } }
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; }
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; } }
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; }
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); }
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)) ); }
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)) ); }
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)) ); }
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); }
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)) ); }
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; } }
private static void ResetSearch() => BlueprintBrowser.ResetSearch();
static void ResetSearch() { BlueprintBrowser.ResetSearch(); }