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; } }
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)) ); }