home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Graphics;
- import java.awt.Image;
- import java.awt.MediaTracker;
- import java.net.URL;
-
- public final class ANIStatus implements Runnable {
- public static final int ST_IMAGES = 6;
- public static final int IMG_AUDIO = 0;
- public static final int IMG_AUDIOOFF = 1;
- public static final int IMG_DOCOFF = 2;
- public static final int IMG_DOC = 3;
- public static final int IMG_LOADINGOFF = 4;
- public static final int IMG_LOADING = 5;
- private ANI Applet;
- // $FF: renamed from: t java.lang.Thread
- private Thread field_0;
- private ANIStatusCanvas canvas;
- private ANIAgentCanvas aCanvas;
- private MediaTracker tracker;
- private Image stImgLoad;
- private boolean fImgsToLoad;
- private boolean fRepaint = true;
- public Image[] stImgs;
- public boolean fAudio = true;
- public boolean fLoading;
- public boolean fDoc;
- public boolean fLoadingOn;
- private long lLoadingNextChange;
- public boolean fDocOn;
- private long lDocNextChange;
- private int iDocRemaining;
- private int iImgsMoving;
- private Image helpImgLoad;
-
- public void stop() {
- if (this.field_0 != null) {
- this.field_0.stop();
- this.field_0 = null;
- }
-
- }
-
- public ANIStatus(ANI var1, ANIStatusCanvas var2, ANIAgentCanvas var3) {
- this.Applet = var1;
- this.canvas = var2;
- this.aCanvas = var3;
- this.stImgs = new Image[6];
- this.tracker = new MediaTracker(this.Applet);
-
- try {
- URL var4 = new URL(this.Applet.getCodeBase(), "ANIStati.gif");
- this.stImgLoad = this.Applet.getImage(var4);
- this.tracker.addImage(this.stImgLoad, 1);
- if (this.Applet.helpImage != null) {
- this.helpImgLoad = this.Applet.getImage(ANIScript.getURL("HelpImage", this.Applet.helpImage, this.Applet.getDocumentBase()));
- this.tracker.addImage(this.helpImgLoad, 2);
- }
-
- this.fImgsToLoad = true;
- } catch (Exception var5) {
- }
- }
-
- private final void repaintAgent() {
- int var1 = 200;
- this.aCanvas.fStatusPaint = true;
- this.aCanvas.fUpdate = true;
- this.aCanvas.repaint();
-
- while(this.aCanvas.fUpdate) {
- --var1;
- if (var1 <= 0) {
- break;
- }
-
- this.wait(1);
- }
-
- this.aCanvas.fUpdate = false;
- }
-
- public void setAudioFlag(boolean var1) {
- if (var1 != this.fAudio) {
- this.fAudio = var1;
- this.fRepaint = true;
- }
-
- }
-
- private final void wait(int var1) {
- try {
- Thread.sleep((long)var1);
- } catch (InterruptedException var2) {
- }
- }
-
- public void setLoadingFlag(boolean var1) {
- if (var1 != this.fLoading) {
- this.fLoading = var1;
- this.fLoadingOn = var1;
- if (this.fLoading) {
- this.lLoadingNextChange = System.currentTimeMillis() + 1000L;
- }
-
- ++this.iImgsMoving;
- this.fRepaint = true;
- }
-
- }
-
- public void setLinkingFlag(boolean var1) {
- if (var1 != this.fDoc) {
- if (this.aCanvas.fOS != var1) {
- ++this.iImgsMoving;
- }
-
- this.fDoc = var1;
- this.fDocOn = var1;
- this.aCanvas.fOS = var1;
- if (this.fDoc) {
- this.lDocNextChange = System.currentTimeMillis() + 1000L;
- this.iDocRemaining = 3;
- }
-
- this.fRepaint = true;
- }
-
- }
-
- public void start() {
- if (this.field_0 == null) {
- this.field_0 = new Thread(this);
- this.field_0.start();
- }
-
- }
-
- private final void repaintCanvas() {
- int var1 = 200;
- this.canvas.fUpdate = true;
- this.canvas.repaint();
-
- while(this.canvas.fUpdate) {
- --var1;
- if (var1 <= 0) {
- break;
- }
-
- this.wait(1);
- }
-
- this.canvas.fUpdate = false;
- this.fRepaint = false;
- }
-
- public void run() {
- while(this.field_0 != null) {
- if (this.fImgsToLoad) {
- boolean var1 = this.tracker.checkID(1, true);
- if (!var1) {
- this.fImgsToLoad = true;
- } else {
- this.fImgsToLoad = false;
- if (!this.tracker.isErrorID(1)) {
- this.Applet.waitForImage(this.stImgLoad);
- int var5 = 0;
-
- do {
- this.stImgs[var5] = this.Applet.ANICreateImage(16, 16);
- Graphics var4 = this.stImgs[var5].getGraphics();
- this.Applet.ANIDrawImage(var4, this.stImgLoad, -var5 * 16, 0, this.canvas);
- ++var5;
- } while(var5 < 6);
-
- this.aCanvas.imgLS = this.Applet.ANICreateImage(62, 23);
- Graphics var7 = this.aCanvas.imgLS.getGraphics();
- this.Applet.ANIDrawImage(var7, this.stImgLoad, 0, -16, this.canvas);
- this.aCanvas.imgOS = this.Applet.ANICreateImage(55, 14);
- var7 = this.aCanvas.imgOS.getGraphics();
- this.Applet.ANIDrawImage(var7, this.stImgLoad, 0, -39, this.canvas);
- this.fRepaint = true;
- }
- }
-
- if (this.Applet.helpImage != null) {
- var1 = this.tracker.checkID(2, true);
- if (var1) {
- if (!this.tracker.isErrorID(2)) {
- this.Applet.waitForImage(this.helpImgLoad);
- this.Applet.wHelpImg = this.helpImgLoad.getWidth(this.Applet);
- this.Applet.hHelpImg = this.helpImgLoad.getHeight(this.Applet);
- this.Applet.helpImg = this.helpImgLoad;
- }
- } else {
- this.fImgsToLoad = true;
- }
- }
- }
-
- long var2 = System.currentTimeMillis();
- if (this.fLoading && var2 > this.lLoadingNextChange) {
- if (this.fLoadingOn) {
- this.lLoadingNextChange = var2 + 500L;
- } else {
- this.lLoadingNextChange = var2 + 1000L;
- }
-
- this.fLoadingOn = !this.fLoadingOn;
- this.fRepaint = true;
- }
-
- if (this.fDoc && var2 > this.lDocNextChange) {
- if (this.fDocOn) {
- this.lDocNextChange = var2 + 500L;
- } else {
- this.lDocNextChange = var2 + 1000L;
- if ((this.iDocRemaining += -1) < 0) {
- this.fDoc = false;
- this.fDocOn = true;
- ++this.iImgsMoving;
- }
- }
-
- this.fDocOn = !this.fDocOn;
- this.fRepaint = true;
- }
-
- if (this.fRepaint) {
- this.repaintCanvas();
- }
-
- if (this.iImgsMoving != 0 && !this.fImgsToLoad) {
- if (this.fLoading && !this.aCanvas.fLS && this.Applet.agent.fScriptLoaded) {
- this.aCanvas.fLS = true;
- }
-
- if (!this.aCanvas.fLS && !this.aCanvas.fOS) {
- this.wait(250);
- } else {
- boolean var9 = false;
- if (this.aCanvas.fLS) {
- if (this.fLoading && this.aCanvas.xLS > this.aCanvas.wOld - 62) {
- this.aCanvas.xLS = Math.max(this.aCanvas.xLS - 3, this.aCanvas.wOld - 62);
- var9 = true;
- }
-
- if (!this.fLoading && this.aCanvas.xLS < this.aCanvas.wOld) {
- this.aCanvas.xLS = Math.min(this.aCanvas.xLS + 3, this.aCanvas.wOld);
- var9 = true;
- }
-
- if (!var9) {
- this.iImgsMoving += -1;
- if (!this.fLoading) {
- this.aCanvas.fLS = false;
- }
- }
- }
-
- if (this.aCanvas.fOS) {
- var9 = false;
- if (this.fDoc && this.aCanvas.xOS > this.aCanvas.wOld - 55) {
- this.aCanvas.xOS = Math.max(this.aCanvas.xOS - 3, this.aCanvas.wOld - 55);
- var9 = true;
- }
-
- if (!this.fDoc && this.aCanvas.xOS < this.aCanvas.wOld) {
- this.aCanvas.xOS = Math.min(this.aCanvas.xOS + 3, this.aCanvas.wOld);
- var9 = true;
- }
-
- if (!var9) {
- this.iImgsMoving += -1;
- if (!this.fDoc) {
- this.aCanvas.fOS = false;
- }
- }
- }
-
- this.repaintAgent();
- }
- } else {
- if (this.fLoading) {
- this.repaintAgent();
- }
-
- this.wait(250);
- }
- }
-
- }
- }
-