1
2 /**
3 IMPORTANT !!!
4
5 DO NOT EDIT THIS FILE. IT IS GENERATED FROM approriate xml file in xmlresources/gbcommands BY
6 THE JavaClassesGenerator.xslt. MODIFY THAT FILE INSTEAD OF THIS ONE.
7
8 Use Ant task process-gb-messages after that to generate .java files again.
9
10 IMPORTANT END !!!
11 */
12 package cz.cuni.amis.pogamut.ut2004.communication.messages.gbcommands;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.*;import java.awt.Color;
13 /**
14 * Representation of the GameBots2004 command SHTXT.
15 *
16 *
17 Shows for specified amount of time or removes a text from players HUD.
18
19 */
20 public class ShowText
21 extends CommandMessage
22 {
23
24
25 /** Example how the message looks like - used during parser tests. */
26 public static final String PROTOTYPE =
27 " {Player text} {Text text} {TextColor null} {Time 0} {Show False} ";
28
29 /**
30 * Creates new instance of command ShowText.
31 *
32 Shows for specified amount of time or removes a text from players HUD.
33
34 * Corresponding GameBots message for this command is
35 * SHTXT.
36 *
37 *
38 * @param Player Name of the player on who's HUD should be the text shown.
39 * @param Text The text that should be shown.
40 * @param TextColor The color of text.
41 * @param Time Number of seconds for which should be the text shown. The default is until manual removal.
42 * @param Show False if the message should be removed, true if it should be shown.
43 */
44 public ShowText(
45 String Player, String Text, Color TextColor, Double Time, Boolean Show
46 ) {
47
48 this.Player = Player;
49
50 this.Text = Text;
51
52 this.TextColor = TextColor;
53
54 this.Time = Time;
55
56 this.Show = Show;
57
58 }
59
60
61 /**
62 * Creates new instance of command ShowText.
63 *
64 Shows for specified amount of time or removes a text from players HUD.
65
66 * Corresponding GameBots message for this command is
67 * SHTXT.
68 * <p></p>
69 * WARNING: this is empty-command constructor, you have to use setters to fill it up with data that should be sent to GameBots2004!
70 */
71 public ShowText() {
72 }
73
74
75 /**
76 * Cloning constructor.
77 *
78 * @param original
79 */
80 public ShowText(ShowText original) {
81
82 this.Player = original.Player;
83
84 this.Text = original.Text;
85
86 this.TextColor = original.TextColor;
87
88 this.Time = original.Time;
89
90 this.Show = original.Show;
91
92 }
93
94 /**
95 Name of the player on who's HUD should be the text shown.
96 */
97 protected
98 String Player =
99
100 null
101 ;
102
103
104
105 /**
106 * Name of the player on who's HUD should be the text shown.
107 */
108 public String getPlayer()
109
110 {
111 return
112 Player;
113 }
114
115
116
117
118 /**
119 * Name of the player on who's HUD should be the text shown.
120 */
121 public ShowText
122 setPlayer(String Player)
123
124 {
125 this.Player = Player;
126 return this;
127 }
128
129 /**
130 The text that should be shown.
131 */
132 protected
133 String Text =
134
135 null
136 ;
137
138
139
140 /**
141 * The text that should be shown.
142 */
143 public String getText()
144
145 {
146 return
147 Text;
148 }
149
150
151
152
153 /**
154 * The text that should be shown.
155 */
156 public ShowText
157 setText(String Text)
158
159 {
160 this.Text = Text;
161 return this;
162 }
163
164 /**
165 The color of text.
166 */
167 protected
168 Color TextColor =
169
170 null
171 ;
172
173
174
175 /**
176 * The color of text.
177 */
178 public Color getTextColor()
179
180 {
181 return
182 TextColor;
183 }
184
185
186
187
188 /**
189 * The color of text.
190 */
191 public ShowText
192 setTextColor(Color TextColor)
193
194 {
195 this.TextColor = TextColor;
196 return this;
197 }
198
199 /**
200 Number of seconds for which should be the text shown. The default is until manual removal.
201 */
202 protected
203 Double Time =
204
205 null
206 ;
207
208
209
210 /**
211 * Number of seconds for which should be the text shown. The default is until manual removal.
212 */
213 public Double getTime()
214
215 {
216 return
217 Time;
218 }
219
220
221
222
223 /**
224 * Number of seconds for which should be the text shown. The default is until manual removal.
225 */
226 public ShowText
227 setTime(Double Time)
228
229 {
230 this.Time = Time;
231 return this;
232 }
233
234 /**
235 False if the message should be removed, true if it should be shown.
236 */
237 protected
238 Boolean Show =
239
240 null
241 ;
242
243
244
245 /**
246 * False if the message should be removed, true if it should be shown.
247 */
248 public Boolean isShow()
249
250 {
251 return
252 Show;
253 }
254
255
256
257
258 /**
259 * False if the message should be removed, true if it should be shown.
260 */
261 public ShowText
262 setShow(Boolean Show)
263
264 {
265 this.Show = Show;
266 return this;
267 }
268
269 public String toString() {
270 return toMessage();
271 }
272
273 public String toHtmlString() {
274 return super.toString() + "[<br/>" +
275
276 "<b>Player</b> = " +
277 String.valueOf(getPlayer()
278 ) +
279 " <br/> " +
280
281 "<b>Text</b> = " +
282 String.valueOf(getText()
283 ) +
284 " <br/> " +
285
286 "<b>TextColor</b> = " +
287 String.valueOf(getTextColor()
288 ) +
289 " <br/> " +
290
291 "<b>Time</b> = " +
292 String.valueOf(getTime()
293 ) +
294 " <br/> " +
295
296 "<b>Show</b> = " +
297 String.valueOf(isShow()
298 ) +
299 " <br/> " +
300
301 "<br/>]"
302 ;
303 }
304
305 public String toMessage() {
306 StringBuffer buf = new StringBuffer();
307 buf.append("SHTXT");
308
309 if (Player != null) {
310 buf.append(" {Player " + Player + "}");
311 }
312
313 if (Text != null) {
314 buf.append(" {Text " + Text + "}");
315 }
316
317 if (TextColor != null) {
318 buf.append(" {TextColor " +
319 TextColor.getRed() + "," +
320 TextColor.getGreen() + "," +
321 TextColor.getBlue() + "," +
322 TextColor.getAlpha() + "}");
323 }
324
325 if (Time != null) {
326 buf.append(" {Time " + Time + "}");
327 }
328
329 if (Show != null) {
330 buf.append(" {Show " + Show + "}");
331 }
332
333 return buf.toString();
334 }
335
336 // --- Extra Java from XML BEGIN (extra/code/java)
337
338
339
340 // --- Extra Java from XML END (extra/code/java)
341
342 }
343