1
2 /**
3 IMPORTANT !!!
4
5 DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbinfomessages BY
6 THE JavaClassesGenerator.xslt. MODIFY THESE FILES INSTEAD OF THIS ONE.
7
8 IMPORTANT END !!!
9 */
10 package
11 cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages;
12 import java.util.*;
13 import javax.vecmath.*;
14 import cz.cuni.amis.pogamut.base.communication.messages.*;
15 import cz.cuni.amis.pogamut.base.communication.worldview.*;
16 import cz.cuni.amis.pogamut.base.communication.worldview.event.*;
17 import cz.cuni.amis.pogamut.base.communication.worldview.object.*;
18 import cz.cuni.amis.pogamut.base.communication.translator.event.*;
19 import cz.cuni.amis.pogamut.base3d.worldview.object.*;
20 import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;
21 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;
22 import cz.cuni.amis.pogamut.udk.communication.messages.*;
23 import cz.cuni.amis.pogamut.udk.communication.worldview.objects.*;
24 import cz.cuni.amis.pogamut.udk.communication.translator.itemdescriptor.*;
25 import cz.cuni.amis.pogamut.udk.communication.messages.ItemType.Category;
26 import cz.cuni.amis.utils.exception.*;
27 import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;
28 import cz.cuni.amis.utils.SafeEquals;
29 import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;
30
31
32 /**
33
34 Asynchronous message. Response to key event (key press, key release...).
35
36 Corresponding GameBots message is
37 KEYEVENT.
38
39 */
40
41 public class
42 KeyEvent
43 extends GBEvent
44
45 implements IWorldEvent, IWorldChangeEvent
46
47 {
48
49 /**
50 Creates new instance of command KeyEvent.
51
52 Asynchronous message. Response to key event (key press, key release...).
53 Corresponding GameBots message for this command is
54 .
55 @param Player
56 Name of player who has triggered the key event.
57
58 @param PlayerId
59 Id of player who has triggered the key event.
60
61 @param PlayerName
62 Name of player who has triggered the key event.
63
64 @param ViewTarget
65 If the player that triggered the key event is observing another player in the game, then the id of that observed player will be exported here.
66
67 @param Action
68 Action that happened with the key. Possible are: PRESS, HOLD, RELEASE.
69
70 @param Key
71 Key that has been pressed, released or held. See Interactions.EInputKey for choices - these are without the "IK_" prefix with original case.
72
73 */
74 public KeyEvent(
75 String Player, UnrealId PlayerId, String PlayerName, UnrealId ViewTarget, String Action, String Key) {
76
77 this.Player = Player;
78
79 this.PlayerId = PlayerId;
80
81 this.PlayerName = PlayerName;
82
83 this.ViewTarget = ViewTarget;
84
85 this.Action = Action;
86
87 this.Key = Key;
88
89 }
90
91
92 /** Example how the message looks like - used during parser tests. */
93 public static final String PROTOTYPE =
94 "KEYEVENT {Player text} {PlayerId unreal_id} {PlayerName text} {ViewTarget unreal_id} {Action text} {Key text}";
95
96
97 /////// Properties BEGIN
98
99 /**
100
101 Name of player who has triggered the key event.
102 */
103 protected
104 String Player =
105 null;
106
107
108 /**
109
110 Name of player who has triggered the key event.
111 */
112 public
113 String getPlayer() {
114 return
115 Player;
116 }
117
118
119
120 /**
121
122 Id of player who has triggered the key event.
123 */
124 protected
125 UnrealId PlayerId =
126 null;
127
128
129 /**
130
131 Id of player who has triggered the key event.
132 */
133 public
134 UnrealId getPlayerId() {
135 return
136 PlayerId;
137 }
138
139
140
141 /**
142
143 Name of player who has triggered the key event.
144 */
145 protected
146 String PlayerName =
147 null;
148
149
150 /**
151
152 Name of player who has triggered the key event.
153 */
154 public
155 String getPlayerName() {
156 return
157 PlayerName;
158 }
159
160
161
162 /**
163
164 If the player that triggered the key event is observing another player in the game, then the id of that observed player will be exported here.
165 */
166 protected
167 UnrealId ViewTarget =
168 null;
169
170
171 /**
172
173 If the player that triggered the key event is observing another player in the game, then the id of that observed player will be exported here.
174 */
175 public
176 UnrealId getViewTarget() {
177 return
178 ViewTarget;
179 }
180
181
182
183 /**
184
185 Action that happened with the key. Possible are: PRESS, HOLD, RELEASE.
186 */
187 protected
188 String Action =
189 null;
190
191
192 /**
193
194 Action that happened with the key. Possible are: PRESS, HOLD, RELEASE.
195 */
196 public
197 String getAction() {
198 return
199 Action;
200 }
201
202
203
204 /**
205
206 Key that has been pressed, released or held. See Interactions.EInputKey for choices - these are without the "IK_" prefix with original case.
207 */
208 protected
209 String Key =
210 null;
211
212
213 /**
214
215 Key that has been pressed, released or held. See Interactions.EInputKey for choices - these are without the "IK_" prefix with original case.
216 */
217 public
218 String getKey() {
219 return
220 Key;
221 }
222
223
224
225 /////// Properties END
226
227 /////// Extra Java code BEGIN
228
229 /////// Additional code from xslt BEGIN
230
231 public long getSimTime() {
232 // NOT IMPLEMENTED FOR UDK
233 return 0;
234 }
235
236
237
238 /////// Additional code from xslt END
239
240 /////// Extra Java from XML BEGIN
241
242 /////// Extra Java from XML END
243
244 /////// Extra Java code END
245
246
247
248 /**
249 * Cloning constructor.
250 */
251 public KeyEvent(KeyEvent original) {
252
253 this.Player=original.Player;
254
255 this.PlayerId=original.PlayerId;
256
257 this.PlayerName=original.PlayerName;
258
259 this.ViewTarget=original.ViewTarget;
260
261 this.Action=original.Action;
262
263 this.Key=original.Key;
264
265 }
266
267
268 /**
269 * Used by Yylex to create empty message then to fill it's protected fields (Yylex is in the same package).
270 */
271 public KeyEvent() {
272 }
273
274
275
276 public String toString() {
277 return
278
279 super.toString() + " | " +
280
281 "Player = " +
282 String.valueOf(Player) + " | " +
283
284 "PlayerId = " +
285 String.valueOf(PlayerId) + " | " +
286
287 "PlayerName = " +
288 String.valueOf(PlayerName) + " | " +
289
290 "ViewTarget = " +
291 String.valueOf(ViewTarget) + " | " +
292
293 "Action = " +
294 String.valueOf(Action) + " | " +
295
296 "Key = " +
297 String.valueOf(Key) + " | " +
298 "";
299
300 }
301
302 public String toHtmlString() {
303 return super.toString() +
304
305 "<b>Player</b> : " +
306 String.valueOf(Player) +
307 " <br/> " +
308
309 "<b>PlayerId</b> : " +
310 String.valueOf(PlayerId) +
311 " <br/> " +
312
313 "<b>PlayerName</b> : " +
314 String.valueOf(PlayerName) +
315 " <br/> " +
316
317 "<b>ViewTarget</b> : " +
318 String.valueOf(ViewTarget) +
319 " <br/> " +
320
321 "<b>Action</b> : " +
322 String.valueOf(Action) +
323 " <br/> " +
324
325 "<b>Key</b> : " +
326 String.valueOf(Key) +
327 " <br/> " +
328 "";
329 }
330
331
332
333 }
334
335