Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
            }
        }