-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.as
52 lines (43 loc) · 1 KB
/
Main.as
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
CGameCtnDecorationSize@ g_decorSize = null;
nat3 g_originalSize;
CreateUI g_createUI;
void OnEditorOpen()
{
}
void OnEditorClose()
{
if (g_decorSize !is null) {
g_decorSize.SizeX = g_originalSize.x;
g_decorSize.SizeY = g_originalSize.y;
g_decorSize.SizeZ = g_originalSize.z;
@g_decorSize = null;
}
}
void Main()
{
auto app = cast<CGameManiaPlanet>(GetApp());
bool inMapEditor = false;
while (true) {
g_createUI.Update();
yield();
auto editor = cast<CGameCtnEditorFree>(app.Editor);
if (!inMapEditor && editor !is null) {
inMapEditor = true;
OnEditorOpen();
} else if (inMapEditor && editor is null) {
inMapEditor = false;
OnEditorClose();
}
}
}
void RenderMenu()
{
bool canOpenAdvancedEditor = Permissions::OpenAdvancedMapEditor();
if (UI::MenuItem("\\$cf9" + Icons::Map + "\\$z Create a new map", "", g_createUI.m_visible, canOpenAdvancedEditor) && !g_createUI.m_visible) {
g_createUI.m_visible = !g_createUI.m_visible;
}
}
void RenderInterface()
{
g_createUI.Render();
}