1 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages;
2
3 // --- IMPORTS FROM /messages/settings/javasettings/javaimport BEGIN
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 // --- IMPORTS FROM /messages/settings/javasettings/javaimport END
6
7
8 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] BEGIN
9
10 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name='all'] END
11
12 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] BEGIN
13
14 // --- IMPORTS FROM extra/code/java/javapart/classcategory[@name=event]+classtype[@name=impl] END
15
16 /**
17 *
18 Definition of the event CHANGEANIM.
19
20 *
21 * <p></p><p></p>
22 * Complete message documentation:
23 *
24 Asynchronous message. Bot starts or finishes custom played animation. If a list of animation was supported, this
25 message will come each time an animation in the list starts or stops playing.
26
27 */
28 public class AnimationChange
29 extends InfoMessage
30 implements IWorldEvent, IWorldChangeEvent
31
32 {
33
34 /** Example how the message looks like - used during parser tests. */
35 public static final String PROTOTYPE =
36 "CHANGEANIM {Name text} {AnimStart False} {AnimEnd False} {Time 0} ";
37
38
39
40 /**
41 * Parameter-less contructor for the message.
42 */
43 public AnimationChange()
44 {
45 }
46
47
48
49
50 /**
51 * Creates new instance of the message AnimationChange.
52 *
53 Asynchronous message. Bot starts or finishes custom played animation. If a list of animation was supported, this
54 message will come each time an animation in the list starts or stops playing.
55
56 * Corresponding GameBots message
57 *
58 * is
59 * CHANGEANIM.
60 *
61 *
62 *
63 * @param Name
64 Name of the animation.
65
66 *
67 *
68 *
69 * @param AnimStart
70 True if this animation has now started.
71
72 *
73 *
74 *
75 * @param AnimEnd
76 True if this animation has ended.
77
78 *
79 *
80 *
81 * @param Time
82 Time of the animation change.
83
84 *
85 *
86 */
87 public AnimationChange(
88 String Name, boolean AnimStart, boolean AnimEnd, double Time
89 ) {
90
91 this.Name = Name;
92
93 this.AnimStart = AnimStart;
94
95 this.AnimEnd = AnimEnd;
96
97 this.Time = Time;
98
99 }
100
101 /**
102 * Cloning constructor from the full message.
103 *
104 * @param original
105 */
106 public AnimationChange(AnimationChange original) {
107
108 this.Name = original.getName()
109 ;
110
111 this.AnimStart = original.isAnimStart()
112 ;
113
114 this.AnimEnd = original.isAnimEnd()
115 ;
116
117 this.Time = original.getTime()
118 ;
119
120 this.SimTime = original.getSimTime();
121 }
122
123
124 protected long SimTime;
125
126 /**
127 * Simulation time in MILLI SECONDS !!!
128 */
129 @Override
130 public long getSimTime() {
131 return SimTime;
132 }
133
134 /**
135 * Used by Yylex to slip correct time of the object or programmatically.
136 */
137 protected void setSimTime(long SimTime) {
138 this.SimTime = SimTime;
139 }
140
141
142 /**
143 *
144 Name of the animation.
145
146 */
147 protected
148 String Name =
149 null;
150
151 /**
152 *
153 Name of the animation.
154
155 */
156 public String getName()
157 {
158 return Name;
159 }
160
161
162 /**
163 *
164 True if this animation has now started.
165
166 */
167 protected
168 boolean AnimStart =
169 false;
170
171 /**
172 *
173 True if this animation has now started.
174
175 */
176 public boolean isAnimStart()
177 {
178 return AnimStart;
179 }
180
181
182 /**
183 *
184 True if this animation has ended.
185
186 */
187 protected
188 boolean AnimEnd =
189 false;
190
191 /**
192 *
193 True if this animation has ended.
194
195 */
196 public boolean isAnimEnd()
197 {
198 return AnimEnd;
199 }
200
201
202 /**
203 *
204 Time of the animation change.
205
206 */
207 protected
208 double Time =
209 0;
210
211 /**
212 *
213 Time of the animation change.
214
215 */
216 public double getTime()
217 {
218 return Time;
219 }
220
221
222 public String toString() {
223 return
224 super.toString() + "[" +
225
226 "Name = " + String.valueOf(getName()
227 ) + " | " +
228
229 "AnimStart = " + String.valueOf(isAnimStart()
230 ) + " | " +
231
232 "AnimEnd = " + String.valueOf(isAnimEnd()
233 ) + " | " +
234
235 "Time = " + String.valueOf(getTime()
236 ) + " | " +
237
238 "]";
239 }
240
241
242 public String toHtmlString() {
243 return super.toString() + "[<br/>" +
244
245 "<b>Name</b> = " + String.valueOf(getName()
246 ) + " <br/> " +
247
248 "<b>AnimStart</b> = " + String.valueOf(isAnimStart()
249 ) + " <br/> " +
250
251 "<b>AnimEnd</b> = " + String.valueOf(isAnimEnd()
252 ) + " <br/> " +
253
254 "<b>Time</b> = " + String.valueOf(getTime()
255 ) + " <br/> " +
256
257 "<br/>]";
258 }
259
260 public String toJsonLiteral() {
261 return "AnimationChange(null, "
262
263 + ")";
264 }
265
266
267 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=all]) ---
268
269 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=all]) ---
270
271 // --- Extra Java from XML BEGIN (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
272
273 // --- Extra Java from XML END (extra/code/java/javapart/classcategory[@name=event+classtype[@name=impl]) ---
274
275 }
276