1
2
3
4
5
6
7
8
9
10
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
15
16
17
18
19
20 public class ShowText
21 extends CommandMessage
22 {
23
24
25
26 public static final String PROTOTYPE =
27 " {Player text} {Text text} {TextColor null} {Time 0} {Show False} ";
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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
63
64
65
66
67
68
69
70
71 public ShowText() {
72 }
73
74
75
76
77
78
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
96
97 protected
98 String Player =
99
100 null
101 ;
102
103
104
105
106
107
108 public String getPlayer()
109
110 {
111 return
112 Player;
113 }
114
115
116
117
118
119
120
121 public ShowText
122 setPlayer(String Player)
123
124 {
125 this.Player = Player;
126 return this;
127 }
128
129
130
131
132 protected
133 String Text =
134
135 null
136 ;
137
138
139
140
141
142
143 public String getText()
144
145 {
146 return
147 Text;
148 }
149
150
151
152
153
154
155
156 public ShowText
157 setText(String Text)
158
159 {
160 this.Text = Text;
161 return this;
162 }
163
164
165
166
167 protected
168 Color TextColor =
169
170 null
171 ;
172
173
174
175
176
177
178 public Color getTextColor()
179
180 {
181 return
182 TextColor;
183 }
184
185
186
187
188
189
190
191 public ShowText
192 setTextColor(Color TextColor)
193
194 {
195 this.TextColor = TextColor;
196 return this;
197 }
198
199
200
201
202 protected
203 Double Time =
204
205 null
206 ;
207
208
209
210
211
212
213 public Double getTime()
214
215 {
216 return
217 Time;
218 }
219
220
221
222
223
224
225
226 public ShowText
227 setTime(Double Time)
228
229 {
230 this.Time = Time;
231 return this;
232 }
233
234
235
236
237 protected
238 Boolean Show =
239
240 null
241 ;
242
243
244
245
246
247
248 public Boolean isShow()
249
250 {
251 return
252 Show;
253 }
254
255
256
257
258
259
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
337
338
339
340
341
342 }
343