public static void RenderMenu()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            GL.Label(RichText.MainCategoryFormat(Strings.GetText("mainCategory_BlueprintModding")));
            GL.FlexibleSpace();
            MenuTools.AddFavouriteButton("BlueprintModdingRender");
            GL.EndHorizontal();


            GL.BeginHorizontal();
            if (GL.Button(MenuTools.TextWithTooltip("misc_Enable", "tooltip_BlueprintModding", $"{ settings.toggleItemModding}" + " ", "", false), GL.ExpandWidth(false)))
            {
                if (settings.toggleItemModding == Storage.isFalseString)
                {
                    settings.toggleItemModding = Storage.isTrueString;
                    ModifiedBlueprintTools.Patch();
                }
                else if (settings.toggleItemModding == Storage.isTrueString)
                {
                    settings.toggleItemModding = Storage.isFalseString;
                }
            }
            GL.EndHorizontal();

            if (Strings.ToBool(settings.toggleItemModding))
            {
                MenuTools.SingleLineLabel(Strings.GetText("label_ItemModdingInfo"));

                GL.BeginHorizontal();
                if (GL.Button(new GUIContent("spacehamster's JSON Blueprint Dump on github", "https://github.com/spacehamster/KingmakerCustomBlueprints/releases/tag/blueprints"), GL.ExpandWidth(false)))
                {
                    Application.OpenURL("https://github.com/spacehamster/KingmakerCustomBlueprints/releases/tag/blueprints");
                }
                GL.EndHorizontal();

                GL.Space(10);

                GL.BeginHorizontal();
                if (GL.Button(MenuTools.TextWithTooltip("button_PatchManually", "tooltip_PatchManually", true), GL.ExpandWidth(false)))
                {
                    Patch();
                }
                GL.EndHorizontal();


                GL.Space(10);

                ItemTypesMenu();

                GL.Space(10);

                showModifiedBlueprints = GL.Toggle(showModifiedBlueprints, RichText.Bold(Strings.GetText("toggle_ShowModifiedItems")));
                if (showModifiedBlueprints)
                {
                    GL.Space(10);

                    GL.BeginHorizontal();
                    if (GL.Button(RichText.Bold(Strings.GetText("button_LoadRefresh")), GL.ExpandWidth(false)))
                    {
                        blueprintLists = false;
                    }
                    GL.EndHorizontal();

                    GL.Space(10);

                    try
                    {
                        if (!blueprintLists)
                        {
                            blueprintsPaths.Clear();
                            blueprintsNames.Clear();
                            blueprintsTypes.Clear();
                            string        path      = Storage.modEntryPath + Storage.modifiedBlueprintsFolder;
                            DirectoryInfo directory = new DirectoryInfo(path);
                            if (directory.GetFiles("*.json").Any())
                            {
                                foreach (FileInfo file in directory.GetFiles("*.json"))
                                {
                                    string json = File.ReadAllText(file.FullName);
                                    string guid = Path.GetFileNameWithoutExtension(file.Name);

                                    if (guid == "Example" && directory.GetFiles("*.json").Count() == 1)
                                    {
                                        MenuTools.SingleLineLabel(Strings.GetText("message_NoModItems"));
                                        continue;
                                    }
                                    else if (guid == "Example" && directory.GetFiles("*.json").Count() > 1)
                                    {
                                        continue;
                                    }

                                    BlueprintScriptableObject blueprintScriptableObject = Utilities.GetBlueprintByGuid <BlueprintScriptableObject>(guid);

                                    if (blueprintScriptableObject != null)
                                    {
                                        if (blueprintItemCategory.Contains(blueprintScriptableObject.GetType()) || blueprintTypeArmourCategory.Contains(blueprintScriptableObject.GetType()) || blueprintScriptableObject.GetType() == blueprintWeaponType)
                                        {
                                            blueprintsPaths.Add(file.FullName);
                                            blueprintsNames.Add(blueprintScriptableObject.name);
                                            blueprintsTypes.Add(blueprintScriptableObject.GetType().ToString());
                                        }
                                    }
                                }
                            }
                            blueprintLists = true;
                        }

                        if (blueprintsPaths.Any())
                        {
                            for (int i = 0; i < blueprintsPaths.Count(); i++)
                            {
                                GL.BeginVertical("box");
                                GL.BeginHorizontal();
                                GL.Label(blueprintsNames[i] + $" ({blueprintsTypes[i]})");
                                GL.FlexibleSpace();
                                if (GL.Button(MenuTools.TextWithTooltip("button_RemoveItemModification", "misc_RequiresRestart", true), GL.ExpandWidth(false)))
                                {
                                    try
                                    {
                                        blueprintLists = false;
                                        File.Delete(blueprintsPaths[i]);
                                    }
                                    catch (Exception e)
                                    {
                                        modLogger.Log(e.ToString());
                                    }
                                }
                                GL.EndHorizontal();
                                GL.EndVertical();
                            }
                        }
                        else
                        {
                            MenuTools.SingleLineLabel(Strings.GetText("message_NoModItems"));
                        }
                    }
                    catch (Exception e)
                    {
                        modLogger.Log(e.ToString());
                    }
                }
            }
            GL.EndVertical();
        }
        public static void Render()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            GL.Label(RichTextUtils.MainCategoryFormat(Strings.GetText("mainCategory_DevTools")));
            GL.FlexibleSpace();
            MenuTools.AddFavouriteButton("DevToolsRender");
            GL.EndHorizontal();

            MenuTools.ToggleButton(ref settings.toggleDevTools, "misc_Enable", "tooltip_DevTools", () => {
                ToggleUberLoggerTrue();
            }, () => {
                ToggleUberLoggerFalse();
            });

            if (StringUtils.ToToggleBool(settings.toggleDevTools))
            {
                MenuTools.SingleLineLabel(Strings.GetText("label_SmartConsoleInfo"));
                GL.Space(10);
                MenuTools.ToggleButton(ref settings.toggleDevToolsLogToUmm, "buttonToggle_LogToUMM", "tooltip_LogToUMM");
                GL.Space(10);
                if (GL.Button(MenuTools.TextWithTooltip("buttonToggle_UberLogger", "tooltip_UberLogger", $"{settings.toggleUberLogger}" + " "), GL.ExpandWidth(false)))
                {
                    if (settings.toggleUberLogger == Storage.isFalseString)
                    {
                        ToggleUberLoggerTrue();
                    }
                    else if (settings.toggleUberLogger == Storage.isTrueString)
                    {
                        ToggleUberLoggerFalse();
                    }
                }
                if (StringUtils.ToToggleBool(settings.toggleUberLogger))
                {
                    if (GL.Button(MenuTools.TextWithTooltip("buttonToggle_UberLoggerForward", "tooltip_UberLoggerForward", $"{settings.toggleUberLoggerForward}" + " "), GL.ExpandWidth(false)))
                    {
                        if (settings.toggleUberLoggerForward == Storage.isFalseString)
                        {
                            UberLogger.Logger.ForwardMessages = true;
                            settings.toggleUberLoggerForward  = Storage.isTrueString;
                        }
                        else if (settings.toggleUberLogger == Storage.isTrueString)
                        {
                            UberLogger.Logger.ForwardMessages      = false;
                            settings.toggleUberLoggerForwardPrefix = Storage.isFalseString;
                            settings.toggleUberLoggerForward       = Storage.isFalseString;
                        }
                    }
                    if (StringUtils.ToToggleBool(settings.toggleUberLoggerForward))
                    {
                        MenuTools.ToggleButton(ref settings.toggleUberLoggerForwardPrefix, "buttonToggle_UberLoggerForwardPrefix", "tooltip_UberLoggerForwardPrefix");
                    }
                }

                if (settings.settingShowDebugInfo)
                {
                    GL.Space(10);
                    MenuTools.SingleLineLabel("Application.persistentDataPath: " + UnityEngine.Application.persistentDataPath);
                    MenuTools.SingleLineLabel("UberLogger.Logger.Enable: " + UberLogger.Logger.Enabled);
                    MenuTools.SingleLineLabel("UberLogger.Logger.ForwardMessages: " + UberLogger.Logger.ForwardMessages);
                }
            }
            GL.EndVertical();
        }
Пример #3
0
        public static void RenderMenu()
        {
            GL.BeginVertical("box");
            GL.BeginHorizontal();
            GL.Label(RichText.MainCategoryFormat(Strings.GetText("label_ActionKey")));
            GL.FlexibleSpace();
            MenuTools.AddFavouriteButton("ActionKeyRender");
            GL.EndHorizontal();

            GL.BeginHorizontal();
            if (GL.Button(
                    MenuTools.TextWithTooltip("misc_Enable", "tooltip_ActionKey", $"{settings.toggleEnableActionKey}" + " ",
                                              ""), GL.ExpandWidth(false)))
            {
                if (settings.toggleEnableActionKey == Storage.isFalseString)
                {
                    settings.toggleEnableActionKey = Storage.isTrueString;
                    settings.actionKeyIndex        = 0;
                    settings.actionKeyKillIndex    = 0;
                }
                else if (settings.toggleEnableActionKey == Storage.isTrueString)
                {
                    settings.toggleEnableActionKey = Storage.isFalseString;
                    settings.actionKeyIndex        = 0;
                    settings.actionKeyKillIndex    = 0;
                }
            }

            GL.EndHorizontal();

            if (settings.toggleEnableActionKey == Storage.isTrueString)
            {
                GL.Space(10);

                GL.BeginHorizontal();
                GL.Label(Strings.GetText("label_ActionKey") + ": ", GL.ExpandWidth(false));
                MenuTools.SetKeyBinding(ref settings.actionKey);
                GL.EndHorizontal();

                GL.Space(10);

                GL.BeginHorizontal();
                if (GL.Button(
                        MenuTools.TextWithTooltip("label_ActionKeyEnableExperimental",
                                                  "tooltip_ActionKeyEnableExperimental", $"{settings.toggleActionKeyExperimental}" + " ", ""),
                        GL.ExpandWidth(false)))
                {
                    if (settings.toggleActionKeyExperimental == Storage.isFalseString)
                    {
                        settings.toggleActionKeyExperimental = Storage.isTrueString;
                        settings.actionKeyIndex     = 0;
                        settings.actionKeyKillIndex = 0;
                    }
                    else if (settings.toggleActionKeyExperimental == Storage.isTrueString)
                    {
                        settings.toggleActionKeyExperimental = Storage.isFalseString;
                        settings.actionKeyIndex     = 0;
                        settings.actionKeyKillIndex = 0;
                    }
                }

                GL.EndHorizontal();

                MenuTools.SingleLineLabel(RichText.Bold(Strings.GetText("warning_ActionKeyExperimentalMode")));

                GL.BeginHorizontal();
                if (!Strings.ToBool(settings.toggleActionKeyExperimental))
                {
                    settings.actionKeyIndex = GL.SelectionGrid(settings.actionKeyIndex, mainArray, 3);
                }
                else
                {
                    settings.actionKeyIndex = GL.SelectionGrid(settings.actionKeyIndex, mainExperimentalArray, 3);
                }
                GL.EndHorizontal();

                GL.Space(10);

                switch (settings.actionKeyIndex)
                {
                case 1:
                    MenuTools.ToggleButton(ref settings.toggleActionKeyLogInfo, "buttonToggle_LogInfoToFile",
                                           "tooltip_LogInfoToFile");
                    MenuTools.ToggleButton(ref settings.toggleActionKeyShowUnitInfoBox,
                                           "buttonToggle_ShowUnitInfoBox", "tooltip_ShowUnitInfoBox");

                    break;

                case 2:
                    if (Strings.ToBool(settings.toggleActionKeyExperimental))
                    {
                        GL.Space(10);
                        GL.BeginHorizontal();
                        settings.actionKeyKillIndex =
                            GL.SelectionGrid(settings.actionKeyKillIndex, experimentalKillArray, 3);
                        GL.EndHorizontal();
                    }

                    break;

                case 4:
                    if (!Storage.buffFavourites.Any())
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoFavourites"));
                    }
                    else
                    {
                        if (Storage.buffFavouritesLoad == true)
                        {
                            Main.RefreshBuffFavourites();
                            Storage.buffFavouritesLoad = false;
                        }

                        GL.Space(10);
                        GL.BeginHorizontal();
                        settings.actionKeyBuffIndex = GL.SelectionGrid(settings.actionKeyBuffIndex,
                                                                       Storage.buffFavouriteNames.ToArray(), 2);
                        GL.EndHorizontal();
                    }

                    if (Storage.buffFavourites != Storage.buffFavouritesGuids)
                    {
                        Storage.buffFavourites = Storage.buffFavouritesGuids;
                    }
                    break;

                case 5:
                    if (editUnit != null && editUnit.IsInGame && !editUnit.Descriptor.State.IsFinallyDead)
                    {
                        ActionKeyEditStatsGui(editUnit);
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 6:
                    if (teleportUnit != null && teleportUnit.IsInGame)
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("label_TeleportUnit") +
                                                  $": {teleportUnit.CharacterName}");
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 7:
                    if (Strings.ToBool(settings.toggleActionKeyExperimental))
                    {
                        settings.actionKeySpawnRandomEnemy = GL.Toggle(settings.actionKeySpawnRandomEnemy,
                                                                       " " + Strings.GetText("toggle_SpawnRandomEnemy"), GL.ExpandWidth(false));
                    }

                    GL.Space(10);

                    MenuTools.SingleLineLabel(Strings.GetText("label_ChallengeRating") + " " +
                                              Strings.Parenthesis(Strings.GetText("misc_Bandit")));
                    GL.BeginHorizontal();
                    banidtCrIndex = GL.SelectionGrid(banidtCrIndex, numberArray0t7, 8);
                    GL.EndHorizontal();

                    break;

                case 8:
                    if (rotateUnit != null && rotateUnit.IsInGame)
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("arrayItem_ActionKeyMain_RotateUnit") +
                                                  $": {rotateUnit.CharacterName}");
                    }
                    else
                    {
                        MenuTools.SingleLineLabel(Strings.GetText("message_NoUnitSelected"));
                    }
                    break;

                case 9:
                    if (load)
                    {
                        animationTypes.Clear();
                        animationTypesNames.Clear();
                        foreach (var animation in (UnitAnimationType[])Enum.GetValues(typeof(UnitAnimationType)))
                        {
                            animationTypes.Add(animation);
                            animationTypesNames.Add(animation.ToString());
                        }

                        load = false;
                    }

                    GL.BeginHorizontal();
                    animationTypesIndex = GL.SelectionGrid(animationTypesIndex, animationTypesNames.ToArray(), 3);
                    GL.EndHorizontal();
                    break;

                case 13:
                    MenuTools.SingleLineLabel(Strings.GetText("message_RecreateUnitDescriptor"));
                    break;
                }
            }

            GL.EndVertical();
        }