diff --git a/lib/resource/deselected_button.png b/lib/resource/deselected_button.png
new file mode 100644
index 0000000..e4bfd2d
Binary files /dev/null and b/lib/resource/deselected_button.png differ
diff --git a/lib/resource/selected_button.png b/lib/resource/selected_button.png
new file mode 100644
index 0000000..f940b1b
Binary files /dev/null and b/lib/resource/selected_button.png differ
diff --git a/lib/resource/text/introText.html b/lib/resource/text/introText.html
index ba7c290..0016b20 100644
--- a/lib/resource/text/introText.html
+++ b/lib/resource/text/introText.html
@@ -1 +1 @@
-
Hello World!
\ No newline at end of file
+
sigIRC allows you to present dynamic content to viewers on stream and provides various features that may be helpful to you as a streamer. Click Next to begin the setup process.
\ No newline at end of file
diff --git a/lib/resource/text/setupProgramSettings.html b/lib/resource/text/setupProgramSettings.html
new file mode 100644
index 0000000..d1f6a4e
--- /dev/null
+++ b/lib/resource/text/setupProgramSettings.html
@@ -0,0 +1,12 @@
+Now it's time to configure basic features of sigIRC. sigIRC provides the following modules:
+
+
+- Scrolling Chat - Displays scrolling chat messages across the screen as users of your channel talk.
+- Chat Log - Displays a box that contains the latest chat messages from your channel for that day.
+- Controller - Displays a controller on screen and allows you to configure the buttons and display so viewers can see your button inputs.
+- Twitch - Displays a bar that shows your channel's stream uptime, number of followers, channel view, and current viewers. Also announces new followers of your stream.
+- Rabi-Race - For the game Rabi-Ribi. A tracker that allows players of the game to connect to each other in game rooms and see each others' progress as they race. Supports randomizer Egg Hunts and Item Hunts.
+- Touhou Mother - For the game Touhou Mother. A tracker that displays boss health whenever you get into a boss encounter, the amount of time the boss fight takes, and how much damage your party members deal.
+
+
+Each module will open up in a separate window that you can place and resize on your screen as you see fit.
\ No newline at end of file
diff --git a/lib/resource/text/setupTwitchName.html b/lib/resource/text/setupTwitchName.html
new file mode 100644
index 0000000..849e436
--- /dev/null
+++ b/lib/resource/text/setupTwitchName.html
@@ -0,0 +1 @@
+sigIRC uses your Twitch account in order to retrieve and send data. Please input your Twitch username below and hit Next to continue. You will be asked for authentication details on the next screen.
\ No newline at end of file
diff --git a/lib/resource/text/setupoauthToken.html b/lib/resource/text/setupoauthToken.html
new file mode 100644
index 0000000..0db1fda
--- /dev/null
+++ b/lib/resource/text/setupoauthToken.html
@@ -0,0 +1 @@
+Below you will see a button to https://twitchapps.com/tmi/ which will allow you to retrieve an oauth Token. Connect to Twitch and generate an oauth token, then copy and paste the token into the box below to grant this program the ability to use Twitch services.
\ No newline at end of file
diff --git a/sigIRCv2.jar b/sigIRCv2.jar
index 5f337e6..8c9efbc 100644
Binary files a/sigIRCv2.jar and b/sigIRCv2.jar differ
diff --git a/src/sig/Emoticon.java b/src/sig/Emoticon.java
index 4f01edb..0fcbcab 100644
--- a/src/sig/Emoticon.java
+++ b/src/sig/Emoticon.java
@@ -31,8 +31,8 @@ public class Emoticon {
System.out.println("Saved to "+file.getName()+".");
emotename = emoteName;
}
- spacefiller = GetSpaceLength(sigIRC.panel.programFont);
- spacefillersmall = GetSpaceLength(sigIRC.panel.userFont);
+ spacefiller = GetSpaceLength(sigIRC.programFont);
+ spacefillersmall = GetSpaceLength(sigIRC.userFont);
//System.out.println("Space size for "+emotename+" is "+spacefiller.length());
} catch (IOException e) {
e.printStackTrace();
@@ -49,8 +49,8 @@ public class Emoticon {
image = ImageIO.read(file);
emotename = emoteName;
}
- spacefiller = GetSpaceLength(sigIRC.panel.programFont);
- spacefillersmall = GetSpaceLength(sigIRC.panel.userFont);
+ spacefiller = GetSpaceLength(sigIRC.programFont);
+ spacefillersmall = GetSpaceLength(sigIRC.userFont);
//System.out.println("Space size for "+emotename+" is "+spacefiller.length());
} catch (IOException e) {
e.printStackTrace();
diff --git a/src/sig/FileManager.java b/src/sig/FileManager.java
index 8fe3605..88c4e9a 100644
--- a/src/sig/FileManager.java
+++ b/src/sig/FileManager.java
@@ -33,14 +33,20 @@ public class FileManager {
return fileloc;
}
- public void verifyAndFetchFileFromServer() {
+ public boolean verifyAndFetchFileFromServer() {
+ if (fileloc.contains("_FAKE_")) {
+ return false;
+ }
File file = new File(sigIRC.BASEDIR+fileloc);
if (folder) {
if (!file.exists()) {
System.out.println("Could not find "+file.getAbsolutePath()+", creating Folder "+file.getName()+".");
if (file.mkdirs()) {
System.out.println(" >> Successfully created "+file.getAbsolutePath()+".");
+ return true;
}
+ } else {
+ return true;
}
} else {
if (!file.exists()) {
@@ -49,13 +55,17 @@ public class FileManager {
org.apache.commons.io.FileUtils.copyURLToFile(new URL(serverURL+fileloc),file);
if (file.exists()) {
System.out.println(" >> Successfully downloaded "+file.getAbsolutePath()+".");
+ return true;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
+ } else {
+ return true;
}
}
+ return false;
}
}
diff --git a/src/sig/Module.java b/src/sig/Module.java
index 38c6b97..2e1ca5e 100644
--- a/src/sig/Module.java
+++ b/src/sig/Module.java
@@ -36,7 +36,7 @@ public class Module {
this.name = moduleName;
this.enabled=true;
- this.titleHeight = (int)TextUtils.calculateStringBoundsFont(this.name, sigIRC.panel.userFont).getHeight();
+ this.titleHeight = (int)TextUtils.calculateStringBoundsFont(this.name, sigIRC.userFont).getHeight();
}
public Module(Rectangle2D bounds, String moduleName, boolean enabled) {
@@ -148,7 +148,7 @@ public class Module {
(int)position.getWidth()-4,
Module.IMG_DRAGBAR.getHeight(),
sigIRC.panel);
- DrawUtils.drawTextFont(g, sigIRC.panel.smallFont, (int)position.getX(), (int)position.getY()-titleHeight/2+4, Color.BLACK, this.name);
+ DrawUtils.drawTextFont(g, sigIRC.smallFont, (int)position.getX(), (int)position.getY()-titleHeight/2+4, Color.BLACK, this.name);
//g.fillRect((int)position.getX(), (int)position.getY(), (int)position.getWidth(), (int)position.getHeight());
}
}
diff --git a/src/sig/MyPanel.java b/src/sig/MyPanel.java
index d8fc596..076e392 100644
--- a/src/sig/MyPanel.java
+++ b/src/sig/MyPanel.java
@@ -3,7 +3,6 @@ package sig;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
-import java.awt.Font;
import java.awt.Graphics;
import java.awt.GraphicsEnvironment;
import java.awt.MouseInfo;
@@ -35,12 +34,6 @@ import sig.modules.ChatLog.ChatLogMessage;
import sig.utils.FileUtils;
public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{
- //List messages = new ArrayList();
- final public static Font programFont = new Font(sigIRC.messageFont,0,24);
- final public static Font userFont = new Font(sigIRC.usernameFont,0,16);
- final public static Font smallFont = new Font(sigIRC.touhoumotherConsoleFont,0,12);
- final public static Font rabiRibiMoneyDisplayFont = new Font("CP Font",0,16);
- final public static Font rabiRibiTinyDisplayFont = new Font("CP Font",0,12);
public int lastMouseX = 0;
public int lastMouseY = 0;
@@ -227,7 +220,7 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
m.windowClosed(ev);
}
sigIRC.config.saveProperties();
- if (sigIRC.autoUpdateProgram) {
+ if (sigIRC.autoUpdateProgram==0) {
try {
FileUtils.copyFile(new File(sigIRC.PROGRAM_UPDATE_FILE), new File(sigIRC.BASEDIR+"sigIRCv2.jar"));
} catch (IOException e) {
diff --git a/src/sig/ScrollingText.java b/src/sig/ScrollingText.java
index 91ddc7b..0428491 100644
--- a/src/sig/ScrollingText.java
+++ b/src/sig/ScrollingText.java
@@ -88,9 +88,9 @@ public class ScrollingText {
this.shadowSize=2;
- this.stringWidth = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getWidth();
- this.stringHeight = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getHeight();
- this.userstringWidth = (int)TextUtils.calculateStringBoundsFont(this.username,MyPanel.userFont).getWidth();
+ this.stringWidth = (int)TextUtils.calculateStringBoundsFont(this.message,sigIRC.programFont).getWidth();
+ this.stringHeight = (int)TextUtils.calculateStringBoundsFont(this.message,sigIRC.programFont).getHeight();
+ this.userstringWidth = (int)TextUtils.calculateStringBoundsFont(this.username,sigIRC.userFont).getWidth();
}
public ScrollingText(String msg, double x, double y, boolean playSound) {
@@ -172,10 +172,10 @@ public class ScrollingText {
}
public void draw(Graphics g) {
- if (isAlive && WithinBounds(x,y,Math.max(TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getWidth(), TextUtils.calculateStringBoundsFont(message, MyPanel.programFont).getWidth()),Math.max(TextUtils.calculateStringBoundsFont(username, MyPanel.userFont).getHeight(), TextUtils.calculateStringBoundsFont(message, MyPanel.programFont).getHeight()))) {
+ if (isAlive && WithinBounds(x,y,Math.max(TextUtils.calculateStringBoundsFont(username, sigIRC.userFont).getWidth(), TextUtils.calculateStringBoundsFont(message, sigIRC.programFont).getWidth()),Math.max(TextUtils.calculateStringBoundsFont(username, sigIRC.userFont).getHeight(), TextUtils.calculateStringBoundsFont(message, sigIRC.programFont).getHeight()))) {
//DrawUtils.drawTextFont(g, MyPanel.userFont, x+8, y+stringHeight-20, Color.GREEN, username);
- DrawUtils.drawOutlineText(g, MyPanel.userFont, x+8, y+stringHeight-20, 2, userColor, Color.BLACK, username);
- DrawUtils.drawOutlineText(g, MyPanel.programFont, x, y+stringHeight, 2, Color.WHITE, Color.BLACK, message);
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, x+8, y+stringHeight-20, 2, userColor, Color.BLACK, username);
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, x, y+stringHeight, 2, Color.WHITE, Color.BLACK, message);
}
}
@@ -267,8 +267,8 @@ public class ScrollingText {
break;
}
}
- textMaxWidth = (int)TextUtils.calculateStringBoundsFont(basemsg, sigIRC.panel.programFont).getWidth();
- textMaxHeight = Math.max(textMaxHeight,(int)TextUtils.calculateStringBoundsFont(basemsg, sigIRC.panel.programFont).getHeight());
+ textMaxWidth = (int)TextUtils.calculateStringBoundsFont(basemsg, sigIRC.programFont).getWidth();
+ textMaxHeight = Math.max(textMaxHeight,(int)TextUtils.calculateStringBoundsFont(basemsg, sigIRC.programFont).getHeight());
return basemsg;
}
@@ -282,7 +282,7 @@ public class ScrollingText {
private void GenerateEmoticon(int pos, String basemsg, Emoticon e) {
String cutstring = basemsg.substring(0, pos);
- double width = TextUtils.calculateStringBoundsFont(cutstring, sigIRC.panel.programFont).getWidth();
+ double width = TextUtils.calculateStringBoundsFont(cutstring, sigIRC.programFont).getWidth();
//System.out.println("Width of '"+cutstring+"' is "+width);
sigIRC.createEmoticon(e, this, (int)(width), 0);
textMaxHeight = Math.max(textMaxHeight, e.getImage().getHeight());
diff --git a/src/sig/modules/ChatLog/ChatLogMessage.java b/src/sig/modules/ChatLog/ChatLogMessage.java
index 6a8193e..3dc70fc 100644
--- a/src/sig/modules/ChatLog/ChatLogMessage.java
+++ b/src/sig/modules/ChatLog/ChatLogMessage.java
@@ -46,7 +46,7 @@ public class ChatLogMessage {
this.username = DetectUsername(displayMessage);
if (this.username!=null) {
displayMessage.set(0,GetMessage(displayMessage.get(0)+" "));
- usernameWidth = (int)TextUtils.calculateStringBoundsFont(this.username, sigIRC.panel.userFont).getWidth();
+ usernameWidth = (int)TextUtils.calculateStringBoundsFont(this.username, sigIRC.userFont).getWidth();
}
for (int i=0;imaxWidth);
if (rawmessage.length()>0) {
displayMessage.add(rawmessage);
@@ -171,12 +171,12 @@ public class ChatLogMessage {
private String BreakTextAtNextSection(String msg, int maxWidth) {
int marker = 1;
- int textWidth = (int)TextUtils.calculateStringBoundsFont(msg.substring(0, marker), sigIRC.panel.userFont).getWidth();
+ int textWidth = (int)TextUtils.calculateStringBoundsFont(msg.substring(0, marker), sigIRC.userFont).getWidth();
while (textWidth0 && moneytime>playtime) {
setTarget(overlay.getScreenPosition(readFloatFromErinaData(MemoryOffset.ERINA_XPOS), readFloatFromErinaData(MemoryOffset.ERINA_YPOS)));
//System.out.println(x+","+y);
- DrawUtils.drawCenteredOutlineText(g, sigIRC.panel.rabiRibiMoneyDisplayFont, (int)x, (int)y-96, 2, Color.ORANGE, Color.BLACK, "+"+moneyearned+"EN");
+ DrawUtils.drawCenteredOutlineText(g, sigIRC.rabiRibiMoneyDisplayFont, (int)x, (int)y-96, 2, Color.ORANGE, Color.BLACK, "+"+moneyearned+"EN");
}
}
};
@@ -234,9 +234,9 @@ public class RabiRibiModule extends Module{
DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "HP: "+readIntFromErinaData(MemoryOffset.ERINA_HP)+"/"+readIntFromErinaData(MemoryOffset.ERINA_MAXHP));
DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "POS ("+(int)readFloatFromErinaData(MemoryOffset.ERINA_XPOS)/1280+","+(int)readFloatFromErinaData(MemoryOffset.ERINA_YPOS)/720+")");
DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "MAP: "+readIntFromMemory(MemoryOffset.MAPID));*/
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "POS ("+(readFloatFromErinaData(MemoryOffset.ERINA_XPOS))+","+(readFloatFromErinaData(MemoryOffset.ERINA_YPOS))+")");
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "MONEY: ("+(readIntFromMemory(MemoryOffset.MONEY))+")");
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "CAMERA ("+(readIntFromMemory(MemoryOffset.CAMERA_XPOS))+","+(readIntFromMemory(MemoryOffset.CAMERA_YPOS))+")");
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "POS ("+(readFloatFromErinaData(MemoryOffset.ERINA_XPOS))+","+(readFloatFromErinaData(MemoryOffset.ERINA_YPOS))+")");
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "MONEY: ("+(readIntFromMemory(MemoryOffset.MONEY))+")");
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "CAMERA ("+(readIntFromMemory(MemoryOffset.CAMERA_XPOS))+","+(readIntFromMemory(MemoryOffset.CAMERA_YPOS))+")");
//DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE, "SCREENPOS ("+overlay.getScreenPosition(readFloatFromErinaData(MemoryOffset.ERINA_XPOS), readFloatFromErinaData(MemoryOffset.ERINA_YPOS))+")");
overlay.draw(g);
/*DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE,
@@ -255,8 +255,8 @@ public class RabiRibiModule extends Module{
for (Integer numb : entities.keySet()) {
Entity ent = entities.get(numb);
if (ent.getLastHitTime()>readIntFromMemory(MemoryOffset.PLAYTIME)-180) {
- for (String s : TextUtils.WrapText("Entity "+ent.getID()+": "+ent.getHealth()+"/"+ent.getMaxHealth()+" HP "+((ent.getHealth()/(float)ent.getMaxHealth())*100)+"%".replaceAll(",", ", "), sigIRC.panel.programFont, position.getWidth()-20)) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX()+20, position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE,
+ for (String s : TextUtils.WrapText("Entity "+ent.getID()+": "+ent.getHealth()+"/"+ent.getMaxHealth()+" HP "+((ent.getHealth()/(float)ent.getMaxHealth())*100)+"%".replaceAll(",", ", "), sigIRC.programFont, position.getWidth()-20)) {
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, position.getX()+20, position.getY()+(i+=24), 3, Color.BLACK, Color.WHITE,
s);
}
}
@@ -270,7 +270,7 @@ public class RabiRibiModule extends Module{
int playtime = readIntFromMemory(MemoryOffset.PLAYTIME);
if (statustext.length()>0 && statustime>playtime-300) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, position.getX(), position.getY()+(i+=48), 3, Color.GREEN, Color.LIGHT_GRAY, statustext);
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, position.getX(), position.getY()+(i+=48), 3, Color.GREEN, Color.LIGHT_GRAY, statustext);
}
en_counter.draw(g);
diff --git a/src/sig/modules/TouhouMother/SwapButton.java b/src/sig/modules/TouhouMother/SwapButton.java
index 261aec9..330c49b 100644
--- a/src/sig/modules/TouhouMother/SwapButton.java
+++ b/src/sig/modules/TouhouMother/SwapButton.java
@@ -17,7 +17,6 @@ import java.util.Arrays;
import javax.imageio.ImageIO;
-import sig.MyPanel;
import sig.sigIRC;
import sig.modules.TouhouMotherModule;
import sig.utils.DrawUtils;
@@ -48,7 +47,7 @@ public class SwapButton extends TouhouMotherButton{
public void draw(Graphics g) {
super.draw(g);
if (displaytime>0) {
- DrawUtils.drawOutlineText(g, MyPanel.smallFont, x+buttonimg.getWidth()+4, y+buttonimg.getHeight(), 2, Color.WHITE, new Color(60,0,150), message);
+ DrawUtils.drawOutlineText(g, sigIRC.smallFont, x+buttonimg.getWidth()+4, y+buttonimg.getHeight(), 2, Color.WHITE, new Color(60,0,150), message);
}
}
diff --git a/src/sig/modules/TouhouMother/UpdateButton.java b/src/sig/modules/TouhouMother/UpdateButton.java
index 3f65dc9..1294894 100644
--- a/src/sig/modules/TouhouMother/UpdateButton.java
+++ b/src/sig/modules/TouhouMother/UpdateButton.java
@@ -11,7 +11,6 @@ import java.util.Arrays;
import javax.imageio.ImageIO;
-import sig.MyPanel;
import sig.sigIRC;
import sig.modules.TouhouMotherModule;
import sig.utils.DrawUtils;
@@ -41,10 +40,10 @@ public class UpdateButton extends TouhouMotherButton{
public void draw(Graphics g) {
if (buttonEnabled) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, x-TextUtils.calculateStringBoundsFont(data[currentselection].split(",")[0], sigIRC.panel.smallFont).getWidth(), (int)module.getBounds().getY()+(int)module.getBounds().getHeight()-8, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.smallFont, x-TextUtils.calculateStringBoundsFont(data[currentselection].split(",")[0], sigIRC.smallFont).getWidth(), (int)module.getBounds().getY()+(int)module.getBounds().getHeight()-8, 1, Color.WHITE, new Color(30,0,86,255),
data[currentselection].split(",")[0]);
if (displaytime>0) {
- DrawUtils.drawOutlineText(g, MyPanel.smallFont, x-module.getBounds().getWidth()+buttonimg.getWidth()*2, y+buttonimg.getHeight(), 2, Color.WHITE, new Color(60,0,150), message);
+ DrawUtils.drawOutlineText(g, sigIRC.smallFont, x-module.getBounds().getWidth()+buttonimg.getWidth()*2, y+buttonimg.getHeight(), 2, Color.WHITE, new Color(60,0,150), message);
}
super.draw(g);
}
diff --git a/src/sig/modules/TouhouMotherModule.java b/src/sig/modules/TouhouMotherModule.java
index ec95074..c2a7142 100644
--- a/src/sig/modules/TouhouMotherModule.java
+++ b/src/sig/modules/TouhouMotherModule.java
@@ -133,7 +133,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
if (currentBoss!=null) {
DrawBossAndPlayerInfo(g);
} else {
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, (int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, (int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255),
DataProperty.getDataPropertyBasedOnID(data_display_id).getDisplayName());
DrawSortedHealthbarsBasedOnDataProperty(g, DataProperty.getDataPropertyBasedOnID(data_display_id), 0, -64);
}
@@ -145,22 +145,22 @@ public class TouhouMotherModule extends Module implements ActionListener{
public void DrawBossAndPlayerInfo(Graphics g) {
g.drawImage(bossImage, (int)position.getX()+4, (int)position.getY()+4, sigIRC.panel);
- DrawUtils.drawOutlineText(g, sigIRC.panel.programFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.programFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+16, 1, Color.WHITE, new Color(30,0,86,255),
currentBoss.getName());
- DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+48, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4, (int)position.getY()+4+48, 1, Color.WHITE, new Color(30,0,86,255),
real_bossHP+" / "+bossMaxHP +" ("+Math.round(((real_bossHP/(double)bossMaxHP)*100))+"%)");
DrawUtils.drawHealthbar(g, new Rectangle(
Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+4,
(int)position.getY()+4+20,
- (int)TextUtils.calculateStringBoundsFont(bossMaxHP+" / "+bossMaxHP +" ("+Math.round((1d*100))+"%", sigIRC.panel.userFont).getWidth(),
+ (int)TextUtils.calculateStringBoundsFont(bossMaxHP+" / "+bossMaxHP +" ("+Math.round((1d*100))+"%", sigIRC.userFont).getWidth(),
8
), real_bossHP/(double)bossMaxHP, ChooseHealthbarColor(real_bossHP/(double)bossMaxHP));
- DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+16, (int)position.getY()+4+68, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+16, (int)position.getY()+4+68, 1, Color.WHITE, new Color(30,0,86,255),
TextUtils.convertSecondsToTimeFormat(secondsCount));
int record = TimeRecord.getRecord(currentBoss.getID());
if (record!=TimeRecord.ERROR_VALUE) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+
- TextUtils.calculateStringBoundsFont(TextUtils.convertSecondsToTimeFormat(secondsCount), sigIRC.panel.userFont).getWidth()+20,
+ DrawUtils.drawOutlineText(g, sigIRC.smallFont, Math.min(bossImage.getWidth()+4,160)+(int)position.getX()+
+ TextUtils.calculateStringBoundsFont(TextUtils.convertSecondsToTimeFormat(secondsCount), sigIRC.userFont).getWidth()+20,
(int)position.getY()+4+72, 1, Color.WHITE, new Color(30,0,86,255),
"RECORD "+TextUtils.convertSecondsToTimeFormat(record));
}
@@ -175,7 +175,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
int totaldmg = calculateDataPropertyTotalValue(property);
for (int i=0;i0) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, Math.min(((bossImage!=null)?bossImage.getWidth():0)+4,160)+(int)position.getX()+4-Math.min(50, (bossImage!=null)?bossImage.getWidth():0)+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, Math.min(((bossImage!=null)?bossImage.getWidth():0)+4,160)+(int)position.getX()+4-Math.min(50, (bossImage!=null)?bossImage.getWidth():0)+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
characterDatabase[sorteddmg[i]].getName());
DrawUtils.drawHealthbar(g,
new Rectangle(
@@ -186,7 +186,7 @@ public class TouhouMotherModule extends Module implements ActionListener{
)
, (double)characterDatabase[sorteddmg[i]].getDataProperty(property)/maxdmg, characterDatabase[sorteddmg[i]].getColor());
DecimalFormat df = new DecimalFormat("0.0");
- DrawUtils.drawOutlineText(g, sigIRC.panel.smallFont, Math.min((bossImage!=null)?bossImage.getWidth():0+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth():0))+108+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
+ DrawUtils.drawOutlineText(g, sigIRC.smallFont, Math.min((bossImage!=null)?bossImage.getWidth():0+4,160)+(int)position.getX()+4+Math.max(0, 50-((bossImage!=null)?bossImage.getWidth():0))+108+x, (int)position.getY()+4+96+pos+y, 1, Color.WHITE, new Color(30,0,86,255),
characterDatabase[sorteddmg[i]].getDataProperty(property)+" "+"("+df.format(((((double)characterDatabase[sorteddmg[i]].getDataProperty(property)/totaldmg))*100))+"%)");
pos+=16;
}
diff --git a/src/sig/modules/Twitch/FancyNumber.java b/src/sig/modules/Twitch/FancyNumber.java
index 582c7b8..6467888 100644
--- a/src/sig/modules/Twitch/FancyNumber.java
+++ b/src/sig/modules/Twitch/FancyNumber.java
@@ -77,8 +77,8 @@ public class FancyNumber {
delayCount--;
}
}
- DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(Integer.toString(displayedValue), sigIRC.panel.userFont).getHeight()/2+3, new Color(184,181,192), Integer.toString(displayedValue));
- xoffset+=TextUtils.calculateStringBoundsFont(Integer.toString(displayedValue), sigIRC.panel.userFont).getWidth()+4;
+ DrawUtils.drawTextFont(g, sigIRC.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(Integer.toString(displayedValue), sigIRC.userFont).getHeight()/2+3, new Color(184,181,192), Integer.toString(displayedValue));
+ xoffset+=TextUtils.calculateStringBoundsFont(Integer.toString(displayedValue), sigIRC.userFont).getWidth()+4;
if (lastValueChange>0) {
lastValueChange--;
g.drawImage((upArrow)?TwitchModule.UPARROWIMAGE:TwitchModule.DOWNARROWIMAGE, x+xoffset, y+yoffset, sigIRC.panel);
diff --git a/src/sig/modules/TwitchModule.java b/src/sig/modules/TwitchModule.java
index 75084d2..4a96722 100644
--- a/src/sig/modules/TwitchModule.java
+++ b/src/sig/modules/TwitchModule.java
@@ -434,7 +434,7 @@ public class TwitchModule extends Module{
new int[]{yoffset-4,yoffset-4,yoffset+16,yoffset+16},
4);
if (currentlyPlaying!=null && currentlyPlaying.length()>0) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, xoffset, yoffset+TextUtils.calculateStringBoundsFont(currentlyPlaying, sigIRC.panel.userFont).getHeight()/2+3, 2, g.getColor(), new Color(195,195,195), currentlyPlaying);xoffset+=TextUtils.calculateStringBoundsFont(currentlyPlaying, sigIRC.panel.userFont).getWidth()+16;
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, xoffset, yoffset+TextUtils.calculateStringBoundsFont(currentlyPlaying, sigIRC.userFont).getHeight()/2+3, 2, g.getColor(), new Color(195,195,195), currentlyPlaying);xoffset+=TextUtils.calculateStringBoundsFont(currentlyPlaying, sigIRC.userFont).getWidth()+16;
}
Rectangle offsets = DrawUptime(g, xoffset, yoffset);xoffset+=offsets.getWidth();
offsets = views_numb.draw(g, xoffset, yoffset);xoffset+=offsets.getWidth();
@@ -448,7 +448,7 @@ public class TwitchModule extends Module{
g.drawImage(UPTIMEIMAGE, x+xoffset, y+yoffset-2, sigIRC.panel);xoffset+=UPTIMEIMAGE.getWidth()+4;
String timediff = TimeUtils.GetTimeDifferenceFromCurrentDate(uptime);
if (timediff.length()>0) {
- DrawUtils.drawTextFont(g, sigIRC.panel.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.panel.userFont).getWidth()+12;
+ DrawUtils.drawTextFont(g, sigIRC.userFont, x+xoffset, y+yoffset+TextUtils.calculateStringBoundsFont(timediff, sigIRC.userFont).getHeight()/2+3,new Color(184,181,192),timediff);xoffset+=TextUtils.calculateStringBoundsFont(timediff, sigIRC.userFont).getWidth()+12;
}
yoffset+=16;
return new Rectangle(x,y,xoffset,yoffset);
@@ -478,11 +478,11 @@ public class TwitchModule extends Module{
//g.drawImage(follower_img, (int)bounds.getX(), (int)bounds.getY(), , , sigIRC.panel)
g.drawImage(follower_img, (int)position.getX(), (int)position.getY()+canvasYOffset, (int)position.getX()+follower_img.getWidth()+canvasXOffset, (int)position.getY()+follower_img.getHeight(),
-xAlteration, 0, follower_img.getWidth(), follower_img.getHeight()-yAlteration, sigIRC.panel);
- Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.panel.programFont);
+ Rectangle2D usernameTextsize = TextUtils.calculateStringBoundsFont(announcedFollowerUser.getDisplayName(), sigIRC.programFont);
int textY = (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration;
int textX = (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration;
if (textYposition.getX()) {
- DrawUtils.drawCenteredText(g, sigIRC.panel.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.getDisplayName());
+ DrawUtils.drawCenteredText(g, sigIRC.programFont, (int)position.getX()+sigIRC.twitchmodule_followerText_centerX+xAlteration, (int)position.getY()+sigIRC.twitchmodule_followerText_Y+yAlteration, Color.BLACK, announcedFollowerUser.getDisplayName());
}
if (announcedFollowerUser.getBio()!=null && !announcedFollowerUser.getBio().equalsIgnoreCase("null")) {
if (followerUserLogo!=null) {
@@ -494,7 +494,7 @@ public class TwitchModule extends Module{
g.drawImage(followerUserLogo, img_startx, img_starty, img_startx+image_size, img_starty+image_size, 0, 0, followerUserLogo.getWidth(), followerUserLogo.getHeight(), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerImgBackgroundColor), sigIRC.panel);
}
if (announcedFollowerUser.getBio()!=null && announcedFollowerUser.getBio().length()>0) {
- DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio());
+ DrawUtils.drawOutlineText(g, sigIRC.userFont, position.getX()+position.getWidth()-ticksPassed*3, position.getY()+follower_img.getHeight()+2+8, 2, TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerTextColor), TextUtils.convertStringToColor(sigIRC.twitchmodule_newfollowerShadowTextColor), announcedFollowerUser.getBio());
}
}
}
diff --git a/src/sig/sigIRC.java b/src/sig/sigIRC.java
index 2630179..74ec184 100644
--- a/src/sig/sigIRC.java
+++ b/src/sig/sigIRC.java
@@ -37,6 +37,8 @@ import sig.utils.GithubUtils;
import sig.utils.MemoryUtils;
import sig.utils.TextUtils;
import sig.windows.IntroDialog;
+import sig.windows.LoadingDialog;
+import sig.windows.TwitchEmoteDownload;
import java.awt.Color;
import java.awt.Dimension;
@@ -89,7 +91,7 @@ public class sigIRC{
final public static String WINDOWTITLE = "sigIRCv2";
public final static String PROGRAM_EXECUTABLE_URL = "https://github.com/sigonasr2/sigIRCv2/raw/master/sigIRCv2.jar";
public static ConfigFile config;
- static String server;
+ public static String server;
public static String nickname;
public static String channel;
public static boolean authenticated=false;
@@ -112,8 +114,8 @@ public class sigIRC{
static String messageFont="Gill Sans Ultra Bold Condensed";
static String usernameFont="GillSansMTStd-Book";
static String touhoumotherConsoleFont="Agency FB Bold";
- static boolean touhoumothermodule_enabled=false;
- static boolean twitchmodule_enabled=true;
+ public static boolean touhoumothermodule_enabled=false;
+ public static boolean twitchmodule_enabled=true;
public static boolean chatlogmodule_enabled=true;
static boolean downloadsComplete=false;
static boolean hardwareAcceleration=true;
@@ -160,7 +162,7 @@ public class sigIRC{
public final static String SUBEMOTELISTFILE = "sigIRC/subemotes.json";
public static long channel_id = -1;
public static int lastSubEmoteUpdate = -1;
- public static boolean autoUpdateProgram = true;
+ public static int autoUpdateProgram = 0; //0 = Auto Update, 1 = Notify, 2 = Disabled
public static Image programIcon;
final public static int MAX_CONNECTION_RETRIES = 100;
public static int retryCounter = 0;
@@ -172,6 +174,8 @@ public class sigIRC{
public static boolean subEmotesCompleted=false;
public static boolean disableChatMessages=false;
+ public static LoadingDialog loadingdialog;
+
static int lastWindowX = 0;
static int lastWindowY = 0;
@@ -239,13 +243,14 @@ public class sigIRC{
chatlogmodule_backgroundColor = config.getProperty("CHATLOG_module_BackgroundColor", "195,195,195,255");
chatlogMessageHistory = config.getInteger("CHATLOG_module_MessageHistory",50);
hardwareAcceleration = config.getBoolean("hardware_acceleration",true);
- autoUpdateProgram = config.getBoolean("Automatically_Update_Program", true);
+ autoUpdateProgram = config.getInteger("Auto_Update_Program", 0);
disableChatMessages = config.getBoolean("Disable_Chat_Messages", false);
lastSubEmoteUpdate = config.getInteger("lastSubEmote_APIUpdate",Calendar.getInstance().get(Calendar.DAY_OF_YEAR));
manager.setClientId("o4c2x0l3e82scgar4hpxg6m5dfjbem");
//System.out.println(manager.auth().hasAccessToken());
- new IntroDialog();
+ //new IntroDialog();
+ loadingdialog = new LoadingDialog();
/*
@@ -296,6 +301,10 @@ public class sigIRC{
return conf;
}
+ /**
+ * Now handled by LoadingDialog.
+ */
+ @Deprecated
public static void DownloadAllRequiredDependencies() {
FileManager manager = new FileManager("sigIRC/oauthToken.txt"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("sigIRC/Emotes/",true); manager.verifyAndFetchFileFromServer();
@@ -337,9 +346,9 @@ public class sigIRC{
System.out.println("Downloaded Dependencies. ");
}
- private static void DownloadProgramUpdate() {
+ public static void DownloadProgramUpdate() {
//System.out.println("Last commit size was "+GithubUtils.getSizeOfFileFromLatestGithubCommit("sigIRCv2.jar")+"B");
- if (autoUpdateProgram) {
+ if (autoUpdateProgram==0) {
File updatedir = new File(sigIRC.BASEDIR+"sigIRC/updates/");
updatedir.mkdirs();
File controllerdir = new File(ControllerModule.CONTROLLERPATH);
@@ -497,17 +506,8 @@ public class sigIRC{
//return true;
}
- private static void performTwitchEmoteUpdate() {
+ public static void prepareTwitchEmoteUpdate() {
try {
- JSONObject twitchemotes = FileUtils.readJsonFromUrl("https://twitchemotes.com/api_cache/v3/global.json");
- System.out.println("Twitch emote Json read.");
- for (String emotes : twitchemotes.keySet()) {
- JSONObject emote = twitchemotes.getJSONObject(emotes);
- int id = emote.getInt("id");
- String name = emote.getString("code");
- emoticons.add(new Emoticon(name, new URL(TWITCHEMOTEURL+id+"/1.0")));
- System.out.println("Emote "+id+" with name "+name);
- }
//System.out.println("Subscriber object: "+subemotes);
String[] channel_names = FileUtils.readFromFile(sigIRC.BASEDIR+"sigIRC/subscribers.txt");
subchannelCount = channel_names.length;
@@ -530,30 +530,7 @@ public class sigIRC{
}*/
} catch (JSONException e) {
e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
}
-
- emoticons.add(new Emoticon(":)","1"));
- emoticons.add(new Emoticon(":(","2"));
- emoticons.add(new Emoticon(":o","3"));
- emoticons.add(new Emoticon(":O","3"));
- emoticons.add(new Emoticon(":z","4"));
- emoticons.add(new Emoticon(":Z","4"));
- emoticons.add(new Emoticon("B)","5"));
- emoticons.add(new Emoticon(":\\","6"));
- emoticons.add(new Emoticon(":/","6"));
- emoticons.add(new Emoticon(";)","7"));
- emoticons.add(new Emoticon(";p","8"));
- emoticons.add(new Emoticon(";P","8"));
- emoticons.add(new Emoticon(":p","9"));
- emoticons.add(new Emoticon(":P","9"));
- emoticons.add(new Emoticon("R)","10"));
- emoticons.add(new Emoticon("o_O","20"));
- emoticons.add(new Emoticon("O_o","20"));
- emoticons.add(new Emoticon(":D","11"));
- emoticons.add(new Emoticon(">(","12"));
- emoticons.add(new Emoticon("<3","13"));
}
/*private static void DefineEmoticons() {
@@ -669,4 +646,15 @@ public class sigIRC{
public static void createEmoticon(Emoticon emote, ChatLogMessage textref, int x, int y) {
chatlogtwitchemoticons.add(new ChatLogTwitchEmote(emote,textref,x,y));
}
+
+ final public static Font rabiRibiTinyDisplayFont = new Font("CP Font",0,12);
+
+ final public static Font rabiRibiMoneyDisplayFont = new Font("CP Font",0,16);
+
+ final public static Font smallFont = new Font(touhoumotherConsoleFont,0,12);
+
+ final public static Font userFont = new Font(usernameFont,0,16);
+
+ //List messages = new ArrayList();
+ final public static Font programFont = new Font(messageFont,0,24);
}
diff --git a/src/sig/utils/DrawUtils.java b/src/sig/utils/DrawUtils.java
index 684f3b3..423e7ce 100644
--- a/src/sig/utils/DrawUtils.java
+++ b/src/sig/utils/DrawUtils.java
@@ -17,7 +17,7 @@ import java.awt.image.BufferedImage;
import java.awt.image.ImageObserver;
import java.text.AttributedString;
-import sig.MyPanel;
+import sig.sigIRC;
public class DrawUtils {
public static void drawOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) {
@@ -56,7 +56,7 @@ public class DrawUtils {
public static void drawText(Graphics g, double x, double y, Color color, String message) {
if (message.length()>0) {
AttributedString as = new AttributedString(message);
- as.addAttribute(TextAttribute.FONT, MyPanel.programFont);
+ as.addAttribute(TextAttribute.FONT, sigIRC.programFont);
g.setColor(color);
g.drawString(as.getIterator(),(int)x,(int)y);
}
diff --git a/src/sig/utils/TextUtils.java b/src/sig/utils/TextUtils.java
index a485c68..488fecb 100644
--- a/src/sig/utils/TextUtils.java
+++ b/src/sig/utils/TextUtils.java
@@ -12,7 +12,8 @@ import sig.sigIRC;
public class TextUtils {
public static Rectangle2D calculateStringBoundsFont(String msg, Font font) {
- FontRenderContext frc = sigIRC.panel.getFontMetrics(font).getFontRenderContext();
+ //System.out.println(sigIRC.loadingdialog);
+ FontRenderContext frc = sigIRC.loadingdialog.getFontMetrics(font).getFontRenderContext();
return font.getStringBounds(msg, frc);
}
diff --git a/src/sig/windows/IntroDialog.java b/src/sig/windows/IntroDialog.java
index 53a3468..1d4e9a8 100644
--- a/src/sig/windows/IntroDialog.java
+++ b/src/sig/windows/IntroDialog.java
@@ -1,24 +1,74 @@
package sig.windows;
import java.awt.Color;
+import java.awt.Desktop;
+import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.GraphicsEnvironment;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.Socket;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.UnknownHostException;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
import javax.imageio.ImageIO;
import javax.swing.BorderFactory;
+import javax.swing.Box;
+import javax.swing.Icon;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.JToggleButton;
import javax.swing.border.TitledBorder;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+import javax.swing.text.BadLocationException;
+import javax.swing.text.html.HTMLDocument;
import sig.sigIRC;
+import sig.modules.RabiRaceModule;
+import sig.utils.FileUtils;
public class IntroDialog extends JFrame{
Font systemFont;
+ final static Color panelBackgroundColor = new Color(192,192,192);
+ JPanel displayPanel;
+ JPanel borderPanel;
+ JPanel buttonPanel;
+ JButton nextbutton;
+ JButton exitbutton;
+ JButton backbutton;
+ JEditorPane introText;
+ TitledBorder border;
+ JTextField nameBox,oauthTokenBox;
+ JPanel namePanel;
+ JLabel nameLabel;
+ JLabel oauthLabel;
+ JScrollPane scrollDisplayPanel;
+ JButton openWebpage;
+ ModuleButton[] moduleButtons;
+ JComboBox updateType;
+
+ static Icon deselected_icon,selected_icon;
public IntroDialog() {
this.setLocationByPlatform(true);
@@ -36,27 +86,330 @@ public class IntroDialog extends JFrame{
e.printStackTrace();
}
- JPanel dialogPanel = new JPanel();
+ borderPanel = new JPanel();
+ displayPanel = new JPanel();
+ buttonPanel = new JPanel();
+ namePanel = new JPanel();
+ namePanel.setBackground(panelBackgroundColor);
+ namePanel.setPreferredSize(new Dimension(560,320));
+ nameBox = new JTextField(30);
+ oauthTokenBox = new JTextField(30);
//dialogPanel.setSize(this.getSize());
- dialogPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK, 2, true),"Welcome to sigIRC!",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,systemFont));
+ border = BorderFactory.createTitledBorder(BorderFactory.createLineBorder(Color.BLACK, 2, true),"Welcome to sigIRC!",TitledBorder.DEFAULT_JUSTIFICATION,TitledBorder.DEFAULT_POSITION,systemFont);
+ borderPanel.setBorder(border);
- this.add(dialogPanel);
+ this.add(borderPanel);
try {
this.setIconImage(ImageIO.read(sigIRC.class.getResource("/resource/sigIRCicon.png")));
+ deselected_icon = new ImageIcon(ImageIO.read(sigIRC.class.getResource("/resource/deselected_button.png")));
+ selected_icon = new ImageIcon(ImageIO.read(sigIRC.class.getResource("/resource/selected_button.png")));
} catch (IOException e) {
e.printStackTrace();
}
- JEditorPane introText = new JEditorPane();
+ moduleButtons = new ModuleButton[]{
+ new ModuleButton("Scrolling Chat"),
+ new ModuleButton("Chat Log"),
+ new ModuleButton("Controller"),
+ new ModuleButton("Twitch"),
+ new ModuleButton("Rabi-Race"),
+ new ModuleButton("Touhou Mother"),
+ };
+
+ moduleButtons[0].setSelected(true);
+ moduleButtons[1].setSelected(true);
+ moduleButtons[3].setSelected(true);
+
+ introText = new JEditorPane();
try {
introText.setPage(sigIRC.class.getResource("/resource/text/introText.html"));
} catch (IOException e) {
e.printStackTrace();
}
+ introText.setPreferredSize(new Dimension(560, 320));
+ introText.setEditable(false);
+ introText.setBackground(panelBackgroundColor);
+
- dialogPanel.add(introText);
+ backbutton = new JButton("< Back");
+ backbutton.setPreferredSize(new Dimension(128,24));
+ backbutton.setActionCommand("2");
+ backbutton.setEnabled(false);
+ backbutton.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ setupBackPage(ev.getActionCommand());
+ }
+
+ });
+
+ nextbutton = new JButton("Next >");
+ nextbutton.setPreferredSize(new Dimension(128,24));
+ nextbutton.setActionCommand("2");
+ nextbutton.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ setupPage(ev.getActionCommand());
+ }
+
+ });
+ exitbutton = new JButton("Exit");
+ exitbutton.setPreferredSize(new Dimension(128,24));
+
+ displayPanel.setPreferredSize(new Dimension(680,360));
+
+ scrollDisplayPanel = new JScrollPane();
+ scrollDisplayPanel.setViewportView(introText);
+ scrollDisplayPanel.setPreferredSize(introText.getPreferredSize());
+ scrollDisplayPanel.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+ scrollDisplayPanel.setBorder(null);
+ displayPanel.add(scrollDisplayPanel);
+ displayPanel.add(namePanel);
+ displayPanel.setBackground(panelBackgroundColor);
+
+ buttonPanel.setPreferredSize(new Dimension(680,48));
+
+ buttonPanel.add(Box.createHorizontalStrut(128));
+ buttonPanel.add(backbutton);
+ buttonPanel.add(Box.createHorizontalStrut(12));
+ buttonPanel.add(nextbutton);
+ buttonPanel.add(Box.createHorizontalStrut(80));
+ buttonPanel.add(exitbutton);
+ buttonPanel.setBackground(panelBackgroundColor);
+
+ borderPanel.add(displayPanel);
+ borderPanel.add(buttonPanel);
+
+ borderPanel.setBackground(panelBackgroundColor);
this.setSize(720, 480);
+ this.setBackground(panelBackgroundColor);
+ this.setResizable(false);
+ }
+
+ protected void setupBackPage(String page) {
+ switch (page) {
+ case "2":{
+ setupPage("1");
+ }break;
+ case "3":{
+ setupPage("2");
+ }break;
+ case "4":{
+ setupPage("3");
+ }break;
+ }
+ }
+
+ protected void setupPage(String page) {
+ switch (page) {
+ case "1":{
+ scrollDisplayPanel.setPreferredSize(new Dimension(560, 320));
+ try {
+ introText.setPage(sigIRC.class.getResource("/resource/text/introText.html"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ displayPanel.validate();
+ backbutton.setEnabled(false);
+ nextbutton.setActionCommand("2");
+ namePanel.removeAll();
+ namePanel.validate();
+ border.setTitle("Welcome to sigIRC!");
+ borderPanel.repaint();
+ }break;
+ case "2":{
+ border.setTitle("Setup Twitch Account");
+ borderPanel.repaint();
+ try {
+ introText.setPage(sigIRC.class.getResource("/resource/text/setupTwitchName.html"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ scrollDisplayPanel.setPreferredSize(new Dimension(560,180));
+ nameLabel = new JLabel("Twitch Username: ");
+ namePanel.removeAll();
+ namePanel.add(nameLabel);
+ namePanel.add(nameBox);
+ namePanel.setPreferredSize(new Dimension(560,320));
+ namePanel.setBackground(panelBackgroundColor);
+ nextbutton.setActionCommand("3");
+ backbutton.setActionCommand("2");
+ namePanel.validate();
+ displayPanel.validate();
+ displayPanel.repaint();
+ backbutton.setEnabled(true);
+ }break;
+ case "3":{
+ border.setTitle("Setup Twitch Account");
+ borderPanel.repaint();
+ if (nameBox.getText().length()==0) {
+ JOptionPane.showMessageDialog(this, "You must enter a Twitch Username!", "Error!", JOptionPane.WARNING_MESSAGE);
+ break;
+ }
+ try {
+ introText.setPage(sigIRC.class.getResource("/resource/text/setupoauthToken.html"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ openWebpage = new JButton("Get oauthToken");
+ openWebpage.addActionListener(new ActionListener(){
+
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ try {
+ Desktop.getDesktop().browse(new URI("https://twitchapps.com/tmi/"));
+ } catch (IOException | URISyntaxException e1) {
+ e1.printStackTrace();
+ }
+ }
+
+ });
+ scrollDisplayPanel.setPreferredSize(new Dimension(560,180));
+ nextbutton.setActionCommand("4");
+ backbutton.setActionCommand("3");
+ try {
+ introText.setPage(sigIRC.class.getResource("/resource/text/setupoauthToken.html"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ oauthLabel = new JLabel("Twitch oauth Token:");
+ namePanel.removeAll();
+ namePanel.add(openWebpage);
+ namePanel.add(Box.createRigidArea(new Dimension(640,32)));
+ namePanel.add(oauthLabel);
+ namePanel.add(oauthTokenBox);
+ namePanel.validate();
+ }break;
+ case "4":{
+ oauthTokenBox.setText(oauthTokenBox.getText().trim());
+ if (oauthTokenBox.getText().length()!=36) {
+ JOptionPane.showMessageDialog(this, "An oauth Token is 36 characters long. Please verify you have copied and pasted it correctly! (Include the oauth: part)", "Error!", JOptionPane.WARNING_MESSAGE);
+ break;
+ }
+ border.setTitle("Connecting to Twitch...");
+ borderPanel.repaint();
+ this.repaint();
+ if (!AttemptConnection()) {
+ JOptionPane.showMessageDialog(this, "Failed to authenticate with Twitch! Please verify your username, oauth Token, and Internet Connection and then try again.", "Error!", JOptionPane.WARNING_MESSAGE);
+ border.setTitle("Setup Twitch Account");
+ borderPanel.repaint();
+ break;
+ }
+ border.setTitle("Successfully Authenticated!");
+ borderPanel.repaint();
+ try {
+ introText.setPage(sigIRC.class.getResource("/resource/text/setupProgramSettings.html"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ scrollDisplayPanel.setPreferredSize(new Dimension(560,200));
+ namePanel.removeAll();
+ JLabel label = new JLabel("Program Updating Behavior: ");
+ JLabel modulelabel = new JLabel("Select all Modules you want enabled:");
+ updateType = new JComboBox();
+ updateType.addItem("Automatically Update");
+ updateType.addItem("Notify when Update Available");
+ updateType.addItem("Never Update");
+ namePanel.add(label);
+ namePanel.add(updateType);
+ namePanel.add(Box.createRigidArea(new Dimension(520,4)));
+ namePanel.add(modulelabel);
+ namePanel.add(Box.createRigidArea(new Dimension(520,4)));
+ for (ModuleButton button : moduleButtons) {
+ namePanel.add(button);
+ }
+ nextbutton.setActionCommand("5");
+ backbutton.setActionCommand("4");
+ //namePanel.setMinimumSize(new Dimension(560,64));
+ namePanel.validate();
+ displayPanel.validate();
+ displayPanel.repaint();
+ sigIRC.config.setProperty("nickname", nameBox.getText());
+ sigIRC.config.setProperty("channel", "#"+nameBox.getText());
+ sigIRC.config.saveProperties();
+ FileUtils.writetoFile(new String[]{oauthTokenBox.getText()}, sigIRC.BASEDIR+"sigIRC/oauthToken.txt");
+ }break;
+ case "5":{
+ sigIRC.disableChatMessages = !moduleButtons[0].isSelected();
+ sigIRC.chatlogmodule_enabled = moduleButtons[1].isSelected();
+ sigIRC.controllermodule_enabled = moduleButtons[2].isSelected();
+ sigIRC.twitchmodule_enabled = moduleButtons[3].isSelected();
+ sigIRC.rabiracemodule_enabled = moduleButtons[4].isSelected();
+ sigIRC.touhoumothermodule_enabled = moduleButtons[5].isSelected();
+ sigIRC.config.setBoolean("Disable_Chat_Messages", sigIRC.disableChatMessages);
+ sigIRC.config.setBoolean("Module_chatlog_Enabled", sigIRC.chatlogmodule_enabled);
+ sigIRC.config.setBoolean("Module_controller_Enabled", sigIRC.controllermodule_enabled);
+ sigIRC.config.setBoolean("Module_twitch_Enabled", sigIRC.twitchmodule_enabled);
+ sigIRC.config.setBoolean("Module_rabirace_Enabled", sigIRC.rabiracemodule_enabled);
+ sigIRC.config.setBoolean("Module_touhoumother_Enabled", sigIRC.touhoumothermodule_enabled);
+ switch ((String)updateType.getSelectedItem()) {
+ case "Automatically Update":{
+ sigIRC.autoUpdateProgram = 0;
+ }break;
+ case "Notify when Update Available":{
+ sigIRC.autoUpdateProgram = 1;
+ }break;
+ case "Never Update":{
+ sigIRC.autoUpdateProgram = 2;
+ }break;
+ }
+ sigIRC.config.setInteger("Auto_Update_Program", sigIRC.autoUpdateProgram);
+ sigIRC.config.saveProperties();
+ this.invalidate();
+ }break;
+ }
+ }
+
+ protected boolean AttemptConnection() {
+ Socket socket;
+ try {
+ socket = new Socket(sigIRC.server, 6667);
+ BufferedWriter writer = new BufferedWriter(
+ new OutputStreamWriter(socket.getOutputStream( )));
+ BufferedReader reader = new BufferedReader(
+ new InputStreamReader(socket.getInputStream( )));
+
+ // Log on to the server.
+ writer.write("PASS " + oauthTokenBox.getText() + "\r\n");
+ writer.write("NICK " + nameBox.getText() + "\r\n");
+ writer.flush( );
+ return sigIRC.VerifyLogin(reader);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+}
+
+class ModuleButton extends JToggleButton{
+ String label = "";
+ ModuleButton button;
+ public ModuleButton(String label) {
+ this.label = label;
+ this.button = this;
+ this.setBackground(Color.DARK_GRAY);
+ button.setForeground(Color.GRAY);
+ button.setIconTextGap(4);
+ button.setIcon(IntroDialog.deselected_icon);
+ button.setSelectedIcon(IntroDialog.selected_icon);
+ this.setText(label);
+ this.addChangeListener(new ChangeListener() {
+ @Override
+ public void stateChanged(ChangeEvent e) {
+ if (button.isSelected()) {
+ button.setForeground(Color.BLUE);
+ }
+ else {
+ button.setBackground(Color.DARK_GRAY);
+ button.setForeground(Color.GRAY);
+ }
+ }
+
+ });
}
}
diff --git a/src/sig/windows/LoadingDialog.java b/src/sig/windows/LoadingDialog.java
new file mode 100644
index 0000000..7a3fde1
--- /dev/null
+++ b/src/sig/windows/LoadingDialog.java
@@ -0,0 +1,204 @@
+package sig.windows;
+
+import java.awt.Dimension;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JProgressBar;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import sig.Emoticon;
+import sig.FileManager;
+import sig.sigIRC;
+import sig.modules.RabiRace.Avatar;
+import sig.modules.RabiRace.MemoryData;
+import sig.utils.FileUtils;
+
+public class LoadingDialog extends JFrame{
+ JProgressBar bar = new JProgressBar();
+ List managers = new ArrayList();
+ FakeFileManager programUpdate = new FakeFileManager("_FAKE_");
+ FakeFileManager twitchEmoteUpdate = new FakeFileManager("_FAKE_");
+ public JPanel panel;
+ public static List emotes = new ArrayList();
+
+ public LoadingDialog() {
+ sigIRC.loadingdialog = this;
+ panel = new JPanel();
+
+ managers.add(new FileManager("sigIRC/oauthToken.txt"));
+ managers.add(new FileManager("sigIRC/Emotes/",true));
+ managers.add(new FileManager("sigIRC/subscribers.txt"));
+ managers.add(new FileManager("sigIRC/logs/",true));
+ managers.add(new FileManager("sigIRC/sounds/",true));
+ managers.add(new FileManager("sigIRC/rabi-ribi/",true));
+ managers.add(new FileManager("sigIRC/rabi-ribi/unknown.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/characters",true));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items",true));
+ //managers.add(new FileManager("sigIRC/sounds/Glaceon_cry.wav")
+ File follower_sounds_folder = new File(sigIRC.BASEDIR+"sigIRC/follower_sounds");
+ if (!follower_sounds_folder.exists()) {
+ managers.add(new FileManager("sigIRC/follower_sounds/Glaceon_cry.wav"));
+ managers.add(new FileManager("sigIRC/follower_sounds/README.txt"));
+ }
+ managers.add(new FileManager("sigIRC/record"));
+ managers.add(new FileManager("sigIRC/glaceon_follower.png"));
+ managers.add(new FileManager("sigIRC/sigIRCicon.png"));
+ managers.add(new FileManager("sigIRC/icon_down_arrow.png"));
+ managers.add(new FileManager("sigIRC/icon_follower_count.png"));
+ managers.add(new FileManager("sigIRC/icon_up_arrow.png"));
+ managers.add(new FileManager("sigIRC/icon_uptime.png"));
+ managers.add(new FileManager("sigIRC/icon_viewers_count.png"));
+ managers.add(new FileManager("sigIRC/icon_views_count.png"));
+ managers.add(new FileManager("sigIRC/message_separator.png"));
+ managers.add(new FileManager("sigIRC/controller/2-way_axis.png"));
+ managers.add(new FileManager("sigIRC/controller/4-way_axis.png"));
+ managers.add(new FileManager("sigIRC/controller/controller_overlay.png"));
+ managers.add(new FileManager("sigIRC/controller/controller_template.png"));
+ managers.add(new FileManager("sigIRC/CP_Font.ttf"));
+ managers.add(new FileManager("kill.png"));
+ managers.add(new FileManager("memory"));
+ managers.add(new FileManager("swap.png"));
+ managers.add(new FileManager("update.png"));
+ managers.add(new FileManager("backcolor.png"));
+ managers.add(new FileManager("drag_bar.png"));
+ managers.add(new FileManager("sigIRC/Emotes/1.png"));
+ managers.add(new FileManager("sigIRC/Emotes/2.png"));
+ managers.add(new FileManager("sigIRC/Emotes/3.png"));
+ managers.add(new FileManager("sigIRC/Emotes/4.png"));
+ managers.add(new FileManager("sigIRC/Emotes/5.png"));
+ managers.add(new FileManager("sigIRC/Emotes/6.png"));
+ managers.add(new FileManager("sigIRC/Emotes/7.png"));
+ managers.add(new FileManager("sigIRC/Emotes/8.png"));
+ managers.add(new FileManager("sigIRC/Emotes/9.png"));
+ managers.add(new FileManager("sigIRC/Emotes/10.png"));
+ managers.add(new FileManager("sigIRC/Emotes/11.png"));
+ managers.add(new FileManager("sigIRC/Emotes/12.png"));
+ managers.add(new FileManager("sigIRC/Emotes/13.png"));
+ managers.add(new FileManager("sigIRC/Emotes/20.png"));
+ managers.add(programUpdate);
+
+ if (sigIRC.rabiracemodule_enabled) {
+ for (MemoryData data : MemoryData.values()) {
+ //Attempt to fetch from server.
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/"+data.img_path));
+ }
+ for (Avatar avatar : Avatar.values()) {
+ managers.add(new FileManager("sigIRC/rabi-ribi/characters/"+avatar.fileName));
+ }
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/easter_egg.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/health_up.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/mana_up.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/regen_up.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/pack_up.png"));
+ managers.add(new FileManager("sigIRC/rabi-ribi/items/attack_up.png"));
+ }
+
+ JSONObject twitchemotes;
+ try {
+ twitchemotes = FileUtils.readJsonFromUrl("https://twitchemotes.com/api_cache/v3/global.json");
+ System.out.println("Twitch emote Json read.");
+ for (String emotes : twitchemotes.keySet()) {
+ JSONObject emote = twitchemotes.getJSONObject(emotes);
+ int id = emote.getInt("id");
+ String name = emote.getString("code");
+ LoadingDialog.emotes.add(new TwitchEmoteDownload(name,id));
+ managers.add(new FakeFileManager("_FAKE_"));
+ //emoticons.add(new Emoticon(name, new URL(TWITCHEMOTEURL+id+"/1.0")));
+ System.out.println("Emote "+id+" with name "+name);
+ }
+ } catch (JSONException | IOException e) {
+ e.printStackTrace();
+ }
+
+ bar.setValue(0);
+ bar.setMaximum(managers.size());
+ bar.setPreferredSize(new Dimension(240,24));
+ bar.setString("Downloading resources... (0/"+managers.size()+")");
+ bar.setStringPainted(true);
+
+ panel.setSize(new Dimension(260,30));
+
+ panel.add(bar);
+
+ this.add(panel);
+
+ this.setSize(new Dimension(260,36));
+ this.setLocationByPlatform(true);
+ this.setMinimumSize(new Dimension(260, 36));
+ this.setMaximumSize(new Dimension(260, 36));
+ this.setUndecorated(true);
+ this.setVisible(true);
+ this.setAlwaysOnTop(true);
+ this.setFocusable(false);
+
+ for (FileManager manager : managers) {
+ if (manager.verifyAndFetchFileFromServer()) {
+ bar.setValue(bar.getValue()+1);
+ UpdateBar();
+ }
+ }
+
+ for (TwitchEmoteDownload d : emotes) {
+ try {
+ d.download();
+ bar.setValue(bar.getValue()+1);
+ UpdateBar();
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ }
+
+
+ sigIRC.prepareTwitchEmoteUpdate();
+ twitchEmoteUpdate.setDone();
+ bar.setValue(bar.getValue()+1);
+ UpdateBar();
+ sigIRC.DownloadProgramUpdate();
+ programUpdate.setDone();
+ bar.setValue(bar.getValue()+1);
+ UpdateBar();
+
+ sigIRC.emoticons.add(new Emoticon(":)","1"));
+ sigIRC.emoticons.add(new Emoticon(":(","2"));
+ sigIRC.emoticons.add(new Emoticon(":o","3"));
+ sigIRC.emoticons.add(new Emoticon(":O","3"));
+ sigIRC.emoticons.add(new Emoticon(":z","4"));
+ sigIRC.emoticons.add(new Emoticon(":Z","4"));
+ sigIRC.emoticons.add(new Emoticon("B)","5"));
+ sigIRC.emoticons.add(new Emoticon(":\\","6"));
+ sigIRC.emoticons.add(new Emoticon(":/","6"));
+ sigIRC.emoticons.add(new Emoticon(";)","7"));
+ sigIRC.emoticons.add(new Emoticon(";p","8"));
+ sigIRC.emoticons.add(new Emoticon(";P","8"));
+ sigIRC.emoticons.add(new Emoticon(":p","9"));
+ sigIRC.emoticons.add(new Emoticon(":P","9"));
+ sigIRC.emoticons.add(new Emoticon("R)","10"));
+ sigIRC.emoticons.add(new Emoticon("o_O","20"));
+ sigIRC.emoticons.add(new Emoticon("O_o","20"));
+ sigIRC.emoticons.add(new Emoticon(":D","11"));
+ sigIRC.emoticons.add(new Emoticon(">(","12"));
+ sigIRC.emoticons.add(new Emoticon("<3","13"));
+ }
+
+ private void UpdateBar() {
+ bar.setString("Downloading resources... ("+bar.getValue()+"/"+managers.size()+")");
+ }
+}
+
+class FakeFileManager extends FileManager{
+ boolean done=false;
+ public FakeFileManager(String location) {
+ super(location);
+ }
+ public void setDone() {
+ done=true;
+ }
+}
diff --git a/src/sig/windows/TwitchEmoteDownload.java b/src/sig/windows/TwitchEmoteDownload.java
new file mode 100644
index 0000000..0099de9
--- /dev/null
+++ b/src/sig/windows/TwitchEmoteDownload.java
@@ -0,0 +1,21 @@
+package sig.windows;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import sig.Emoticon;
+import sig.sigIRC;
+
+public class TwitchEmoteDownload {
+ String name;
+ int id;
+
+ public TwitchEmoteDownload(String name,int id) {
+ this.name=name;
+ this.id=id;
+ }
+
+ public void download() throws MalformedURLException {
+ sigIRC.emoticons.add(new Emoticon(name,new URL(sigIRC.TWITCHEMOTEURL+id+"/1.0")));
+ }
+}