Пример #1
0
 internal static void Add(ModMenu modMenu)
 {
     lock (menus) {
         menus.Add(modMenu);
         ModTypeLookup <ModMenu> .Register(modMenu);
     }
 }
Пример #2
0
 private static void OffsetModMenu(int offset)
 {
     lock (menus) {
         switchToMenu = currentMenu;
         do
         {
             switchToMenu = menus[Utils.Repeat(menus.IndexOf(switchToMenu) + offset, menus.Count)];
         } while (!switchToMenu.IsAvailable);
     }
 }
Пример #3
0
        internal static void GotoSavedModMenu()
        {
            if (LastSelectedModMenu == MenuOldVanilla.MenuName)
            {
                Main.instance.playOldTile = true;                 // If the previous menu was the 1.3.5.3 one, automatically reactivate it.
            }

            switchToMenu = menus.SingleOrDefault(m => m.MenuName == LastSelectedModMenu && m.IsAvailable) ?? MenutML;
            loading      = false;
        }
Пример #4
0
        internal static void GotoSavedModMenu()
        {
            if (LastSelectedModMenu == MenuOldVanilla.FullName)
            {
                Main.instance.playOldTile = true;                 // If the previous menu was the 1.3.5.3 one, automatically reactivate it.
            }

            switchToMenu = MenutML;
            if (ModContent.TryFind(LastSelectedModMenu, out ModMenu value) && value.IsAvailable)
            {
                switchToMenu = value;
            }

            loading = false;
        }
Пример #5
0
        internal static void UpdateAndDrawModMenu(SpriteBatch spriteBatch, GameTime gameTime, Color color, float logoRotation, float logoScale)
        {
            if (switchToMenu != null && switchToMenu != currentMenu)
            {
                currentMenu.OnDeselected();
                currentMenu = switchToMenu;
                currentMenu.OnSelected();
                if (currentMenu.IsNew)
                {
                    currentMenu.IsNew = false;
                    AddKnownMenu(currentMenu.FullName);
                }
            }
            switchToMenu = null;

            if (!loading && currentMenu.FullName != LastSelectedModMenu)
            {
                LastSelectedModMenu = currentMenu.FullName;
                Main.SaveSettings();
            }

            currentMenu.UserInterface.Update(gameTime);
            currentMenu.UserInterface.Draw(spriteBatch, gameTime);
            currentMenu.Update(Main.menuMode == 0);

            Texture2D logo        = currentMenu.Logo.Value;
            Vector2   logoDrawPos = new Vector2(Main.screenWidth / 2, 100f);
            float     scale       = 1;

            if (currentMenu.PreDrawLogo(spriteBatch, ref logoDrawPos, ref logoRotation, ref scale, ref color))
            {
                spriteBatch.Draw(logo, logoDrawPos, new Rectangle(0, 0, logo.Width, logo.Height), color, logoRotation, new Vector2(logo.Width * 0.5f, logo.Height * 0.5f), logoScale * (currentMenu is MenutML ? 0.84f : scale), SpriteEffects.None, 0f);
            }
            currentMenu.PostDrawLogo(spriteBatch, logoDrawPos, logoRotation, scale, color);

            int newMenus;

            lock (menus) {
                var knownMenus = KnownMenus;
                foreach (ModMenu menu in menus)
                {
                    menu.IsNew = menu.IsAvailable && !knownMenus.Contains(menu.FullName);
                }
                newMenus = menus.Count(m => m.IsNew);
            }

            string text = $"{Language.GetTextValue("tModLoader.ModMenuSwap")}: {currentMenu.DisplayName}{(newMenus == 0 ? "" : ModLoader.notifyNewMainMenuThemes ? $" ({newMenus} New)" : "")}";
Пример #6
0
 public static void ActivateOldVanillaMenu()
 {
     switchToMenu = MenuOldVanilla;
 }
Пример #7
0
 internal static void Add(ModMenu modMenu)
 {
     lock (menus) {
         menus.Add(modMenu);
     }
 }