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 THESE FILES INSTEAD OF THIS ONE.
7
8 IMPORTANT END !!!
9 */
10 package
11 cz.cuni.amis.pogamut.udk.communication.messages.gbcommands;
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 Send a message to the world or just your team.
35
36 Corresponding GameBots command is
37 MESSAGE.
38
39 */
40
41 public class
42 SendMessage extends
43 CommandMessage
44
45 {
46
47 /**
48 Creates new instance of command SendMessage.
49
50 Send a message to the world or just your team.
51 Corresponding GameBots message for this command is
52 MESSAGE.
53 @param Id Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head).
54 @param Text Text to send.
55 @param Global
56 If True it is sent to everyone. Otherwise (or if not
57 specified), just your team.
58
59 @param FadeOut Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown.
60 */
61 public SendMessage(
62 UnrealId Id, String Text, boolean Global, double FadeOut) {
63
64 this.Id = Id;
65
66 this.Text = Text;
67
68 this.Global = Global;
69
70 this.FadeOut = FadeOut;
71
72 }
73
74
75 /**
76 Creates new instance of command SendMessage.
77
78 Send a message to the world or just your team.
79 Corresponding GameBots message for this command is
80 MESSAGE.
81 <p></p>WARNING: this is empty-command constructor, you have to use setters to fill it up!
82 */
83 public SendMessage() {
84 }
85
86
87 /////// Properties BEGIN
88
89 /**
90 Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). */
91 protected
92 UnrealId Id =
93 null;
94
95
96 /**
97 Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). */
98 public
99 UnrealId getId() {
100 return
101 Id;
102 }
103
104
105
106 /**
107 Here we can specify Id of the bot, that will receive this message privately (with "Private:" string at the beginning of the message). Doesn't work for players (but if text bubble enabled, players will see this message above the bot head). */
108 public SendMessage setId(UnrealId Id) {
109 this.Id = Id;
110 return this;
111 }
112
113 /**
114 Text to send. */
115 protected
116 String Text =
117 null;
118
119
120 /**
121 Text to send. */
122 public
123 String getText() {
124 return
125 Text;
126 }
127
128
129
130 /**
131 Text to send. */
132 public SendMessage setText(String Text) {
133 this.Text = Text;
134 return this;
135 }
136
137 /**
138
139 If True it is sent to everyone. Otherwise (or if not
140 specified), just your team.
141 */
142 protected
143 boolean Global =
144 false;
145
146
147 /**
148
149 If True it is sent to everyone. Otherwise (or if not
150 specified), just your team.
151 */
152 public
153 boolean isGlobal() {
154 return
155 Global;
156 }
157
158
159
160 /**
161
162 If True it is sent to everyone. Otherwise (or if not
163 specified), just your team.
164 */
165 public SendMessage setGlobal(boolean Global) {
166 this.Global = Global;
167 return this;
168 }
169
170 /**
171 Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. */
172 protected
173 double FadeOut =
174 0;
175
176
177 /**
178 Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. */
179 public
180 double getFadeOut() {
181 return
182 FadeOut;
183 }
184
185
186
187 /**
188 Enables text bubble. Sets how long the bubble should stay (in seconds, counted ~ 12 + FadeOut seconds - dunno why, some UT mechanics?). If -1 the bubble won't be shown. */
189 public SendMessage setFadeOut(double FadeOut) {
190 this.FadeOut = FadeOut;
191 return this;
192 }
193
194 /////// Properties END
195
196 /////// Extra Java code BEGIN
197
198 /////// Additional code from xslt BEGIN
199
200
201
202 /////// Additional code from xslt END
203
204 /////// Extra Java from XML BEGIN
205
206 /////// Extra Java from XML END
207
208 /////// Extra Java code END
209
210
211
212 /**
213 * Cloning constructor.
214 */
215 public SendMessage(SendMessage original) {
216
217 this.Id=original.Id;
218
219 this.Text=original.Text;
220
221 this.Global=original.Global;
222
223 this.FadeOut=original.FadeOut;
224
225 }
226
227
228
229
230 public String toString() {
231 return
232
233 toMessage();
234
235 }
236
237 public String toHtmlString() {
238 return super.toString() +
239
240 "<b>Id</b> : " +
241 String.valueOf(Id) +
242 " <br/> " +
243
244 "<b>Text</b> : " +
245 String.valueOf(Text) +
246 " <br/> " +
247
248 "<b>Global</b> : " +
249 String.valueOf(Global) +
250 " <br/> " +
251
252 "<b>FadeOut</b> : " +
253 String.valueOf(FadeOut) +
254 " <br/> " +
255 "";
256 }
257
258
259
260 public String toMessage() {
261 StringBuffer buf = new StringBuffer();
262 buf.append("MESSAGE");
263
264 if (Id != null) {
265 buf.append(" {Id " + Id.getStringId() + "}");
266 }
267
268 if (Text != null) {
269 buf.append(" {Text " + Text + "}");
270 }
271
272 buf.append(" {Global " + Global + "}");
273
274 buf.append(" {FadeOut " + FadeOut + "}");
275
276 return buf.toString();
277 }
278
279 }
280
281