forked from challenge-project/challenge-sandbox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLayers.Script.txt
150 lines (124 loc) · 4.15 KB
/
Layers.Script.txt
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
// Layers.Script.txt
// by BigBang1112
// part of Universe Library Set
// Layers library similar to Nadeo's one that supports CManiaApp.
// This library does not depend on any other library from the Universe Library Set.
// You can use this library independently, although it's recommended to use the whole set.
*/
/*
// Compatible contexts:
// - CManiaApp
*/
/*
// Boolean Exists(Text _LayerName)
// CUILayer Get(Text _LayerName)
// CUILayer Get(Ident _LayerId)
// Text GetName(Ident _LayerId)
// Text GetName(CUILayer _Layer)
// Void Destroy(Text _LayerName)
// Void DestroyAll()
// Void Create(Text _LayerName, Text _LayerManialink, Boolean IsVisible, CUILayer::EUILayerType _LayerType)
// Void Create(Text _LayerName, Text _LayerManialink, Boolean IsVisible)
// Void Create(Text _LayerName, Text _LayerManialink)
// Void Create(Text _LayerName)
// Void SetType(Text _LayerName, CUILayer::EUILayerType _LayerType)
// Void SetAnimationIn(Text _LayerName, CUILayer::EUILayerAnimation _Animation)
// Void SetAnimationOut(Text _LayerName, CUILayer::EUILayerAnimation _Animation)
// Void SetAnimationInOut(Text _LayerName, CUILayer::EUILayerAnimation _Animation)
// Void Show(Text _LayerName)
// Void ShowOnly(Text _LayerName)
// Void Hide(Text _LayerName)
// Void SendEvent(Text _LayerName, Text _Type, Text[] _Data)
// Void SendEvent(Text _LayerName, Text _Type, Text _Data)
// Void SendEvent(Text _LayerName, Text _Type)
*/
declare Ident[Text] G_Layers;
Boolean Exists(Text _LayerName) {
if(G_Layers.existskey(_LayerName)) return True;
return False;
}
CUILayer Get(Text _LayerName) {
if(Exists(_LayerName)) return UILayers[G_Layers[_LayerName]];
return Null;
}
CUILayer Get(Ident _LayerId) {
if(G_Layers.exists(_LayerId)) return UILayers[_LayerId];
return Null;
}
Text GetName(Ident _LayerId) {
if(G_Layers.exists(_LayerId)) return G_Layers.keyof(_LayerId);
return "";
}
Text GetName(CUILayer _Layer) {
if (_Layer == Null) return "";
return GetName(_Layer.Id);
}
Void Destroy(Text _LayerName) {
if(!Exists(_LayerName)) return;
UILayerDestroy(UILayers[G_Layers[_LayerName]]);
declare Removed = G_Layers.removekey(_LayerName);
}
Void DestroyAll() {
foreach(LayerName => LayerId in G_Layers) {
Destroy(LayerName);
}
}
Void Create(Text _LayerName, Text _LayerManialink, Boolean IsVisible, CUILayer::EUILayerType _LayerType) {
if(Exists(_LayerName)) Destroy(_LayerName);
declare NewLayer = UILayerCreate();
NewLayer.ManialinkPage = _LayerManialink;
NewLayer.IsVisible = IsVisible;
NewLayer.Type = _LayerType;
G_Layers[_LayerName] = NewLayer.Id;
}
Void Create(Text _LayerName, Text _LayerManialink, Boolean IsVisible) {
Create(_LayerName, _LayerManialink, IsVisible, CUILayer::EUILayerType::Normal);
}
Void Create(Text _LayerName, Text _LayerManialink) {
Create(_LayerName, _LayerManialink, False);
}
Void Create(Text _LayerName) {
Create(_LayerName, "", False);
}
Void SetType(Text _LayerName, CUILayer::EUILayerType _LayerType) {
declare Layer <=> Get(_LayerName);
if(Layer == Null) return;
Layer.Type = _LayerType;
}
Void SetAnimationIn(Text _LayerName, CUILayer::EUILayerAnimation _Animation) {
declare Layer <=> Get(_LayerName);
if(Layer == Null) return;
Layer.InAnimation = _Animation;
}
Void SetAnimationOut(Text _LayerName, CUILayer::EUILayerAnimation _Animation) {
declare Layer <=> Get(_LayerName);
if(Layer == Null) return;
Layer.OutAnimation = _Animation;
}
Void SetAnimationInOut(Text _LayerName, CUILayer::EUILayerAnimation _Animation) {
declare Layer <=> Get(_LayerName);
if (Layer == Null) return;
Layer.InOutAnimation = _Animation;
}
Void Show(Text _LayerName) {
declare Layer <=> Get(_LayerName);
if(Layer == Null) return;
Layer.IsVisible = True;
}
Void ShowOnly(Text _LayerName) {
foreach(Layer,G_Layers) UILayers[Layer].IsVisible = False;
Get(_LayerName).IsVisible = True;
}
Void Hide(Text _LayerName) {
Get(_LayerName).IsVisible = False;
}
Void SendEvent(Text _LayerName, Text _Type, Text[] _Data) {
LayerCustomEvent(Get(_LayerName), _Type, _Data);
}
Void SendEvent(Text _LayerName, Text _Type, Text _Data) {
LayerCustomEvent(Get(_LayerName), _Type, [_Data]);
}
Void SendEvent(Text _LayerName, Text _Type) {
LayerCustomEvent(Get(_LayerName), _Type, []);
}