1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3
4 import java.util.*;import javax.vecmath.*;import cz.cuni.amis.pogamut.base.communication.messages.*;import cz.cuni.amis.pogamut.base.communication.worldview.*;import cz.cuni.amis.pogamut.base.communication.worldview.event.*;import cz.cuni.amis.pogamut.base.communication.worldview.object.*;import cz.cuni.amis.pogamut.multi.communication.worldview.object.*;import cz.cuni.amis.pogamut.base.communication.translator.event.*;import cz.cuni.amis.pogamut.multi.communication.translator.event.*;import cz.cuni.amis.pogamut.base3d.worldview.object.*;import cz.cuni.amis.pogamut.base3d.worldview.object.event.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.*;import cz.cuni.amis.pogamut.ut2004.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.objects.*;import cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.*;import cz.cuni.amis.pogamut.ut2004.communication.messages.ItemType.Category;import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId;import cz.cuni.amis.utils.exception.*;import cz.cuni.amis.pogamut.base.communication.translator.event.IWorldObjectUpdateResult.Result;import cz.cuni.amis.utils.SafeEquals;import cz.cuni.amis.pogamut.base.agent.*;import cz.cuni.amis.pogamut.multi.agent.*;import cz.cuni.amis.pogamut.multi.communication.worldview.property.*;import cz.cuni.amis.pogamut.ut2004multi.communication.worldview.property.*;import cz.cuni.amis.utils.token.*;import cz.cuni.amis.utils.*;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 public class KeyEvent
28 extends InfoMessage
29 implements IWorldEvent, IWorldChangeEvent
30
31 {
32
33
34 public static final String PROTOTYPE =
35 "KEYEVENT {Player text} {PlayerId unreal_id} {PlayerName text} {ViewTarget unreal_id} {Action text} {Key text} ";
36
37
38
39
40
41
42 public KeyEvent()
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 public KeyEvent(
98 String Player, UnrealId PlayerId, String PlayerName, UnrealId ViewTarget, String Action, String Key
99 ) {
100
101 this.Player = Player;
102
103 this.PlayerId = PlayerId;
104
105 this.PlayerName = PlayerName;
106
107 this.ViewTarget = ViewTarget;
108
109 this.Action = Action;
110
111 this.Key = Key;
112
113 }
114
115
116
117
118
119
120 public KeyEvent(KeyEvent original) {
121
122 this.Player = original.getPlayer()
123 ;
124
125 this.PlayerId = original.getPlayerId()
126 ;
127
128 this.PlayerName = original.getPlayerName()
129 ;
130
131 this.ViewTarget = original.getViewTarget()
132 ;
133
134 this.Action = original.getAction()
135 ;
136
137 this.Key = original.getKey()
138 ;
139
140 this.SimTime = original.getSimTime();
141 }
142
143
144 protected long SimTime;
145
146
147
148
149 @Override
150 public long getSimTime() {
151 return SimTime;
152 }
153
154
155
156
157 protected void setSimTime(long SimTime) {
158 this.SimTime = SimTime;
159 }
160
161
162
163
164
165
166
167 protected
168 String Player =
169 null;
170
171
172
173
174
175
176 public String getPlayer()
177 {
178 return Player;
179 }
180
181
182
183
184
185
186
187 protected
188 UnrealId PlayerId =
189 null;
190
191
192
193
194
195
196 public UnrealId getPlayerId()
197 {
198 return PlayerId;
199 }
200
201
202
203
204
205
206
207 protected
208 String PlayerName =
209 null;
210
211
212
213
214
215
216 public String getPlayerName()
217 {
218 return PlayerName;
219 }
220
221
222
223
224
225
226
227 protected
228 UnrealId ViewTarget =
229 null;
230
231
232
233
234
235
236 public UnrealId getViewTarget()
237 {
238 return ViewTarget;
239 }
240
241
242
243
244
245
246
247 protected
248 String Action =
249 null;
250
251
252
253
254
255
256 public String getAction()
257 {
258 return Action;
259 }
260
261
262
263
264
265
266
267 protected
268 String Key =
269 null;
270
271
272
273
274
275
276 public String getKey()
277 {
278 return Key;
279 }
280
281
282 public String toString() {
283 return
284 super.toString() + "[" +
285
286 "Player = " + String.valueOf(getPlayer()
287 ) + " | " +
288
289 "PlayerId = " + String.valueOf(getPlayerId()
290 ) + " | " +
291
292 "PlayerName = " + String.valueOf(getPlayerName()
293 ) + " | " +
294
295 "ViewTarget = " + String.valueOf(getViewTarget()
296 ) + " | " +
297
298 "Action = " + String.valueOf(getAction()
299 ) + " | " +
300
301 "Key = " + String.valueOf(getKey()
302 ) + " | " +
303
304 "]";
305 }
306
307
308 public String toHtmlString() {
309 return super.toString() + "[<br/>" +
310
311 "<b>Player</b> = " + String.valueOf(getPlayer()
312 ) + " <br/> " +
313
314 "<b>PlayerId</b> = " + String.valueOf(getPlayerId()
315 ) + " <br/> " +
316
317 "<b>PlayerName</b> = " + String.valueOf(getPlayerName()
318 ) + " <br/> " +
319
320 "<b>ViewTarget</b> = " + String.valueOf(getViewTarget()
321 ) + " <br/> " +
322
323 "<b>Action</b> = " + String.valueOf(getAction()
324 ) + " <br/> " +
325
326 "<b>Key</b> = " + String.valueOf(getKey()
327 ) + " <br/> " +
328
329 "<br/>]";
330 }
331
332 public String toJsonLiteral() {
333 return "KeyEvent(null, "
334
335 + ")";
336 }
337
338
339
340
341
342
343
344
345
346
347 }
348