Add Loading Dialog, finish up intro dialog and setup tool.
This commit is contained in:
parent
2cee57d9e9
commit
f07a89fe22
BIN
lib/resource/deselected_button.png
Normal file
BIN
lib/resource/deselected_button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 229 B |
BIN
lib/resource/selected_button.png
Normal file
BIN
lib/resource/selected_button.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 331 B |
@ -1 +1 @@
|
||||
<h1>Hello World!</h1>
|
||||
<img src="../sigIRCicon.png" style="float:left;padding-right:5px;vertical-align:text-bottom;"><font size="5"><b>sigIRC</b> allows you to present dynamic content to viewers on stream and provides various features that may be helpful to you as a streamer. Click <i>Next</i> to begin the setup process.</font>
|
12
lib/resource/text/setupProgramSettings.html
Normal file
12
lib/resource/text/setupProgramSettings.html
Normal file
@ -0,0 +1,12 @@
|
||||
<font size="5">Now it's time to configure basic features of <b>sigIRC</b>. sigIRC provides the following modules:
|
||||
<br>
|
||||
<ul>
|
||||
<li><b>Scrolling Chat</b> - Displays scrolling chat messages across the screen as users of your channel talk.</li>
|
||||
<li><b>Chat Log</b> - Displays a box that contains the latest chat messages from your channel for that day.</li>
|
||||
<li><b>Controller</b> - Displays a controller on screen and allows you to configure the buttons and display so viewers can see your button inputs.</li>
|
||||
<li><b>Twitch</b> - 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.</li>
|
||||
<li><b>Rabi-Race</b> - For the game <b>Rabi-Ribi</b>. 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.</li>
|
||||
<li><b>Touhou Mother</b> - For the game <b>Touhou Mother</b>. 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.</li>
|
||||
</ul>
|
||||
<br><br>
|
||||
Each module will open up in a separate window that you can place and resize on your screen as you see fit.</font>
|
1
lib/resource/text/setupTwitchName.html
Normal file
1
lib/resource/text/setupTwitchName.html
Normal file
@ -0,0 +1 @@
|
||||
<font size="5"><b>sigIRC</b> uses your Twitch account in order to retrieve and send data. Please input your Twitch username below and hit <i>Next</i> to continue. You will be asked for authentication details on the next screen.</font>
|
1
lib/resource/text/setupoauthToken.html
Normal file
1
lib/resource/text/setupoauthToken.html
Normal file
@ -0,0 +1 @@
|
||||
<font size="5">Below you will see a button to <i><a href="https://twitchapps.com/tmi/">https://twitchapps.com/tmi/</a></i> which will allow you to retrieve an <b>oauth Token</b>. Connect to Twitch and generate an <b>oauth token</b>, then copy and paste the token into the box below to grant this program the ability to use Twitch services.</font>
|
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -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();
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
@ -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<String> messages = new ArrayList<String>();
|
||||
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) {
|
||||
|
@ -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());
|
||||
|
@ -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;i<displayMessage.size();i++) {
|
||||
//System.out.println("displayMessage["+i+"] before: "+displayMessage.get(i));
|
||||
@ -99,7 +99,7 @@ public class ChatLogMessage {
|
||||
|
||||
private void GenerateEmoticon(int textpos, int xpos, int ypos, String basemsg, Emoticon e) {
|
||||
String cutstring = basemsg.substring(0, textpos);
|
||||
double width = TextUtils.calculateStringBoundsFont(cutstring, sigIRC.panel.userFont).getWidth();
|
||||
double width = TextUtils.calculateStringBoundsFont(cutstring, sigIRC.userFont).getWidth();
|
||||
//System.out.println("Width of '"+cutstring+"' is "+width);
|
||||
//System.out.println("Offsetting emote by "+xpos+"+"+width);
|
||||
sigIRC.createEmoticon(e, this, (int)(xpos+width), ypos+16);
|
||||
@ -156,11 +156,11 @@ public class ChatLogMessage {
|
||||
|
||||
private void WrapText() {
|
||||
String rawmessage = rawMessage;
|
||||
int textWidth = (int)TextUtils.calculateStringBoundsFont(rawmessage, sigIRC.panel.userFont).getWidth();
|
||||
int textWidth = (int)TextUtils.calculateStringBoundsFont(rawmessage, sigIRC.userFont).getWidth();
|
||||
int maxWidth = (int)refModule.getPosition().getWidth()-BORDER_SPACING;
|
||||
do {
|
||||
rawmessage = BreakTextAtNextSection(rawmessage+" ",maxWidth);
|
||||
textWidth = (int)TextUtils.calculateStringBoundsFont(rawmessage, sigIRC.panel.userFont).getWidth();
|
||||
textWidth = (int)TextUtils.calculateStringBoundsFont(rawmessage, sigIRC.userFont).getWidth();
|
||||
} while (textWidth>maxWidth);
|
||||
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 (textWidth<maxWidth) {
|
||||
if (marker<msg.length()) {
|
||||
int tempmarker = msg.indexOf(' ', marker);
|
||||
if (tempmarker!=-1) {
|
||||
textWidth = (int)TextUtils.calculateStringBoundsFont(msg.substring(0, tempmarker), sigIRC.panel.userFont).getWidth();
|
||||
textWidth = (int)TextUtils.calculateStringBoundsFont(msg.substring(0, tempmarker), sigIRC.userFont).getWidth();
|
||||
if (textWidth<maxWidth) {
|
||||
marker = tempmarker+1;
|
||||
}
|
||||
@ -213,10 +213,10 @@ public class ChatLogMessage {
|
||||
for (int i=0;i<displayMessage.size();i++) {
|
||||
//System.out.println(displayMessage.get(i));
|
||||
if (username!=null && i==0) {
|
||||
DrawUtils.drawOutlineText(g, sigIRC.panel.userFont, refModule.getPosition().getX()+position.getX(), refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, 2, GetUserNameColor(this.username), SHADOW_COL, this.username);
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, refModule.getPosition().getX()+position.getX()+usernameWidth+2, refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, Color.BLACK, displayMessage.get(i));
|
||||
DrawUtils.drawOutlineText(g, sigIRC.userFont, refModule.getPosition().getX()+position.getX(), refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, 2, GetUserNameColor(this.username), SHADOW_COL, this.username);
|
||||
DrawUtils.drawTextFont(g, sigIRC.userFont, refModule.getPosition().getX()+position.getX()+usernameWidth+2, refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, Color.BLACK, displayMessage.get(i));
|
||||
} else {
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, refModule.getPosition().getX()+position.getX(), refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, Color.BLACK, displayMessage.get(i));
|
||||
DrawUtils.drawTextFont(g, sigIRC.userFont, refModule.getPosition().getX()+position.getX(), refModule.getPosition().getY()+position.getY()+(i*MESSAGE_SPACING)+32, Color.BLACK, displayMessage.get(i));
|
||||
}
|
||||
}
|
||||
g.drawImage(Module.MSG_SEPARATOR, (int)(refModule.getPosition().getX()+position.getX()+8), (int)(refModule.getPosition().getY()+position.getY()+messageDisplaySize.getY()+12), (int)(messageDisplaySize.getX()-8), 1, sigIRC.panel);
|
||||
|
@ -52,7 +52,7 @@ public class ClickableButton {
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillRect((int)module.getPosition().getX()+x+1,
|
||||
(int)module.getPosition().getY()+y+1, width-1, height-1);
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.panel.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label);
|
||||
DrawUtils.drawTextFont(g, sigIRC.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label);
|
||||
g.setColor(color_identity);
|
||||
}
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class ClickableButton {
|
||||
g.setColor(Color.BLACK);
|
||||
g.fillRect((int)module.getPosition().getX()+x+1,
|
||||
(int)module.getPosition().getY()+y+1, width-1, height-1);
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.panel.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label);
|
||||
DrawUtils.drawTextFont(g, sigIRC.userFont, module.getPosition().getX()+x-TextUtils.calculateStringBoundsFont(label, sigIRC.userFont).getWidth()/2+width/2, module.getPosition().getY()+y+height-1, Color.WHITE, label);
|
||||
g.setColor(color_identity);
|
||||
}
|
||||
}
|
||||
|
@ -341,18 +341,18 @@ public class Profile {
|
||||
//g2.fillRect(1, 1, 32, 32);
|
||||
g2.drawImage(avatar.getAvatarImage(), 1, 1, sigIRC.panel);
|
||||
g2.setColor(ScrollingText.GetUserNameColor(displayName));
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiMoneyDisplayFont, 54, 26, 1, g2.getColor(), Color.BLACK, displayName);
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.panel.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.2), 50, 1, GetDifficultyColor(), Color.BLACK, GetDifficultyName());
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.rabiRibiMoneyDisplayFont, 54, 26, 1, g2.getColor(), Color.BLACK, displayName);
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.2), 50, 1, GetDifficultyColor(), Color.BLACK, GetDifficultyName());
|
||||
String text = TextUtils.convertSecondsToTimeFormat(playtime/60);
|
||||
if (isPaused) {
|
||||
g2.setColor(new Color(128,96,0));
|
||||
} else {
|
||||
g2.setColor(Color.BLACK);
|
||||
}
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiMoneyDisplayFont, (int)(tmp.getWidth() - TextUtils.calculateStringBoundsFont(text, sigIRC.panel.rabiRibiMoneyDisplayFont).getWidth()) - 2, 16, 1, g2.getColor(), Color.GRAY, text);
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.rabiRibiMoneyDisplayFont, (int)(tmp.getWidth() - TextUtils.calculateStringBoundsFont(text, sigIRC.rabiRibiMoneyDisplayFont).getWidth()) - 2, 16, 1, g2.getColor(), Color.GRAY, text);
|
||||
text = "Map "+df.format(mappct)+"% Item "+df.format(itempct)+"%";
|
||||
//DrawUtils.drawOutlineText(g2, sigIRC.panel.rabiRibiMoneyDisplayFont, (int)(parent.position.getWidth() - TextUtils.calculateStringBoundsFont(text, sigIRC.panel.rabiRibiMoneyDisplayFont).getWidth()) - 2, 16, 1, g2.getColor(), Color.GRAY, text);
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.panel.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.6), 50, 2, Color.WHITE, Color.BLACK, text);
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.rabiRibiTinyDisplayFont, (int)(tmp.getWidth()*0.6), 50, 2, Color.WHITE, Color.BLACK, text);
|
||||
|
||||
statUpdateCacheImage = tmp.getScaledInstance(w, -1, Image.SCALE_AREA_AVERAGING);
|
||||
//stat_update_required = false;
|
||||
@ -487,12 +487,12 @@ public class Profile {
|
||||
if (size*icon_size<width) {
|
||||
g2.drawImage(data.getImage(), (int)(+border+((count++)*icon_size)), (int)(+96+32)+shiftyval, (int)(icon_size*iconsize), (int)(icon_size*iconsize), sigIRC.panel);
|
||||
if (badges.get(data)==2) {
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.panel.smallFont, (int)(+border+((count-1)*icon_size))+4, (int)(+96+32)+icon_size+shiftyval, 1, Color.WHITE, TEAL, "E");
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.smallFont, (int)(+border+((count-1)*icon_size))+4, (int)(+96+32)+icon_size+shiftyval, 1, Color.WHITE, TEAL, "E");
|
||||
}
|
||||
} else {
|
||||
g2.drawImage(data.getImage(), (int)(+border+((width/size)*(count++))), (int)(+96+32)+shiftyval, (int)(icon_size*iconsize), (int)(icon_size*iconsize), sigIRC.panel);
|
||||
if (badges.get(data)==2) {
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.panel.smallFont, (int)(+border+((width/size)*(count-1)))+4, (int)(+96+32)+icon_size+shiftyval, 1, Color.WHITE, TEAL, "E");
|
||||
DrawUtils.drawOutlineText(g2, sigIRC.smallFont, (int)(+border+((width/size)*(count-1)))+4, (int)(+96+32)+icon_size+shiftyval, 1, Color.WHITE, TEAL, "E");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -524,7 +524,7 @@ public class Profile {
|
||||
} else {
|
||||
g2.drawImage(img,(int)(+border+((i)*(spacing))-icon_size/2),(int)(+96+56)+shiftyval, (int)icon_size, (int)icon_size, sigIRC.panel);
|
||||
}
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.panel.programFont, (int)((+border+((i)*(spacing))-icon_size/2)+(spacing/2)+4), (int)(+96+56+icon_size+12)+shiftyval, 1, Color.WHITE, Color.BLUE, Integer.toString(amts[i++]));
|
||||
DrawUtils.drawCenteredOutlineText(g2, sigIRC.programFont, (int)((+border+((i)*(spacing))-icon_size/2)+(spacing/2)+4), (int)(+96+56+icon_size+12)+shiftyval, 1, Color.WHITE, Color.BLUE, Integer.toString(amts[i++]));
|
||||
}
|
||||
} catch (ConcurrentModificationException e) {
|
||||
|
||||
|
@ -474,7 +474,7 @@ public class SessionCreateWindow extends JFrame{
|
||||
setBackground(list.getBackground());
|
||||
setForeground(list.getForeground());
|
||||
}
|
||||
setFont(sigIRC.panel.rabiRibiMoneyDisplayFont);
|
||||
setFont(sigIRC.rabiRibiMoneyDisplayFont);
|
||||
setIconTextGap(4);
|
||||
return this;
|
||||
}
|
||||
|
@ -130,6 +130,7 @@ public class RabiRaceModule extends Module{
|
||||
|
||||
File dir = new File(ITEMS_DIRECTORY);
|
||||
|
||||
/*
|
||||
for (MemoryData data : MemoryData.values()) {
|
||||
//Attempt to fetch from server.
|
||||
new FileManager("sigIRC/rabi-ribi/items/"+data.img_path).verifyAndFetchFileFromServer();
|
||||
@ -143,7 +144,7 @@ public class RabiRaceModule extends Module{
|
||||
new FileManager("sigIRC/rabi-ribi/items/regen_up.png").verifyAndFetchFileFromServer();
|
||||
new FileManager("sigIRC/rabi-ribi/items/pack_up.png").verifyAndFetchFileFromServer();
|
||||
new FileManager("sigIRC/rabi-ribi/items/attack_up.png").verifyAndFetchFileFromServer();
|
||||
|
||||
*/
|
||||
AddImagesToImageMap(dir,ITEMS_DIRECTORY);
|
||||
dir = new File(AVATAR_DIRECTORY);
|
||||
AddImagesToImageMap(dir,AVATAR_DIRECTORY);
|
||||
@ -438,7 +439,7 @@ public class RabiRaceModule extends Module{
|
||||
super.draw(g);
|
||||
|
||||
if (!foundRabiRibi) {
|
||||
DrawUtils.drawTextFont(g, sigIRC.panel.userFont, position.getX(), position.getY()+26, Color.BLACK, "Rabi-Ribi not found! Please start it.");
|
||||
DrawUtils.drawTextFont(g, sigIRC.userFont, position.getX(), position.getY()+26, Color.BLACK, "Rabi-Ribi not found! Please start it.");
|
||||
} else {
|
||||
//myProfile.draw(g);
|
||||
Image panel = myProfile.getStatPanel((int)position.getWidth(),mySession);
|
||||
@ -497,7 +498,7 @@ public class RabiRaceModule extends Module{
|
||||
this.msg = message;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.bounds = TextUtils.calculateStringBoundsFont(message, sigIRC.panel.rabiRibiTinyDisplayFont);
|
||||
this.bounds = TextUtils.calculateStringBoundsFont(message, sigIRC.rabiRibiTinyDisplayFont);
|
||||
RabiRaceModule.lastScrollX += bounds.getWidth() + 96;
|
||||
}
|
||||
|
||||
@ -511,7 +512,7 @@ public class RabiRaceModule extends Module{
|
||||
|
||||
public void draw(Graphics g) {
|
||||
if (x<position.getWidth()) {
|
||||
DrawUtils.drawOutlineText(g, sigIRC.panel.rabiRibiTinyDisplayFont, position.getX()+x, position.getY()+y-6, 2, Color.WHITE, Color.GRAY, msg);
|
||||
DrawUtils.drawOutlineText(g, sigIRC.rabiRibiTinyDisplayFont, position.getX()+x, position.getY()+y-6, 2, Color.WHITE, Color.GRAY, msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public class RabiRibiModule extends Module{
|
||||
if (moneyearned>0 && 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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;i<sorteddmg.length;i++) {
|
||||
if (sorteddmg[i]!=-1 && characterDatabase[sorteddmg[i]].getDataProperty(property)>0) {
|
||||
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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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 (textY<position.getY()+position.getHeight() && textX+usernameTextsize.getWidth()>position.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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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<String> messages = new ArrayList<String>();
|
||||
final public static Font programFont = new Font(messageFont,0,24);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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<String> 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<String>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
|
204
src/sig/windows/LoadingDialog.java
Normal file
204
src/sig/windows/LoadingDialog.java
Normal file
@ -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<FileManager> managers = new ArrayList<FileManager>();
|
||||
FakeFileManager programUpdate = new FakeFileManager("_FAKE_");
|
||||
FakeFileManager twitchEmoteUpdate = new FakeFileManager("_FAKE_");
|
||||
public JPanel panel;
|
||||
public static List<TwitchEmoteDownload> emotes = new ArrayList<TwitchEmoteDownload>();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
21
src/sig/windows/TwitchEmoteDownload.java
Normal file
21
src/sig/windows/TwitchEmoteDownload.java
Normal file
@ -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")));
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user