forked from Exxo-Avalon/AvalonTesting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAvalonMenu.cs
More file actions
43 lines (37 loc) · 1.24 KB
/
AvalonMenu.cs
File metadata and controls
43 lines (37 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System;
using System.Reflection;
using Microsoft.Xna.Framework.Graphics;
using ReLogic.Content;
using Terraria.ModLoader;
namespace Avalon;
public class AvalonMenu : ModMenu
{
public override Asset<Texture2D> Logo
{
get
{
if (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
{
return Mod.Assets.Request<Texture2D>($"{Avalon.TextureAssetsPath}/UI/EAOLogoAprilFools");
}
return Mod.Assets.Request<Texture2D>($"{Avalon.TextureAssetsPath}/UI/EAOLogo");
}
}
public override void Load()
{
base.Load();
const string lastSelectedModMenuFieldName = "LastSelectedModMenu";
FieldInfo? lastSelectedModMenuFieldInfo =
typeof(MenuLoader).GetField(lastSelectedModMenuFieldName, BindingFlags.NonPublic | BindingFlags.Static);
if (lastSelectedModMenuFieldInfo != null)
{
// Sets the menu to be initially set to Exxo Avalon's on game load
lastSelectedModMenuFieldInfo.SetValue(null, FullName);
}
else
{
Avalon.Mod.Logger.Error(
$"Could not find field with name {lastSelectedModMenuFieldName} in {typeof(MenuLoader)}");
}
}
}