summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/WebPageWall.java
diff options
context:
space:
mode:
Diffstat (limited to 'NET/worlds/scape/WebPageWall.java')
-rw-r--r--NET/worlds/scape/WebPageWall.java498
1 files changed, 498 insertions, 0 deletions
diff --git a/NET/worlds/scape/WebPageWall.java b/NET/worlds/scape/WebPageWall.java
new file mode 100644
index 0000000..359aeb0
--- /dev/null
+++ b/NET/worlds/scape/WebPageWall.java
@@ -0,0 +1,498 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.DefaultConsole;
+/* */ import NET.worlds.console.NoWebControlException;
+/* */ import NET.worlds.console.WebControl;
+/* */ import NET.worlds.console.WebControlFactory;
+/* */ import NET.worlds.console.WebControlImp;
+/* */ import NET.worlds.console.WebControlListener;
+/* */ import NET.worlds.core.IniFile;
+/* */ import NET.worlds.network.URL;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */
+/* */
+/* */
+/* */ public class WebPageWall
+/* */ extends Rect
+/* */ implements WebControlListener
+/* */ {
+/* 22 */ WebControlImp _wci = null;
+/* */ TextureSurface _surface;
+/* */ Texture[] _textures;
+/* 25 */ Material _material = null;
+/* */
+/* */
+/* 28 */ String _textureURL = "$SCRIPTSERVERgetad.pl?u=$USERNAME";
+/* */
+/* */
+/* 31 */ String _postTextureData = null;
+/* */
+/* */
+/* 34 */ String _adURL = "http://www.worlds.com/";
+/* */
+/* 36 */ String _postAdData = null;
+/* */
+/* */
+/* 39 */ String _defTextureURL = IniFile.override().getIniString("defaultAd",
+/* 40 */ "adworlds.cmp");
+/* */
+/* */
+/* 43 */ int _xPercent = 100; int _yPercent = 100;
+/* */
+/* */
+/* 46 */ int _xSurface = 468; int _ySurface = 60;
+/* */
+/* */
+/* 49 */ boolean _hasToolbar = true;
+/* */
+/* */
+/* 52 */ boolean _isFixed = false;
+/* */
+/* */
+/* 55 */ int _rows = 1;
+/* */
+/* */
+/* */
+/* */
+/* 60 */ int _refresh = 5;
+/* */
+/* */
+/* 63 */ boolean _passClicks = true;
+/* */
+/* */
+/* */
+/* 67 */ boolean _isAdBanner = true;
+/* */
+/* 69 */ public boolean getIsAdBanner() { return this._isAdBanner; }
+/* */
+/* */
+/* */
+/* 73 */ boolean _retryURL = false;
+/* */
+/* */ public void rebuild()
+/* */ {
+/* 77 */ unbuild();
+/* 78 */ assignMaterial();
+/* */ }
+/* */
+/* */ public void unbuild()
+/* */ {
+/* 83 */ if (this._wci != null)
+/* */ {
+/* 85 */ this._wci.detach();
+/* 86 */ this._wci = null;
+/* */ }
+/* */ }
+/* */
+/* */ public void detach()
+/* */ {
+/* 92 */ unbuild();
+/* 93 */ super.detach();
+/* */ }
+/* */
+/* */ public void finalize()
+/* */ {
+/* 98 */ unbuild();
+/* 99 */ super.finalize();
+/* */ }
+/* */
+/* */ public boolean handle(MouseDownEvent event)
+/* */ {
+/* 104 */ if ((event.key & 0x1) == '\001')
+/* */ {
+/* 106 */ Point2 pt = deproject();
+/* */
+/* 108 */ if (this._passClicks)
+/* */ {
+/* 110 */ double realX = pt.x * this._surface.getWidth();
+/* 111 */ double realY = pt.y * this._surface.getHeight();
+/* 112 */ realY = this._surface.getHeight() - realY;
+/* */
+/* 114 */ this._surface.sendLeftClick((int)realX, (int)realY);
+/* 115 */ return false;
+/* */ }
+/* */
+/* 118 */ Console c = Console.getActive();
+/* 119 */ if ((c != null) && ((c instanceof DefaultConsole)))
+/* */ {
+/* 121 */ DefaultConsole dc = (DefaultConsole)c;
+/* */ try {
+/* 123 */ WebControl wc = new WebControl(dc.getRender(),
+/* 124 */ this._xPercent, this._yPercent, this._hasToolbar, this._isFixed,
+/* 125 */ false);
+/* 126 */ wc.activate();
+/* 127 */ wc.setURL(this._adURL, this._postAdData);
+/* */
+/* */ }
+/* */ catch (NoWebControlException e)
+/* */ {
+/* 132 */ new SendURLAction(this._adURL).doIt();
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* 137 */ return false;
+/* */ }
+/* */
+/* 140 */ int frameCnt = -1;
+/* */
+/* */ public void prerender(Camera cam)
+/* */ {
+/* 144 */ Point3Temp p = inCamSpace(cam);
+/* */
+/* */
+/* */
+/* 148 */ boolean v = (p != null) && (p.z > 1.0F) && (p.x < p.z) && (-p.x < p.z);
+/* */
+/* 150 */ if (v) this.visible = true;
+/* */ }
+/* */
+/* */ public boolean handle(FrameEvent f)
+/* */ {
+/* 155 */ if (this.visible)
+/* */ {
+/* 157 */ if ((this._retryURL) && (this._wci != null))
+/* */ {
+/* 159 */ if (this._wci.setURL(this._textureURL, this._postTextureData)) {
+/* 160 */ this._retryURL = false;
+/* */ } else {
+/* 162 */ return false;
+/* */ }
+/* */ }
+/* 165 */ if (this._surface != null)
+/* */ {
+/* 167 */ if ((this.frameCnt > this._refresh) || (this.frameCnt == -1))
+/* */ {
+/* 169 */ if ((this.frameCnt != -1) && (this._refresh == -1)) {
+/* 170 */ return false;
+/* */ }
+/* 172 */ this.frameCnt = 0;
+/* 173 */ draw();
+/* */ }
+/* */ else
+/* */ {
+/* 177 */ this.frameCnt += 1;
+/* */ }
+/* */ }
+/* */ }
+/* */
+/* 182 */ return false;
+/* */ }
+/* */
+/* 185 */ public WebControlImp getWebControlImp() { return this._wci; }
+/* */
+/* */ private void assignMaterial()
+/* */ {
+/* 189 */ int xTex = this._xSurface / 128;
+/* 190 */ if (xTex < 1) xTex = 1;
+/* 191 */ int yTex = this._ySurface / 128;
+/* 192 */ if (yTex < 1) { yTex = 1;
+/* */ }
+/* 194 */ this._surface = null;
+/* */
+/* 196 */ if (this._wci != null)
+/* 197 */ this._wci.detach();
+/* 198 */ this._wci = null;
+/* */
+/* 200 */ this._rows = yTex;
+/* */
+/* 202 */ this._material = new Material(URL.make(this._defTextureURL),
+/* 203 */ xTex, yTex);
+/* 204 */ setMaterial(this._material);
+/* */
+/* 206 */ this._textures = this._material.getTextures();
+/* 207 */ this._surface = new TextureSurface(this._textures, yTex, this._xSurface,
+/* 208 */ this._ySurface);
+/* */ try
+/* */ {
+/* 211 */ this._wci = WebControlFactory.createWebControlImp(
+/* 212 */ this._surface.getHwnd(), false, this._isAdBanner);
+/* */ }
+/* */ catch (NoWebControlException e)
+/* */ {
+/* 216 */ System.out.println("Could not create MSIE control for billboard.");
+/* */
+/* 218 */ this._wci = null;
+/* 219 */ return;
+/* */ }
+/* 221 */ if (!this._wci.setURL(this._textureURL, this._postTextureData)) {
+/* 222 */ this._retryURL = true;
+/* */ }
+/* 224 */ this._wci.addListener(this);
+/* */ }
+/* */
+/* */ public synchronized void draw()
+/* */ {
+/* 229 */ if ((this._surface != null) && (this._wci != null))
+/* */ {
+/* 231 */ this._surface.setTextures(this._material.getTextures(), this._rows);
+/* 232 */ this._surface.draw(this._wci);
+/* */ }
+/* */ }
+/* */
+/* */ public void webControlEvent(int eventID)
+/* */ {
+/* 238 */ if ((eventID == 1) && (this._refresh == -1)) {
+/* 239 */ draw();
+/* */ }
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 249 */ Object ret = null;
+/* 250 */ switch (index - offset) {
+/* */ case 0:
+/* 252 */ if (mode == 0) {
+/* 253 */ ret = StringPropertyEditor.make(
+/* 254 */ new Property(this, index, "Wall's URL"));
+/* 255 */ } else if (mode == 1) {
+/* 256 */ ret = this._textureURL;
+/* 257 */ } else if (mode == 2)
+/* */ {
+/* 259 */ this._textureURL = ((String)value);
+/* 260 */ rebuild();
+/* */ }
+/* 262 */ break;
+/* */ case 1:
+/* 264 */ if (mode == 0) {
+/* 265 */ ret = StringPropertyEditor.make(
+/* 266 */ new Property(this, index, "Wall's POST data"));
+/* 267 */ } else if (mode == 1) {
+/* 268 */ ret = this._postTextureData;
+/* 269 */ } else if (mode == 2)
+/* */ {
+/* 271 */ this._postTextureData = ((String)value);
+/* 272 */ rebuild();
+/* */ }
+/* 274 */ break;
+/* */ case 2:
+/* 276 */ if (mode == 0) {
+/* 277 */ ret = IntegerPropertyEditor.make(
+/* 278 */ new Property(this, index, "Wall Page Width (pixels)"),
+/* 279 */ 0, 1024);
+/* 280 */ } else if (mode == 1) {
+/* 281 */ ret = new Integer(this._xSurface);
+/* 282 */ } else if (mode == 2)
+/* */ {
+/* 284 */ this._xSurface = ((Integer)value).intValue();
+/* 285 */ rebuild();
+/* */ }
+/* 287 */ break;
+/* */ case 3:
+/* 289 */ if (mode == 0) {
+/* 290 */ ret = IntegerPropertyEditor.make(
+/* 291 */ new Property(this, index, "Wall Page Height (pixels)"),
+/* 292 */ 0, 1024);
+/* 293 */ } else if (mode == 1) {
+/* 294 */ ret = new Integer(this._ySurface);
+/* 295 */ } else if (mode == 2)
+/* */ {
+/* 297 */ this._ySurface = ((Integer)value).intValue();
+/* 298 */ rebuild();
+/* */ }
+/* 300 */ break;
+/* */ case 4:
+/* 302 */ if (mode == 0) {
+/* 303 */ ret = IntegerPropertyEditor.make(
+/* 304 */ new Property(this, index, "Wall Refresh Rate (frames)"),
+/* 305 */ -1, 1024);
+/* 306 */ } else if (mode == 1) {
+/* 307 */ ret = new Integer(this._refresh);
+/* 308 */ } else if (mode == 2)
+/* 309 */ this._refresh = ((Integer)value).intValue();
+/* 310 */ break;
+/* */ case 5:
+/* 312 */ if (mode == 0) {
+/* 313 */ ret = BooleanPropertyEditor.make(
+/* 314 */ new Property(this, index, "Use Scrollbars"),
+/* 315 */ "No",
+/* 316 */ "Yes");
+/* 317 */ } else if (mode == 1) {
+/* 318 */ ret = new Boolean(!this._isAdBanner);
+/* 319 */ } else if (mode == 2)
+/* 320 */ this._isAdBanner = (!((Boolean)value).booleanValue());
+/* 321 */ break;
+/* */ case 6:
+/* 323 */ if (mode == 0) {
+/* 324 */ ret = BooleanPropertyEditor.make(
+/* 325 */ new Property(this, index, "Pass clicks"),
+/* 326 */ "No - Click launches target page",
+/* 327 */ "Yes - Mouse events passed through to wall page");
+/* 328 */ } else if (mode == 1) {
+/* 329 */ ret = new Boolean(this._passClicks);
+/* 330 */ } else if (mode == 2)
+/* 331 */ this._passClicks = ((Boolean)value).booleanValue();
+/* 332 */ break;
+/* */ case 7:
+/* 334 */ if (mode == 0) {
+/* 335 */ ret = StringPropertyEditor.make(
+/* 336 */ new Property(this, index, "Target URL for click"));
+/* 337 */ } else if (mode == 1) {
+/* 338 */ ret = this._adURL;
+/* 339 */ } else if (mode == 2)
+/* 340 */ this._adURL = ((String)value);
+/* 341 */ break;
+/* */ case 8:
+/* 343 */ if (mode == 0) {
+/* 344 */ ret = StringPropertyEditor.make(
+/* 345 */ new Property(this, index, "Target's POST data"));
+/* 346 */ } else if (mode == 1) {
+/* 347 */ ret = this._postAdData;
+/* 348 */ } else if (mode == 2)
+/* */ {
+/* 350 */ this._postAdData = ((String)value);
+/* 351 */ rebuild();
+/* */ }
+/* 353 */ break;
+/* */ case 9:
+/* 355 */ if (mode == 0) {
+/* 356 */ ret = BooleanPropertyEditor.make(
+/* 357 */ new Property(this, index, "Target Page Size Units"),
+/* 358 */ "Percentage", "Pixels");
+/* 359 */ } else if (mode == 1) {
+/* 360 */ ret = new Boolean(this._isFixed);
+/* 361 */ } else if (mode == 2)
+/* 362 */ this._isFixed = ((Boolean)value).booleanValue();
+/* 363 */ break;
+/* */ case 10:
+/* 365 */ if (mode == 0) {
+/* 366 */ ret = IntegerPropertyEditor.make(
+/* 367 */ new Property(this, index, "Target X Overlay % or Width"),
+/* 368 */ 0, 1024);
+/* 369 */ } else if (mode == 1) {
+/* 370 */ ret = new Integer(this._xPercent);
+/* 371 */ } else if (mode == 2)
+/* 372 */ this._xPercent = ((Integer)value).intValue();
+/* 373 */ break;
+/* */ case 11:
+/* 375 */ if (mode == 0) {
+/* 376 */ ret = IntegerPropertyEditor.make(
+/* 377 */ new Property(this, index, "Target Y Overlay % or Height"),
+/* 378 */ 0, 1024);
+/* 379 */ } else if (mode == 1) {
+/* 380 */ ret = new Integer(this._yPercent);
+/* 381 */ } else if (mode == 2)
+/* 382 */ this._yPercent = ((Integer)value).intValue();
+/* 383 */ break;
+/* */ case 12:
+/* 385 */ if (mode == 0) {
+/* 386 */ ret = BooleanPropertyEditor.make(
+/* 387 */ new Property(this, index, "Target Page Has Toolbar"),
+/* 388 */ "No", "Yes");
+/* 389 */ } else if (mode == 1) {
+/* 390 */ ret = new Boolean(this._hasToolbar);
+/* 391 */ } else if (mode == 2)
+/* 392 */ this._hasToolbar = ((Boolean)value).booleanValue();
+/* 393 */ break;
+/* */
+/* */ default:
+/* 396 */ ret = super.properties(index, offset + 13, mode, value);
+/* */ }
+/* */
+/* 399 */ if (mode == 2) {
+/* 400 */ rebuild();
+/* */ }
+/* 402 */ return ret;
+/* */ }
+/* */
+/* */
+/* 406 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 410 */ s.saveVersion(3, classCookie);
+/* 411 */ super.saveState(s);
+/* */
+/* 413 */ s.saveString(this._adURL);
+/* 414 */ s.saveString(this._textureURL);
+/* 415 */ s.saveInt(this._xPercent);
+/* 416 */ s.saveInt(this._yPercent);
+/* 417 */ s.saveBoolean(this._hasToolbar);
+/* 418 */ s.saveBoolean(this._isFixed);
+/* 419 */ s.saveInt(this._xSurface);
+/* 420 */ s.saveInt(this._ySurface);
+/* 421 */ s.saveInt(this._refresh);
+/* 422 */ s.saveBoolean(this._passClicks);
+/* 423 */ s.saveBoolean(this._isAdBanner);
+/* 424 */ s.saveString(this._postTextureData);
+/* 425 */ s.saveString(this._postAdData);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 430 */ switch (r.restoreVersion(classCookie)) {
+/* */ case 1:
+/* 432 */ super.restoreState(r);
+/* 433 */ this._adURL = r.restoreString();
+/* 434 */ this._textureURL = r.restoreString();
+/* 435 */ this._xPercent = r.restoreInt();
+/* 436 */ this._yPercent = r.restoreInt();
+/* 437 */ this._hasToolbar = r.restoreBoolean();
+/* 438 */ this._isFixed = r.restoreBoolean();
+/* 439 */ this._xSurface = r.restoreInt();
+/* 440 */ this._ySurface = r.restoreInt();
+/* 441 */ this._refresh = r.restoreInt();
+/* 442 */ this._passClicks = r.restoreBoolean();
+/* 443 */ this._isAdBanner = r.restoreBoolean();
+/* 444 */ break;
+/* */
+/* */ case 2:
+/* 447 */ super.restoreState(r);
+/* 448 */ this._adURL = r.restoreString();
+/* 449 */ this._textureURL = r.restoreString();
+/* 450 */ this._xPercent = r.restoreInt();
+/* 451 */ this._yPercent = r.restoreInt();
+/* 452 */ this._hasToolbar = r.restoreBoolean();
+/* 453 */ this._isFixed = r.restoreBoolean();
+/* 454 */ this._xSurface = r.restoreInt();
+/* 455 */ this._ySurface = r.restoreInt();
+/* 456 */ this._refresh = r.restoreInt();
+/* 457 */ this._passClicks = r.restoreBoolean();
+/* 458 */ this._isAdBanner = r.restoreBoolean();
+/* 459 */ this._postTextureData = r.restoreString();
+/* 460 */ break;
+/* */
+/* */ case 3:
+/* 463 */ super.restoreState(r);
+/* 464 */ this._adURL = r.restoreString();
+/* 465 */ this._textureURL = r.restoreString();
+/* 466 */ this._xPercent = r.restoreInt();
+/* 467 */ this._yPercent = r.restoreInt();
+/* 468 */ this._hasToolbar = r.restoreBoolean();
+/* 469 */ this._isFixed = r.restoreBoolean();
+/* 470 */ this._xSurface = r.restoreInt();
+/* 471 */ this._ySurface = r.restoreInt();
+/* 472 */ this._refresh = r.restoreInt();
+/* 473 */ this._passClicks = r.restoreBoolean();
+/* 474 */ this._isAdBanner = r.restoreBoolean();
+/* 475 */ this._postTextureData = r.restoreString();
+/* 476 */ this._postAdData = r.restoreString();
+/* 477 */ break;
+/* */ default:
+/* 479 */ throw new TooNewException();
+/* */ }
+/* */
+/* 482 */ rebuild();
+/* */ }
+/* */
+/* */ public boolean acceptsLeftClicks()
+/* */ {
+/* 487 */ if (getIsAdBanner()) {
+/* 488 */ return true;
+/* */ }
+/* 490 */ return getMouseOver();
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\WebPageWall.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file