Exemplo n.º 1
0
        public override void Unload()
        {
            if (!Main.dedServ)
            {
                concurrentTaskHandlerToken?.Cancel();
                concurrentTaskHandler?.Wait();
            }
            instance                   = null;
            translations               = null;
            itemChecklistInstance      = null;
            LootCache.instance         = null;
            ToggleRecipeBrowserHotKey  = null;
            QueryHoveredItemHotKey     = null;
            RecipeBrowserUI.instance   = null;
            RecipeCatalogueUI.instance = null;
            ItemCatalogueUI.instance   = null;
            BestiaryUI.instance        = null;
            CraftUI.instance           = null;
            RecipePath.Refresh(true);
            RecipeBrowserPlayer.seenTiles = null;

            UIElements.UIRecipeSlot.favoritedBackgroundTexture           = null;
            UIElements.UIRecipeSlot.selectedBackgroundTexture            = null;
            UIElements.UIRecipeSlot.ableToCraftBackgroundTexture         = null;
            UIElements.UIRecipeSlot.ableToCraftExtendedBackgroundTexture = null;
            UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture     = null;
            UIElements.UICheckbox.checkboxTexture  = null;
            UIElements.UICheckbox.checkmarkTexture = null;
            UIHorizontalGrid.moreLeftTexture       = null;
            UIHorizontalGrid.moreRightTexture      = null;
            Utilities.tileTextures = null;
        }
Exemplo n.º 2
0
        public override void Unload()
        {
            instance                   = null;
            translations               = null;
            itemChecklistInstance      = null;
            LootCache.instance         = null;
            ToggleRecipeBrowserHotKey  = null;
            QueryHoveredItemHotKey     = null;
            RecipeBrowserUI.instance   = null;
            RecipeCatalogueUI.instance = null;
            ItemCatalogueUI.instance   = null;
            BestiaryUI.instance        = null;
            CraftUI.instance           = null;
            RecipePath.Refresh(true);
            RecipeBrowserPlayer.seenTiles = null;

            UIElements.UIRecipeSlot.favoritedBackgroundTexture           = null;
            UIElements.UIRecipeSlot.selectedBackgroundTexture            = null;
            UIElements.UIRecipeSlot.ableToCraftBackgroundTexture         = null;
            UIElements.UIRecipeSlot.ableToCraftExtendedBackgroundTexture = null;
            UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture     = null;
            UIElements.UICheckbox.checkboxTexture  = null;
            UIElements.UICheckbox.checkmarkTexture = null;
            UIHorizontalGrid.moreLeftTexture       = null;
            UIHorizontalGrid.moreRightTexture      = null;
            Utilities.tileTextures = null;

            if (harmonyInstance != null)
            {
                harmonyInstance.UnpatchAll(HarmonyID);
            }
        }
Exemplo n.º 3
0
        // TODO, Chinese IME support
        public override void Load()
        {
            // Latest uses Mod.UpdateUI, added 0.10.1.2
            if (ModLoader.version < new Version(0, 10, 1, 2))
            {
                throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n");
            }

            instance = this;

            FieldInfo translationsField = typeof(Mod).GetField("translations", BindingFlags.Instance | BindingFlags.NonPublic);

            translations = (Dictionary <string, ModTranslation>)translationsField.GetValue(this);

            itemChecklistInstance = ModLoader.GetMod("ItemChecklist");
            if (itemChecklistInstance != null && itemChecklistInstance.Version < new Version(0, 2, 1))
            {
                itemChecklistInstance = null;
            }

            /*
             * Mod cheatSheet = ModLoader.GetMod("CheatSheet");
             * if (cheatSheet == null)
             * {
             */
            ToggleRecipeBrowserHotKey = RegisterHotKey("Toggle Recipe Browser", "OemCloseBrackets");
            QueryHoveredItemHotKey    = RegisterHotKey("Query Hovered Item", "Mouse3");

            /*
             *      CheatSheetLoaded = false;
             * }
             * else
             * {
             *      ToggleRecipeBrowserHotKey = null;
             *      CheatSheetLoaded = true;
             * }
             */
            if (!Main.dedServ /*&& !CheatSheetLoaded*/)
            {
                recipeBrowserTool = new RecipeBrowserTool();
                UIElements.UIRecipeSlot.favoritedBackgroundTexture       = GetTexture("Images/FavoritedOverlay");
                UIElements.UIRecipeSlot.selectedBackgroundTexture        = GetTexture("Images/SelectedOverlay");
                UIElements.UIRecipeSlot.ableToCraftBackgroundTexture     = GetTexture("Images/CanCraftBackground");
                UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture = GetTexture("Images/CanCraftBackground");
                UIElements.UICheckbox.checkboxTexture  = GetTexture("UIElements/checkBox");
                UIElements.UICheckbox.checkmarkTexture = GetTexture("UIElements/checkMark");
                UIHorizontalGrid.moreLeftTexture       = GetTexture("UIElements/MoreLeft");
                UIHorizontalGrid.moreRightTexture      = GetTexture("UIElements/MoreRight");
            }
        }
Exemplo n.º 4
0
        public override void Unload()
        {
            instance = null;
            itemChecklistInstance      = null;
            LootCache.instance         = null;
            ToggleRecipeBrowserHotKey  = null;
            RecipeBrowserUI.instance   = null;
            RecipeCatalogueUI.instance = null;
            ItemCatalogueUI.instance   = null;
            BestiaryUI.instance        = null;

            UIElements.UIRecipeSlot.favoritedBackgroundTexture       = null;
            UIElements.UIRecipeSlot.selectedBackgroundTexture        = null;
            UIElements.UIRecipeSlot.ableToCraftBackgroundTexture     = null;
            UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture = null;
            UIElements.UICheckbox.checkboxTexture  = null;
            UIElements.UICheckbox.checkmarkTexture = null;
        }
Exemplo n.º 5
0
        // TODO, Chinese IME support
        public override void Load()
        {
            // Too many people are downloading 0.10 versions on 0.9....
            if (ModLoader.version < new Version(0, 10))
            {
                throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n");
            }

            instance = this;
            itemChecklistInstance = ModLoader.GetMod("ItemChecklist");
            if (itemChecklistInstance != null && itemChecklistInstance.Version < new Version(0, 2, 1))
            {
                itemChecklistInstance = null;
            }

            /*
             * Mod cheatSheet = ModLoader.GetMod("CheatSheet");
             * if (cheatSheet == null)
             * {
             */
            ToggleRecipeBrowserHotKey = RegisterHotKey("Toggle Recipe Browser", "OemCloseBrackets");

            /*
             *      CheatSheetLoaded = false;
             * }
             * else
             * {
             *      ToggleRecipeBrowserHotKey = null;
             *      CheatSheetLoaded = true;
             * }
             */
            if (!Main.dedServ /*&& !CheatSheetLoaded*/)
            {
                recipeBrowserTool = new RecipeBrowserTool();
                UIElements.UIRecipeSlot.favoritedBackgroundTexture       = GetTexture("Images/FavoritedOverlay");
                UIElements.UIRecipeSlot.selectedBackgroundTexture        = GetTexture("Images/SelectedOverlay");
                UIElements.UIRecipeSlot.ableToCraftBackgroundTexture     = GetTexture("Images/CanCraftBackground");
                UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture = GetTexture("Images/CanCraftBackground");
                UIElements.UICheckbox.checkboxTexture  = GetTexture("UIElements/checkBox");
                UIElements.UICheckbox.checkmarkTexture = GetTexture("UIElements/checkMark");
            }
        }
Exemplo n.º 6
0
        public override void Unload()
        {
            instance                   = null;
            translations               = null;
            itemChecklistInstance      = null;
            LootCache.instance         = null;
            ToggleRecipeBrowserHotKey  = null;
            QueryHoveredItemHotKey     = null;
            RecipeBrowserUI.instance   = null;
            RecipeCatalogueUI.instance = null;
            ItemCatalogueUI.instance   = null;
            BestiaryUI.instance        = null;

            UIElements.UIRecipeSlot.favoritedBackgroundTexture       = null;
            UIElements.UIRecipeSlot.selectedBackgroundTexture        = null;
            UIElements.UIRecipeSlot.ableToCraftBackgroundTexture     = null;
            UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture = null;
            UIElements.UICheckbox.checkboxTexture  = null;
            UIElements.UICheckbox.checkmarkTexture = null;
            UIHorizontalGrid.moreLeftTexture       = null;
            UIHorizontalGrid.moreRightTexture      = null;
        }
 internal static string RBText(string key, string category = "RecipeCatalogueUI") => RecipeBrowser.RBText(category, key);
Exemplo n.º 8
0
 internal static string RBText(string key, string category = "BestiaryUI") => RecipeBrowser.RBText(category, key);
Exemplo n.º 9
0
        // TODO, Chinese IME support
        public override void Load()
        {
            // Latest uses UIProgress refactors.
            if (ModLoader.version < new Version(0, 11, 3))
            {
                throw new Exception("\nThis mod uses functionality only present in the latest tModLoader. Please update tModLoader to use this mod\n\n");
            }

            instance = this;

            // Remember, this mod is NOT open source, don't steal these TagHandlers.
            ChatManager.Register <TagHandlers.LinkTagHandler>("l", "link");
            ChatManager.Register <TagHandlers.ImageTagHandler>("image");
            ChatManager.Register <TagHandlers.NPCTagHandler>("npc");
            ChatManager.Register <TagHandlers.ItemHoverFixTagHandler>("itemhover");
            //ChatManager.Register<TagHandlers.URLTagHandler>("u", "url");

            FieldInfo translationsField = typeof(Mod).GetField("translations", BindingFlags.Instance | BindingFlags.NonPublic);

            translations = (Dictionary <string, ModTranslation>)translationsField.GetValue(this);

            itemChecklistInstance = ModLoader.GetMod("ItemChecklist");
            if (itemChecklistInstance != null && itemChecklistInstance.Version < new Version(0, 2, 1))
            {
                itemChecklistInstance = null;
            }

            /*
             * Mod cheatSheet = ModLoader.GetMod("CheatSheet");
             * if (cheatSheet == null)
             * {
             */
            ToggleRecipeBrowserHotKey = RegisterHotKey("Toggle Recipe Browser", "OemCloseBrackets");
            QueryHoveredItemHotKey    = RegisterHotKey("Query Hovered Item", "Mouse3");

            /*
             *      CheatSheetLoaded = false;
             * }
             * else
             * {
             *      ToggleRecipeBrowserHotKey = null;
             *      CheatSheetLoaded = true;
             * }
             */
            if (!Main.dedServ /*&& !CheatSheetLoaded*/)
            {
                recipeBrowserTool = new RecipeBrowserTool();
                UIElements.UIRecipeSlot.favoritedBackgroundTexture           = GetTexture("Images/FavoritedOverlay");
                UIElements.UIRecipeSlot.selectedBackgroundTexture            = GetTexture("Images/SelectedOverlay");
                UIElements.UIRecipeSlot.ableToCraftBackgroundTexture         = GetTexture("Images/CanCraftBackground");
                UIElements.UIRecipeSlot.ableToCraftExtendedBackgroundTexture = GetTexture("Images/CanCraftExtendedBackground");
                UIElements.UIMockRecipeSlot.ableToCraftBackgroundTexture     = GetTexture("Images/CanCraftBackground");
                UIElements.UICheckbox.checkboxTexture  = GetTexture("UIElements/checkBox");
                UIElements.UICheckbox.checkmarkTexture = GetTexture("UIElements/checkMark");
                UIHorizontalGrid.moreLeftTexture       = GetTexture("UIElements/MoreLeft");
                UIHorizontalGrid.moreRightTexture      = GetTexture("UIElements/MoreRight");
                Utilities.tileTextures = new Dictionary <int, Texture2D>();

                concurrentTaskHandlerToken = new CancellationTokenSource();
                concurrentTaskHandler      = Task.Run(() => ConcurrentTaskHandler());
            }

            Patches.Apply();
        }