-
Notifications
You must be signed in to change notification settings - Fork 0
/
BetterBanners.cs
75 lines (65 loc) · 1.83 KB
/
BetterBanners.cs
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.DataStructures;
using Terraria.ModLoader;
using Terraria.GameContent.UI;
using Terraria.UI;
using BetterBanners.UI;
using System;
using System.IO;
using System.Collections.Generic;
namespace BetterBanners
{
class BetterBanners : Mod
{
internal FlagModifierUI flagModifierUI;
private UserInterface userInterface;
public static BetterBanners instance;
public BetterBanners()
{
/* TODO:
* MODIFY: {FlagItemSlot.cs / UIItemSlot.cs} -> Complete UI interface and allow the insertion/removal of a flag item
* CREATE: {BrannerItemSlot.cs} -> Allow the insertion/removal of a banner into a flag
* MODIFY: {Flag.cs} to be upgradeable and unlock up to 5 banner slots
* MODIFY: {FlagModifier.cs} to close the UI after moving the distance (done, but not implemented. connect modPlayer.OpenFlagModifier())
*/
}
public override void Load()
{
instance = this;
flagModifierUI = new FlagModifierUI();
flagModifierUI.Activate();
userInterface = new UserInterface();
userInterface.SetState(flagModifierUI);
}
public override void UpdateUI(GameTime gameTime)
{
if (userInterface != null && FlagModifierUI.visible)
userInterface.Update(gameTime);
}
public override void ModifyInterfaceLayers(List<GameInterfaceLayer> layers)
{
int MouseTextIndex = layers.FindIndex(layer => layer.Name.Equals("Vanilla: Mouse Text"));
if (MouseTextIndex != -1)
{
layers.Insert(MouseTextIndex, new LegacyGameInterfaceLayer(
"BetterBanners: Flag Modifier",
delegate
{
if (FlagModifierUI.visible)
{
flagModifierUI.Draw(Main.spriteBatch);
}
return true;
},
InterfaceScaleType.UI)
);
}
}
public override void Unload()
{
instance = null;
}
}
}