-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCategoryWindow.cs
72 lines (61 loc) · 2.01 KB
/
CategoryWindow.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
using UnityEngine;
using System.Collections.Generic;
using BrokeProtocolClient.modules;
using BrokeProtocolClient.settings;
using BrokeProtocolClient.utils;
namespace BrokeProtocolClient.UI
{
class CategoryWindow : GuiWindow
{
protected static int index;
public Category category;
public readonly List<ModuleButton> moduleButtons = new List<ModuleButton>();
public CategoryWindow(Category category) : base(category.ToString())
{
this.category = category;
this.windowTitle = category.ToString();
int offset = headerPad;
foreach (Module module in Modules.instance.getModulesInCategory(category))
{
moduleButtons.Add(new ModuleButton(module, this, offset));
offset += controlHeight + pad;
controlIndex++;
}
init();
}
protected override void init()
{
windowSpace = new Rect((controlWidth + pad * 2) * index, 20, 100, 50);
windowIndex = rollingIndex;
index += 1;
rollingIndex++;
ResizeWindowToFitControls();
}
public void hideSettingWindows()
{
foreach (ModuleButton moduleButton in moduleButtons)
{
moduleButton.settingWindow.visible = false;
}
}
protected override void WindowCore()
{
foreach (ModuleButton button in moduleButtons)
{
button.onRender();
}
}
protected override void WindowWrapper(int id)
{
WindowCore();
GUI.DragWindow(new Rect(0, 0, Screen.width, Screen.height));
}
public override void onRender()
{
windowSpace = GUI.Window(windowIndex, windowSpace, this.WindowWrapper, windowTitle);
}
public override void onUpdate()
{
}
}
}