-
-
Notifications
You must be signed in to change notification settings - Fork 51
/
Tool.cs
84 lines (72 loc) · 1.72 KB
/
Tool.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
76
77
78
79
80
81
82
83
84
using Microsoft.Xna.Framework;
using System;
using Terraria;
using Terraria.UI;
namespace RecipeBrowser
{
// UIState needs UserInterface for Scrollbar fixes
// Tool should store data? does it even matter?
internal abstract class Tool
{
//internal bool visible;
//internal string toggleTooltip;
internal UserInterface userInterface;
internal UIModState uistate;
// Type uistateType;
public Tool(Type uistateType)
{
userInterface = new UserInterface();
// this.uistateType = uistateType;
uistate = (UIModState)Activator.CreateInstance(uistateType, new object[] { userInterface });
//uistate = (UIModState)Activator.CreateInstance(uistateType);
//uistate = new LootUI(userInterface);
uistate.Activate();
//uistate.userInterface = userInterface;
userInterface.SetState(uistate);
}
/// <summary>
/// Initializes this Tool. Called during Load.
/// Useful for initializing data.
/// </summary>
internal virtual void Initialize()
{
}
/// <summary>
/// Initializes this Tool. Called during Load after Initialize only on SP and Clients.
/// Useful for initializing UI.
/// </summary>
internal virtual void ClientInitialize() { }
internal virtual void ScreenResolutionChanged()
{
userInterface?.Recalculate();
}
internal virtual void UIUpdate(GameTime gameTime)
{
//if (visible)
{
userInterface?.Update(gameTime);
}
}
internal virtual void UIDraw()
{
//if (visible)
{
uistate.ReverseChildren();
uistate.Draw(Main.spriteBatch);
uistate.ReverseChildren();
}
}
internal virtual void DrawUpdateToggle()
{
}
internal virtual void Toggled()
{
}
internal virtual void PostSetupContent()
{
if (!Main.dedServ)
{
}
}
}
}