home *** CD-ROM | disk | FTP | other *** search
Wrap
import java.applet.Applet; import java.applet.AudioClip; import java.awt.Color; import java.awt.Component; import java.awt.Container; import java.awt.Frame; import java.awt.Graphics; import java.awt.Image; import java.awt.MediaTracker; import java.net.URL; import java.util.Date; import java.util.Random; class common { static int soundOff; static int whichStep; static Color[] theColors = new Color[13]; static String teststring; static boolean inAd; int clientX; int clientY; int clientW; int clientH; int whichBase; String background; String bgcolor; AudioClip[] hideSound; int numHideSound; String[] hideSoundName = new String[50]; int delayLoadAudio = 100; Applet m_parent; int bState; String action = "URL"; int releaseLevel; int TheShareware = 2; int TheAdware = 1; int TheDemo; String Name; int showAd = 1000; int showAdCount; // $FF: renamed from: wb int int field_0; // $FF: renamed from: hb int int field_1; // $FF: renamed from: w int int field_2; // $FF: renamed from: h int int field_3; String mmmm; Graphics gBufBK; Image bufBK; boolean bBackgroundOK = false; Color colForeground; String colForegroundName = "STATIC"; Color colBackground; String colBackgroundName; Color fixCaptionColor; String fixCaptionColorName = "STATIC"; Image imgBackground; // $FF: renamed from: rr java.util.Random Random field_4; // $FF: renamed from: dd java.util.Date static Date field_5 = new Date(); int disableLevel = 2; static String myAd = "GO Coolshare!! You will explore COOL: Free Java applets, the best screen savers in the world, Cool resource to build your web pages, date through the Web, and more!! Go http://www.aimnet.com/~markqian to get them!!"; static String myAddress = "http://www.coolshare.com"; String whatWare = "evaluateShareware"; String homeURL; URL uhomeURL; String TheStatus; String aboutMe = "Go http://www.coolshare.com to get COOL shareware, applets, and more COOL stuff!!"; MediaTracker tracker; public common(Applet var1) { this.m_parent = var1; theColors[0] = Color.black; theColors[1] = Color.blue; theColors[2] = Color.cyan; theColors[3] = Color.darkGray; theColors[4] = Color.gray; theColors[5] = Color.green; theColors[6] = Color.lightGray; theColors[7] = Color.magenta; theColors[8] = Color.orange; theColors[9] = Color.pink; theColors[10] = Color.red; theColors[11] = Color.white; theColors[12] = Color.yellow; this.field_4 = new Random(); this.field_4.setSeed((long)(field_5.getMinutes() * field_5.getSeconds())); } public void turnSoundOff(int var1) { soundOff = var1; } public void doSound(int var1) { System.out.println("Enter doSound"); if (soundOff != 1 && var1 <= this.numHideSound && var1 >= 1) { if (this.hideSound[var1] != null) { this.hideSound[var1].play(); } else { System.out.println("hideSound[" + var1 + "]=null"); } } else { if (soundOff == 1) { System.out.println("soundOff==1"); } if (var1 > this.numHideSound) { System.out.println("which>numHideSound"); } if (var1 < 1) { System.out.println("which<1"); } System.out.println("Before return"); } } public void drawButtonBorder(int var1, Graphics var2, int var3, int var4, int var5, int var6) { int[] var7 = new int[6]; int[] var8 = new int[6]; if (var1 == 0) { var2.setColor(Color.white); } else { var2.setColor(Color.darkGray); } var7[0] = 0; var8[0] = 0; var7[1] = 0; var8[1] = var4; var7[2] = var5; var8[2] = var4 - var6; var7[3] = var5; var8[3] = var6; var7[4] = var3 - var5; var8[4] = var6; var7[5] = var3; var8[5] = 0; var2.fillPolygon(var7, var8, 6); if (var1 == 1) { var2.setColor(Color.white); } else { var2.setColor(Color.darkGray); } var2.drawPolygon(var7, var8, 6); if (var1 == 0) { var2.setColor(Color.darkGray); } else { var2.setColor(Color.white); } var2.fillRect(var5, var6, var3, var4); var2.setColor(Color.lightGray); var2.fillRect(var5, var6, var3 - 2 * var5, var4 - 2 * var6); var2.drawLine(0, 0, var5, var6); if (var1 == 0) { var2.setColor(Color.darkGray); } else { var2.setColor(Color.white); } var7[0] = var3; var8[0] = var4; var7[1] = 0; var8[1] = var4; var7[2] = var5; var8[2] = var4 - var6; var7[3] = var3 - var5; var8[3] = var4 - var6; var7[4] = var3 - var5; var8[4] = var6; var7[5] = var3; var8[5] = 0; var2.fillPolygon(var7, var8, 6); var2.drawLine(0, 0, var5, var6); if (var1 == 1) { var2.setColor(Color.darkGray); } else { var2.setColor(Color.white); } var2.drawPolygon(var7, var8, 6); if (var1 == 0) { var2.setColor(Color.white); } else { var2.setColor(Color.darkGray); } var2.drawLine(var3 - var5, var4 - var6, var3, var4); var2.setColor(Color.lightGray); var7[0] = var5; var8[0] = var6; var7[1] = var3 - var5; var8[1] = var6; var7[2] = var3 - var5; var8[2] = var4 - var6; var7[3] = var5; var8[3] = var4 - var6; var2.fillPolygon(var7, var8, 4); } Color getColorFromParam(String var1, Color var2) { byte var7 = 0; String var3; if ((var3 = this.m_parent.getParameter(var1)) == null) { return var2; } else { if (var3.startsWith("#")) { var7 = 1; } int var4; int var5; int var6; try { var4 = Integer.parseInt(var3.substring(var7, 2 + var7), 16); var6 = Integer.parseInt(var3.substring(2 + var7, 4 + var7), 16); var5 = Integer.parseInt(var3.substring(4 + var7, 6 + var7), 16); } catch (Exception var8) { System.out.println("parseInt failed"); return var2; } return new Color(var4, var6, var5); } } public void iniCommon() { Date var3 = new Date(); this.field_4.setSeed((long)(var3.getMinutes() * var3.getSeconds())); String var1 = this.m_parent.getParameter("whatWare"); this.whatWare = var1 != null ? var1 : "evaluateShareware"; if (!this.whatWare.equalsIgnoreCase("evaluateShareware") && !this.whatWare.equalsIgnoreCase("AdWare")) { this.whatWare = "evaluateShareware"; } if (this.releaseLevel == this.TheShareware) { this.disableLevel = 0; } else if (this.whatWare.equalsIgnoreCase("AdWare")) { this.disableLevel = 1; } else if ((var3.getHours() < 7 || var3.getHours() > 18) && this.releaseLevel <= this.TheShareware && this.releaseLevel >= this.TheAdware) { this.disableLevel = 0; } else { this.disableLevel = 2; } this.tracker = new MediaTracker(this.m_parent); var1 = this.m_parent.getParameter("action"); this.action = var1 != null ? var1 : "URL"; if (!this.action.equalsIgnoreCase("URL") && !this.action.equalsIgnoreCase("SoundSwitch")) { this.action = "URL"; } var1 = this.m_parent.getParameter("nice"); if (var1 != null) { this.showAd *= 2; } var1 = this.m_parent.getParameter("status_text"); if (this.disableLevel > 0) { this.TheStatus = this.aboutMe; } var1 = this.m_parent.getParameter("on_click"); if (this.disableLevel == 2) { this.homeURL = myAddress; } else { this.homeURL = var1 != null ? var1 : myAddress; } var1 = this.m_parent.getParameter("delayLoadAudio"); this.delayLoadAudio = var1 == null ? 100 : Integer.valueOf(var1); var1 = this.m_parent.getParameter("whichBase"); this.whichBase = var1 == null ? 0 : Integer.valueOf(var1); int var2 = 0; do { ++var2; this.hideSoundName[var2] = this.m_parent.getParameter("hideSound" + var2); } while(this.hideSoundName[var2] != null); this.numHideSound = var2 - 1; if (this.numHideSound > 0) { this.hideSound = new AudioClip[this.numHideSound + 1]; for(int var12 = 1; var12 <= this.numHideSound; ++var12) { this.hideSound[var12] = null; } } var1 = this.m_parent.getParameter("borderWidth"); this.field_0 = var1 == null ? 0 : Integer.valueOf(var1); var1 = this.m_parent.getParameter("borderHeight"); this.field_1 = var1 == null ? 0 : Integer.valueOf(var1); if (this.m_parent.size().width > 0 && this.m_parent.size().height > 0) { this.clientW = this.m_parent.size().width - 2 * this.field_0; this.clientH = this.m_parent.size().height - 2 * this.field_1; this.clientX = this.field_0; this.clientY = this.field_1; this.bufBK = this.m_parent.createImage(this.m_parent.size().width, this.m_parent.size().height); this.gBufBK = this.bufBK.getGraphics(); } else { this.clientW = 0; } this.setColors("bgcolor"); this.setColors("fgcolor"); this.background = this.m_parent.getParameter("background"); if (this.background != null && !this.background.equals("")) { if (this.whichBase == 0) { this.imgBackground = this.m_parent.getImage(this.m_parent.getDocumentBase(), this.background); } else { this.imgBackground = this.m_parent.getImage(this.m_parent.getCodeBase(), this.background); } } if (this.imgBackground != null) { this.bBackgroundOK = true; this.tracker.addImage(this.imgBackground, 0); } } public void loadHideSound() { System.out.println("Enter loadHideSound"); if (this.numHideSound > 0) { for(int var1 = 1; var1 <= this.numHideSound; ++var1) { if (this.whichBase == 0) { this.hideSound[var1] = this.m_parent.getAudioClip(this.m_parent.getDocumentBase(), this.hideSoundName[var1]); } else { this.hideSound[var1] = this.m_parent.getAudioClip(this.m_parent.getCodeBase(), this.hideSoundName[var1]); } System.out.println("hideSound[" + var1 + "]=" + this.hideSound[var1]); } } } public void maintainBK() { int var1 = 0; int var2 = 0; if (this.bBackgroundOK && this.imgBackground != null) { if ((var1 = this.imgBackground.getWidth(this.m_parent)) > 0 && (var2 = this.imgBackground.getHeight(this.m_parent)) > 0) { for(int var8 = 0; var8 < this.bufBK.getWidth(this.m_parent); var8 += var1) { for(int var9 = 0; var9 < this.bufBK.getHeight(this.m_parent); var9 += var2) { this.m_parent.showStatus("Applet is preparing background images..."); this.gBufBK.drawImage(this.imgBackground, var8, var9, this.m_parent); } } return; } } else { Color var3; if (this.colBackgroundName.equalsIgnoreCase("vary")) { Date var4 = new Date(); this.field_4.setSeed((long)(var4.getMinutes() * var4.getSeconds())); float var5 = this.field_4.nextFloat(); var3 = theColors[(int)(var5 * 12.0F)]; } else { var3 = this.colBackground; } this.gBufBK.setColor(var3); this.gBufBK.fillRect(0, 0, this.bufBK.getWidth(this.m_parent), this.bufBK.getHeight(this.m_parent)); } } public Color getTheColor(String var1, int var2) { if (var1.equalsIgnoreCase("vary")) { return theColors[(int)(this.field_4.nextFloat() * 12.0F)]; } else if (var2 == 0) { return this.colForeground; } else { return var2 == 1 ? this.colBackground : this.fixCaptionColor; } } public void setColors(String var1) { Object var2 = null; String var3 = this.m_parent.getParameter(var1); if (var1.equalsIgnoreCase("fgcolor")) { if (var3 != null && var3.equalsIgnoreCase("null")) { var3 = null; } this.colForegroundName = var3 != null ? var3 : "STATIC"; if (!this.colForegroundName.equalsIgnoreCase("STATIC") && !this.colForegroundName.equalsIgnoreCase("vary")) { this.colForeground = this.getColorFromParam("fgcolor", Color.black); return; } } else if (var1.equalsIgnoreCase("bgcolor")) { if (var3 != null && var3.equalsIgnoreCase("null")) { var3 = null; } this.bgcolor = var3; this.colBackgroundName = var3 != null ? var3 : "STATIC"; if (!this.colBackgroundName.equalsIgnoreCase("STATIC") && !this.colBackgroundName.equalsIgnoreCase("vary")) { this.colBackground = this.getColorFromParam(var1, Color.pink); return; } } else if (var1.equalsIgnoreCase("fixCaptionColor")) { if (var3 != null && var3.equalsIgnoreCase("null")) { var3 = null; } this.fixCaptionColorName = var3 != null ? var3 : "STATIC"; if (!this.fixCaptionColorName.equalsIgnoreCase("STATIC") && !this.fixCaptionColorName.equalsIgnoreCase("vary")) { this.fixCaptionColor = this.getColorFromParam(var1, Color.black); } } } public void setTheCursor(int var1) { Container var2; for(var2 = this.m_parent.getParent(); !(var2 instanceof Frame); var2 = ((Component)var2).getParent()) { } ((Frame)var2).setCursor(var1); } }