-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathWingSlotSystem.cs
More file actions
52 lines (44 loc) · 1.54 KB
/
WingSlotSystem.cs
File metadata and controls
52 lines (44 loc) · 1.54 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
44
45
46
47
48
49
50
51
52
using CustomSlot.UI;
using Microsoft.Xna.Framework;
using System.Collections.Generic;
using Terraria;
using Terraria.ModLoader;
using Terraria.UI;
namespace WingSlot {
public class WingSlotSystem : ModSystem {
public static AccessorySlotsUI UI;
private UserInterface wingSlotInterface;
public override void Load() {
if(!Main.dedServ) {
wingSlotInterface = new UserInterface();
UI = new AccessorySlotsUI();
UI.Activate();
wingSlotInterface.SetState(UI);
}
}
public override void Unload() {
UI = null;
}
public override void UpdateUI(GameTime gameTime) {
if(UI.IsVisible) {
wingSlotInterface?.Update(gameTime);
}
}
public override void ModifyInterfaceLayers(List<GameInterfaceLayer> layers) {
int inventoryLayer = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Inventory"));
if(inventoryLayer != -1) {
layers.Insert(
inventoryLayer,
new LegacyGameInterfaceLayer(
"Wing Slot: Custom Slot UI",
() => {
if(UI.IsVisible) {
wingSlotInterface.Draw(Main.spriteBatch, new GameTime());
}
return true;
},
InterfaceScaleType.UI));
}
}
}
}