示例#1
0
        /// <summary>
        /// Removes the delegates that handle the button click and draw method of the tab
        /// </summary>
        private void removeModOptionButtonFromMenu(object sender, EventArgsClickableMenuClosed e)
        {
            if (optionPageButton == null)
            {
                return;
            }

            GraphicsEvents.OnPostRenderEvent -= drawButton;
            ControlEvents.MouseChanged       -= optionPageButton.onLeftClick;
            optionPageButton = null;
        }
示例#2
0
        /// <summary>
        /// Attaches the delegates that handle the button click and draw method of the tab
        /// </summary>
        private void addModOptionButtonToMenu(object sender, EventArgsClickableMenuChanged e)
        {
            if (!(Game1.activeClickableMenu is GameMenu))
            {
                return;
            }

            // Remove before adding just for good measure
            GraphicsEvents.OnPostRenderEvent -= drawButton;
            GraphicsEvents.OnPostRenderEvent += drawButton;

            optionPageButton = new ModOptionsPageButton(this);

            var optionMenu = new ModOptionsPage(options);
            List <IClickableMenu> pages = ModEntry.helper.Reflection.GetPrivateField <List <IClickableMenu> >(Game1.activeClickableMenu, "pages").GetValue();

            pages.Add(optionMenu);
        }