-
Notifications
You must be signed in to change notification settings - Fork 0
/
ScriptEvents.cs
244 lines (221 loc) · 6.46 KB
/
ScriptEvents.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
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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DarkUI.Controls;
using Kawa.SExpressions;
namespace KiSSLab
{
public partial class Scene
{
/// <summary>
/// A timer reaches zero.
/// </summary>
[ScriptEvent]
public string Alarm(params object[] ev)
{
if (!(ev[1] is int || ev[1] is string || ev[1] is Symbol))
{
DarkUI.Forms.DarkMessageBox.ShowError(string.Format("Malformed \"alarm\" event. An integer or string ID is expected, but got a {0}.", ev[1].GetType().Name), Application.ProductName);
return null;
}
var timerID = ev[1].GetHashCode();
HashCodes[timerID] = ev[1].ToString();
if (ev[1] is string)
HashCodes[timerID] = string.Format("\"{0}\"", ev[1]);
return string.Format("alarm|{0}", timerID);
}
/// <summary>
/// The two cels or objects do not overlap, taking transparent pixels into account.
/// Triggers only if the cels did overlap before one of them was moved by the user.
/// </summary>
[ScriptEvent]
public string Apart(params object[] ev)
{
return string.Format("apart|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// This event is triggered after the initialize event and before the version event.
/// </summary>
[ScriptEvent]
public string Begin(params object[] ev)
{
return "begin";
}
/// <summary>
/// The user clicks on the object or cel.
/// Applies to all cels & objects except those with a maximal fix value.
/// </summary>
[ScriptEvent]
public string Catch(params object[] ev)
{
return string.Format("catch|{0}", ev[1]);
}
/// <summary>
/// The user changes the palette to that specified.
/// </summary>
[ScriptEvent("col")]
public string ChangedCol(params object[] ev)
{
return string.Format("col|{0}", ev[1]);
}
/// <summary>
/// The two cels or objects touch, taking transparent pixels into account.
/// Triggers only if the cels did not overlap before one of them was moved by the user.
/// </summary>
[ScriptEvent]
public string Collide(params object[] ev)
{
return string.Format("collide|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// The user releases the mouse on the object or cel.
/// Applies only to all cels & objects except those with a maximal fix value.
/// </summary>
[ScriptEvent]
public string Drop(params object[] ev)
{
return string.Format("drop|{0}", ev[1]);
}
/// <summary>
/// The user quits the player or closes the doll.
/// </summary>
[ScriptEvent]
public string End(params object[] ev)
{
return "end";
}
/// <summary>
/// The user clicks on the object or cel.
/// Applies only to fixed cels & objects.
/// </summary>
[ScriptEvent]
public string FixCatch(params object[] ev)
{
return string.Format("fixcatch|{0}", ev[1]);
}
/// <summary>
/// The user releases the object or cel.
/// Applies only to fixed cels & objects.
/// </summary>
[ScriptEvent]
public string FixDrop(params object[] ev)
{
return string.Format("fixdrop|{0}", ev[1]);
}
/// <summary>
/// The two objects or cels overlap, ignoring transparency.
/// Triggers only if the objects did not overlap before one of them was moved by the user.
/// </summary>
[ScriptEvent]
public string In(params object[] ev)
{
return string.Format("in|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// Before the doll is displayed after loading.
/// </summary>
[ScriptEvent]
public string Initialize(params object[] ev)
{
return "initialize";
}
/// <summary>
/// The user has pressed the specified key. This event is triggered once when the key is pressed - there is no autorepeat.
/// </summary>
[ScriptEvent]
public string KeyPress(params object[] ev)
{
return string.Format("keypress|{0}", ev[1]);
}
/// <summary>
/// The user has released the specified key (i.e. is no longer pressing it).
/// </summary>
[ScriptEvent]
public string KeyRelease(params object[] ev)
{
return string.Format("keyrelease|{0}", ev[1]);
}
/// <summary>
/// Triggered when the mouse pointer moves over the cel or object.
/// The event is only triggered if the cel or object is not occluded by other cels (i.e. if a mouse click would invoke a "press" event)
/// </summary>
[ScriptEvent]
public string MouseIn(params object[] ev)
{
return string.Format("mousein|{0}", ev[1]);
}
/// <summary>
/// Triggered when the mouse pointer moves over the cel or object.
/// The event is only triggered if the cel or object is not occluded by other cels (i.e. if a mouse click would invoke a "press" event)
/// </summary>
[ScriptEvent]
public string MouseOut(params object[] ev)
{
return string.Format("mouseout|{0}", ev[1]);
}
/// <summary>
/// The two cels or objects do not overlap, ignoring transparency.
/// Triggers only if the objects did overlap before one of them was moved by the user.
/// </summary>
[ScriptEvent]
public string Out(params object[] ev)
{
return string.Format("out|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// The user clicks on the object or cel.
/// Applies to all cels & objects.
/// </summary>
[ScriptEvent]
public string Press(params object[] ev)
{
return string.Format("press|{0}", ev[1]);
}
/// <summary>
/// The user releases the object or cel.
/// Applies to all cels & objects.
/// </summary>
[ScriptEvent]
public string Release(params object[] ev)
{
return string.Format("release|{0}", ev[1]);
}
/// <summary>
/// The user changes the set to that specified.
/// </summary>
[ScriptEvent("set")]
public string ChangedSet(params object[] ev)
{
return string.Format("set|{0}", ev[1]);
}
/// <summary>
/// The two objects or cels overlap, ignoring transparency.
/// Triggers irrespective of the state of the two objects before movement.
/// </summary>
[ScriptEvent]
public string StillIn(params object[] ev)
{
return string.Format("stillin|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// The two cels or objects do not overlap, ignoring transparency.
/// Triggers irrespective of the state of the two objects before movement.
/// </summary>
[ScriptEvent]
public string StillOut(params object[] ev)
{
return string.Format("stillout|{0}|{1}", ev[1], ev[2]);
}
/// <summary>
/// A previously-fixed cel or object becomes free to move.
/// </summary>
[ScriptEvent("unfix")]
public string UnFix(params object[] ev)
{
return string.Format("unfix|{0}", ev[1]);
}
}
}