예제 #1
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");
            }
        }
예제 #2
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");
            }
        }
예제 #3
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();
        }