internal static MenuScreen GetMenu(MenuScreen lastMenu, ModToggleDelegates?toggleDelegates)
 {
     if (MenuRef == null)
     {
         MenuRef = PrepareMenu((ModToggleDelegates)toggleDelegates);
     }
     MenuRef.OnBuilt += (_, Element) => {
         SetPreloadButton();
         SetDumpButton();
         if (SkinManager.CurrentSkin != null)
         {
             BetterMenu.SelectedSkin(SkinManager.CurrentSkin.GetId());
         }
     };
     return(MenuRef.GetMenuScreen(lastMenu));
 }
        /// <summary>
        ///     Change the current skin, to the one whose id is provided.
        /// </summary>
        /// <param name="id">a <c>string</c> that uniquely identifies the skin</param>
        public static void SetSkinById(string id)
        {
            var Skin = GetSkinById(id);

            CustomKnight.Instance.Log("Trying to apply skin :" + Skin.GetId());
            if (CurrentSkin != null && CurrentSkin.GetId() == Skin.GetId())
            {
                return;
            }
            CurrentSkin = Skin;
            BetterMenu.SelectedSkin(SkinManager.CurrentSkin.GetId());
            // use this when saving so you save to the right settings
            if (GameManager.instance.IsNonGameplayScene())
            {
                CustomKnight.GlobalSettings.DefaultSkin = CurrentSkin.GetId();
            }
            else
            {
                CustomKnight.GlobalSettings.DefaultSkin = CurrentSkin.GetId();
                CustomKnight.SaveSettings.DefaultSkin   = CurrentSkin.GetId();
            };
            RefreshSkin(false);
            OnSetSkin?.Invoke(CustomKnight.Instance, new EventArgs());
        }