TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ UpdateAndDrawModMenu()

static void Terraria.ModLoader.MenuLoader.UpdateAndDrawModMenu ( SpriteBatch spriteBatch,
GameTime gameTime,
Color color,
float logoRotation,
float logoScale )
inlinestaticpackage

Definition at line 92 of file MenuLoader.cs.

93 {
94 //IL_014c: Unknown result type (might be due to invalid IL or missing references)
95 //IL_014f: Unknown result type (might be due to invalid IL or missing references)
96 //IL_0100: Unknown result type (might be due to invalid IL or missing references)
97 //IL_010f: Unknown result type (might be due to invalid IL or missing references)
98 //IL_0119: Unknown result type (might be due to invalid IL or missing references)
99 //IL_0135: Unknown result type (might be due to invalid IL or missing references)
100 //IL_026f: Unknown result type (might be due to invalid IL or missing references)
101 //IL_027a: Unknown result type (might be due to invalid IL or missing references)
102 //IL_0284: Unknown result type (might be due to invalid IL or missing references)
103 //IL_0289: Unknown result type (might be due to invalid IL or missing references)
104 //IL_02a1: Unknown result type (might be due to invalid IL or missing references)
105 //IL_02b8: Unknown result type (might be due to invalid IL or missing references)
106 //IL_02c1: Unknown result type (might be due to invalid IL or missing references)
107 //IL_02c9: Unknown result type (might be due to invalid IL or missing references)
108 //IL_02d1: Unknown result type (might be due to invalid IL or missing references)
109 //IL_0292: Unknown result type (might be due to invalid IL or missing references)
110 //IL_02d6: Unknown result type (might be due to invalid IL or missing references)
111 //IL_035c: Unknown result type (might be due to invalid IL or missing references)
112 //IL_0364: Unknown result type (might be due to invalid IL or missing references)
113 //IL_036c: Unknown result type (might be due to invalid IL or missing references)
114 //IL_0393: Unknown result type (might be due to invalid IL or missing references)
115 //IL_038c: Unknown result type (might be due to invalid IL or missing references)
116 //IL_039d: Unknown result type (might be due to invalid IL or missing references)
117 //IL_03a2: Unknown result type (might be due to invalid IL or missing references)
118 //IL_03b1: Unknown result type (might be due to invalid IL or missing references)
119 if (switchToMenu != null && switchToMenu != currentMenu)
120 {
121 currentMenu.OnDeselected();
123 currentMenu.OnSelected();
124 if (currentMenu.IsNew)
125 {
126 currentMenu.IsNew = false;
127 AddKnownMenu(currentMenu.FullName);
128 }
129 }
130 switchToMenu = null;
131 if (!loading && currentMenu.FullName != LastSelectedModMenu)
132 {
134 Main.SaveSettings();
135 }
136 currentMenu.UserInterface.Update(gameTime);
137 currentMenu.UserInterface.Draw(spriteBatch, gameTime);
138 currentMenu.Update(Main.menuMode == 0);
139 Texture2D logo = currentMenu.Logo.Value;
140 Vector2 logoDrawPos = default(Vector2);
141 ((Vector2)(ref logoDrawPos))._002Ector((float)(Main.screenWidth / 2), 100f);
142 float scale = logoScale;
143 if (currentMenu.PreDrawLogo(spriteBatch, ref logoDrawPos, ref logoRotation, ref scale, ref color))
144 {
145 spriteBatch.Draw(logo, logoDrawPos, (Rectangle?)new Rectangle(0, 0, logo.Width, logo.Height), color, logoRotation, new Vector2((float)logo.Width * 0.5f, (float)logo.Height * 0.5f), scale, (SpriteEffects)0, 0f);
146 }
147 currentMenu.PostDrawLogo(spriteBatch, logoDrawPos, logoRotation, scale, color);
148 int newMenus;
149 lock (menus)
150 {
151 string[] knownMenus = KnownMenus;
152 foreach (ModMenu menu in menus)
153 {
154 menu.IsNew = menu.IsAvailable && !knownMenus.Contains(menu.FullName);
155 }
156 newMenus = menus.Count((ModMenu m) => m.IsNew);
157 }
158 string text = Language.GetTextValue("tModLoader.ModMenuSwap") + ": " + currentMenu.DisplayName + ((newMenus == 0) ? "" : (ModLoader.notifyNewMainMenuThemes ? $" ({newMenus} New)" : ""));
159 Vector2 size = ChatManager.GetStringSize(FontAssets.MouseText.Value, ChatManager.ParseMessage(text, color).ToArray(), Vector2.One);
160 Rectangle switchTextRect = (Rectangle)((Main.menuMode == 0) ? new Rectangle((int)((float)(Main.screenWidth / 2) - size.X / 2f), (int)((float)(Main.screenHeight - 2) - size.Y), (int)size.X, (int)size.Y) : Rectangle.Empty);
161 if (((Rectangle)(ref switchTextRect)).Contains(Main.mouseX, Main.mouseY) && !Main.alreadyGrabbingSunOrMoon)
162 {
163 if (Main.mouseLeftRelease && Main.mouseLeft)
164 {
166 OffsetModMenu(1);
167 }
168 else if (Main.mouseRightRelease && Main.mouseRight)
169 {
171 OffsetModMenu(-1);
172 }
173 }
174 if (Main.menuMode == 0)
175 {
176 ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.MouseText.Value, text, new Vector2((float)switchTextRect.X, (float)switchTextRect.Y), (Color)(((Rectangle)(ref switchTextRect)).Contains(Main.mouseX, Main.mouseY) ? Main.OurFavoriteColor : new Color(120, 120, 120, 76)), 0f, Vector2.Zero, Vector2.One);
177 }
178 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static readonly SoundStyle MenuTick
Definition SoundID.cs:295
static string GetTextValue(string key)
Retrieves the text value for a specified localization key. The text returned will be for the currentl...
Definition Language.cs:35
Contains methods to access or retrieve localization values. The Localization Guideteaches more about ...
Definition Language.cs:12
static void AddKnownMenu(string name)
Definition MenuLoader.cs:41
static readonly List< ModMenu > menus
Definition MenuLoader.cs:23
static string LastSelectedModMenu
Definition MenuLoader.cs:33
static void OffsetModMenu(int offset)
Definition MenuLoader.cs:60
static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth=-1f, float spread=2f)
static Vector2 GetStringSize(DynamicSpriteFont font, string text, Vector2 baseScale, float maxWidth=-1f)
static List< TextSnippet > ParseMessage(string text, Color baseColor)

References Terraria.ModLoader.MenuLoader.AddKnownMenu(), Terraria.Main.alreadyGrabbingSunOrMoon, Terraria.ModLoader.MenuLoader.currentMenu, Terraria.UI.Chat.ChatManager.DrawColorCodedStringWithShadow(), Terraria.ModLoader.ModType< TEntity, TModType >.FullName, Terraria.UI.Chat.ChatManager.GetStringSize(), Terraria.Localization.Language.GetTextValue(), Terraria.ModLoader.MenuLoader.KnownMenus, Terraria.ModLoader.MenuLoader.LastSelectedModMenu, Terraria.ModLoader.MenuLoader.loading, Terraria.Main.menuMode, Terraria.ModLoader.MenuLoader.menus, Terraria.ID.SoundID.MenuTick, Terraria.Main.mouseLeft, Terraria.Main.mouseLeftRelease, Terraria.Main.mouseRight, Terraria.Main.mouseRightRelease, Terraria.GameContent.FontAssets.MouseText, Terraria.Main.mouseX, Terraria.Main.mouseY, Terraria.ModLoader.MenuLoader.OffsetModMenu(), Terraria.Main.OurFavoriteColor, Terraria.UI.Chat.ChatManager.ParseMessage(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Main.SaveSettings(), Terraria.Main.screenHeight, Terraria.Main.screenWidth, and Terraria.ModLoader.MenuLoader.switchToMenu.

Referenced by Terraria.Main.DrawMenu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: