Skip to content

Commit 392128a

Browse files
committed
init comm
1 parent 39f72b9 commit 392128a

9 files changed

Lines changed: 1122 additions & 28 deletions

File tree

Core/Features/LoadUnloadSingleMod/LoadUnloadSingleMod.cs

Lines changed: 493 additions & 0 deletions
Large diffs are not rendered by default.

Core/Features/MainMenuFeatures/a.cs renamed to Core/Features/MainMenuFeatures/DrawBackToMainMenuSystem.cs

File renamed without changes.

Core/Features/MainMenuFeatures/MainMenuActions.cs

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
using System;
1+
using ModReloader.Core.Features.LoadUnloadSingleMod;
2+
using ModReloader.Core.Features.Reload;
3+
using System;
24
using System.Collections.Generic;
35
using System.Diagnostics;
46
using System.IO;
57
using System.Linq;
6-
using ModReloader.Core.Features.Reload;
8+
using System.Reflection;
9+
using System.Threading.Tasks;
710
using Terraria.GameContent.UI.States;
811
using Terraria.IO;
12+
using Terraria.ModLoader.Core;
913
using Terraria.Social;
1014
using Terraria.WorldBuilding;
1115
using static ModReloader.Common.Configs.Config;
@@ -209,5 +213,15 @@ public static void StartServer()
209213
return;
210214
}
211215
}
216+
217+
internal static void LoadSingleMod()
218+
{
219+
LoadUnloadSingleMod.LoadUnloadSingleMod.LoadSingleMod();
220+
}
221+
222+
internal static void UnloadSingleMod()
223+
{
224+
throw new NotImplementedException();
225+
}
212226
}
213227
}

Core/Features/MainMenuFeatures/MainMenuState.cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public MainMenuState()
5353
AddSingleplayerSection(tooltipPanel);
5454
AddMultiplayerSection(tooltipPanel);
5555
AddWorldSection(tooltipPanel);
56+
AddLoadUnloadSection(tooltipPanel);
5657

5758
Append(tooltipPanel);
5859
Append(mainMenuList);
@@ -230,6 +231,28 @@ private void AddWorldSection(TooltipPanel tooltipPanel)
230231
mainMenuList.Add(spacer);
231232
}
232233

234+
private void AddLoadUnloadSection(TooltipPanel tooltipPanel)
235+
{
236+
var loadUnloadHeader = new HeaderMainMenuElement(Loc.Get("MainMenu.LoadUnloadHeader"), () => Loc.Get("MainMenu.LoadUnloadTooltip"), tooltipPanel);
237+
var load = new ActionMainMenuElement(
238+
MainMenuActions.LoadSingleMod,
239+
Loc.Get("MainMenu.LoadMod"),
240+
() => Loc.Get("MainMenu.LoadModTooltip"),
241+
tooltipPanel
242+
);
243+
var unload = new ActionMainMenuElement(
244+
MainMenuActions.UnloadSingleMod,
245+
Loc.Get("MainMenu.UnloadMod"),
246+
() => Loc.Get("MainMenu.UnloadModTooltip"),
247+
tooltipPanel
248+
);
249+
var spacer = new SpacerMainMenuElement();
250+
mainMenuList.Add(loadUnloadHeader);
251+
mainMenuList.Add(load);
252+
mainMenuList.Add(unload);
253+
mainMenuList.Add(spacer);
254+
}
255+
233256
public override void Draw(SpriteBatch spriteBatch)
234257
{
235258
base.Draw(spriteBatch);

Core/Features/UIElementFeatures/UIElementState.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void DrawElementType(SpriteBatch spriteBatch, UIElement element, Point po
240240
textPosition += new Vector2(TypeXOffset, TypeYOffset);
241241
}
242242

243-
Utils.DrawBorderStringFourWay(
243+
Terraria.Utils.DrawBorderStringFourWay(
244244
spriteBatch,
245245
FontAssets.MouseText.Value,
246246
typeText,
@@ -284,7 +284,7 @@ public void DrawElementSize(SpriteBatch spriteBatch, UIElement element, Point po
284284
textPosition += new Vector2(SizeXOffset, SizeYOffset);
285285
}
286286

287-
Utils.DrawBorderStringFourWay(
287+
Terraria.Utils.DrawBorderStringFourWay(
288288
spriteBatch,
289289
FontAssets.MouseText.Value,
290290
text: sizeText,

0 commit comments

Comments
 (0)