コード例 #1
0
 /// <summary>
 /// If the opened menu was a crafting menu, call the handler to load the menu.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MenuChanged_Event(object sender, EventArgsClickableMenuChanged e)
 {
     if (!Context.IsWorldReady)
     {
         return;
     }
     //Replace menu if the new menu has the attribute cooking set to true and the new menu is not my crafting page.
     if (e.NewMenu != null &&
         Helper.Reflection.GetField <bool>(e.NewMenu, "cooking", false) != null &&
         Helper.Reflection.GetField <bool>(e.NewMenu, "cooking").GetValue() &&
         !(e.NewMenu is RemoteFridgeCraftingPage))
     {
         _handler.LoadMenu(e);
     }
 }
コード例 #2
0
        /// <summary>Raised after a game menu is opened, closed, or replaced.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void OnMenuChanged(object sender, MenuChangedEventArgs e)
        {
            if (!Context.IsWorldReady)
            {
                return;
            }

            // If the opened menu was a crafting menu, call the handler to load the menu.
            //Replace menu if the new menu has the attribute cooking set to true and the new menu is not my crafting page.
            if (e.NewMenu != null &&
                Helper.Reflection.GetField <bool>(e.NewMenu, "cooking", false) != null &&
                Helper.Reflection.GetField <bool>(e.NewMenu, "cooking").GetValue() &&
                !(e.NewMenu is RemoteFridgeCraftingPage))
            {
                _handler.LoadMenu(e.NewMenu);
            }
        }