Added Dragging Capabilities for Modules. Cleaned up Button class for
Touhou Mother Module. Removed constant dinging sound when oAuth token does not authenticate properly.
This commit is contained in:
parent
d91c705403
commit
9251d09aa7
@ -2,7 +2,7 @@
|
|||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||||
<classpathentry kind="lib" path="D:/Data/commons-io-2.5.jar">
|
<classpathentry kind="lib" path="D:/Downloads/commons-io-2.5.jar">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="javadoc_location" value="jar:file:/D:/Data/commons-io-2.5-javadoc.jar!/"/>
|
<attribute name="javadoc_location" value="jar:file:/D:/Data/commons-io-2.5-javadoc.jar!/"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@
|
|||||||
/swap.png
|
/swap.png
|
||||||
/update.png
|
/update.png
|
||||||
/WSplits
|
/WSplits
|
||||||
|
/drag_bar.png
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<attribute name="Class-Path" value="."/>
|
<attribute name="Class-Path" value="."/>
|
||||||
</manifest>
|
</manifest>
|
||||||
<fileset dir="${dir.jarfile}/bin"/>
|
<fileset dir="${dir.jarfile}/bin"/>
|
||||||
<zipfileset excludes="META-INF/*.SF" src="D:/Data/commons-io-2.5.jar"/>
|
<zipfileset excludes="META-INF/*.SF" src="D:/Downloads/commons-io-2.5.jar"/>
|
||||||
</jar>
|
</jar>
|
||||||
</target>
|
</target>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
BIN
sigIRCv2.jar
BIN
sigIRCv2.jar
Binary file not shown.
@ -11,11 +11,11 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import sig.DrawUtils;
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.TextUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class BackgroundColorButton {
|
public class BackgroundColorButton {
|
||||||
BufferedImage buttonimg;
|
BufferedImage buttonimg;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package sig;
|
package sig;
|
||||||
|
|
||||||
|
import sig.utils.SoundUtils;
|
||||||
|
|
||||||
public class CustomSound {
|
public class CustomSound {
|
||||||
final static int SOUNDCOOLDOWN = 108000;
|
final static int SOUNDCOOLDOWN = 108000;
|
||||||
|
|||||||
@ -6,6 +6,8 @@ import java.net.URL;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Emoticon {
|
public class Emoticon {
|
||||||
private BufferedImage image=null;
|
private BufferedImage image=null;
|
||||||
private String emotename=null;
|
private String emotename=null;
|
||||||
|
|||||||
@ -1,43 +1,131 @@
|
|||||||
package sig;
|
package sig;
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Cursor;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Point;
|
||||||
|
import java.awt.Rectangle;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseWheelEvent;
|
import java.awt.event.MouseWheelEvent;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Module {
|
public class Module {
|
||||||
protected Rectangle2D bounds;
|
protected Rectangle2D bounds;
|
||||||
protected boolean enabled;
|
protected boolean enabled;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
public static BufferedImage IMG_DRAGBAR;
|
||||||
|
|
||||||
|
final protected int titleHeight;
|
||||||
|
|
||||||
|
Point dragOffset;
|
||||||
|
boolean dragging=false;
|
||||||
|
|
||||||
public Module(Rectangle2D bounds, String moduleName) {
|
public Module(Rectangle2D bounds, String moduleName) {
|
||||||
this.bounds = bounds;
|
this.bounds = bounds;
|
||||||
this.name = moduleName;
|
this.name = moduleName;
|
||||||
this.enabled=true;
|
this.enabled=true;
|
||||||
|
|
||||||
|
this.titleHeight = (int)TextUtils.calculateStringBoundsFont(this.name, sigIRC.panel.userFont).getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Module(Rectangle2D bounds, String moduleName, boolean enabled) {
|
public Module(Rectangle2D bounds, String moduleName, boolean enabled) {
|
||||||
this.bounds = bounds;
|
this(bounds, moduleName);
|
||||||
this.name = moduleName;
|
|
||||||
this.enabled=enabled;
|
this.enabled=enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void mouseModuleMousePress(MouseEvent ev) {
|
||||||
|
int mouseX = ev.getX();
|
||||||
|
int mouseY = ev.getY();
|
||||||
|
//System.out.println(mouseX + "," + mouseY);
|
||||||
|
enableWindowDrag(mouseX,mouseY);
|
||||||
|
mousePressed(ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void enableWindowDrag(int mouseX, int mouseY) {
|
||||||
|
if (!dragging && inDragBounds(mouseX,mouseY)) {
|
||||||
|
//Enable dragging.
|
||||||
|
dragOffset = new Point((int)bounds.getX() - mouseX,(int)bounds.getY()-mouseY);
|
||||||
|
dragging=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean inDragBounds(int x, int y) {
|
||||||
|
return x>=bounds.getX() && x<=bounds.getX()+bounds.getWidth() &&
|
||||||
|
y>=(int)bounds.getY()-Module.IMG_DRAGBAR.getHeight() &&
|
||||||
|
y<=(int)bounds.getY();
|
||||||
|
}
|
||||||
|
|
||||||
public void mousePressed(MouseEvent ev) {
|
public void mousePressed(MouseEvent ev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void mouseReleased(MouseEvent ev) {
|
||||||
|
if (dragging) {
|
||||||
|
dragging=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void moduleRun() {
|
||||||
|
dragWindow();
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void dragWindow() {
|
||||||
|
if (dragging) {
|
||||||
|
sigIRC.panel.repaint(getDrawBounds().getBounds());
|
||||||
|
int mouseX = sigIRC.panel.lastMouseX+(int)dragOffset.getX();
|
||||||
|
int mouseY = sigIRC.panel.lastMouseY+(int)dragOffset.getY();
|
||||||
|
int oldX = (int)bounds.getX();
|
||||||
|
int oldY = (int)bounds.getY();
|
||||||
|
bounds = new Rectangle(mouseX, mouseY,(int)bounds.getWidth(),(int)bounds.getHeight());
|
||||||
|
//System.out.println(sigIRC.panel.lastMouseX+","+sigIRC.panel.lastMouseY);
|
||||||
|
ModuleDragEvent(oldX,oldY,mouseX,mouseY);
|
||||||
|
}
|
||||||
|
if (inDragBounds(sigIRC.panel.lastMouseX,sigIRC.panel.lastMouseY)) {
|
||||||
|
sigIRC.panel.setCursor(new Cursor(Cursor.MOVE_CURSOR));
|
||||||
|
} else
|
||||||
|
if (sigIRC.panel.getCursor().getType()==Cursor.MOVE_CURSOR) {
|
||||||
|
sigIRC.panel.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
|
drawModuleHeader(g);
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
sigIRC.panel.repaint(bounds.getBounds());
|
sigIRC.panel.repaint(getDrawBounds().getBounds());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void drawModuleHeader(Graphics g) {
|
||||||
|
g.drawImage(Module.IMG_DRAGBAR,
|
||||||
|
(int)bounds.getX()+2,
|
||||||
|
(int)bounds.getY()-Module.IMG_DRAGBAR.getHeight(),
|
||||||
|
(int)bounds.getWidth()-4,
|
||||||
|
Module.IMG_DRAGBAR.getHeight(),
|
||||||
|
sigIRC.panel);
|
||||||
|
DrawUtils.drawTextFont(g, sigIRC.panel.smallFont, (int)bounds.getX(), (int)bounds.getY()-titleHeight/2+4, Color.BLACK, this.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Rectangle2D getDrawBounds() {
|
||||||
|
Rectangle2D drawBounds = new Rectangle((int)bounds.getX(),(int)bounds.getY()-titleHeight+3,(int)bounds.getWidth(),(int)bounds.getHeight()+titleHeight);
|
||||||
|
return drawBounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ModuleDragEvent(int oldX, int oldY, int newX, int newY) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void mouseWheel(MouseWheelEvent ev) {
|
public void mouseWheel(MouseWheelEvent ev) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,11 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addMessage(String message) {
|
public void addMessage(String message) {
|
||||||
ScrollingText text = new ScrollingText(message,this.getWidth(),(int)(Math.random()*128));
|
addMessage(message,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addMessage(String message, boolean playSound) {
|
||||||
|
ScrollingText text = new ScrollingText(message,this.getWidth(),(int)(Math.random()*128),playSound);
|
||||||
TextRow row = TextRow.PickRandomTextRow(text.getUsername());
|
TextRow row = TextRow.PickRandomTextRow(text.getUsername());
|
||||||
sigIRC.textobj.add(text);
|
sigIRC.textobj.add(text);
|
||||||
row.updateRow(text);
|
row.updateRow(text);
|
||||||
@ -108,13 +112,16 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent ev) {
|
public void mousePressed(MouseEvent ev) {
|
||||||
for (Module m : sigIRC.modules) {
|
for (Module m : sigIRC.modules) {
|
||||||
m.mousePressed(ev);
|
m.mouseModuleMousePress(ev);
|
||||||
}
|
}
|
||||||
sigIRC.button.onClickEvent(ev);
|
sigIRC.button.onClickEvent(ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(MouseEvent ev) {
|
public void mouseReleased(MouseEvent ev) {
|
||||||
|
for (Module m : sigIRC.modules) {
|
||||||
|
m.mouseReleased(ev);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -20,6 +20,11 @@ import javax.sound.sampled.LineUnavailableException;
|
|||||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.SoundUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class ScrollingText {
|
public class ScrollingText {
|
||||||
private String username;
|
private String username;
|
||||||
private String message;
|
private String message;
|
||||||
@ -86,9 +91,15 @@ public class ScrollingText {
|
|||||||
this.stringWidth = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getWidth();
|
this.stringWidth = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getWidth();
|
||||||
this.stringHeight = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getHeight();
|
this.stringHeight = (int)TextUtils.calculateStringBoundsFont(this.message,MyPanel.programFont).getHeight();
|
||||||
this.userstringWidth = (int)TextUtils.calculateStringBoundsFont(this.username,MyPanel.userFont).getWidth();
|
this.userstringWidth = (int)TextUtils.calculateStringBoundsFont(this.username,MyPanel.userFont).getWidth();
|
||||||
|
}
|
||||||
|
|
||||||
|
public ScrollingText(String msg, double x, double y, boolean playSound) {
|
||||||
|
this(msg,x,y);
|
||||||
|
|
||||||
|
if (playSound) {
|
||||||
playMessageSound(username);
|
playMessageSound(username);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void playMessageSound(String user) {
|
private void playMessageSound(String user) {
|
||||||
CustomSound cs = CustomSound.getCustomSound(user);
|
CustomSound cs = CustomSound.getCustomSound(user);
|
||||||
|
|||||||
@ -24,7 +24,10 @@ public class UpdateEvent implements ActionListener{
|
|||||||
} else
|
} else
|
||||||
if (!sigIRC.authenticated && last_authentication_msg>=MSGTIMER) {
|
if (!sigIRC.authenticated && last_authentication_msg>=MSGTIMER) {
|
||||||
last_authentication_msg=0;
|
last_authentication_msg=0;
|
||||||
sigIRC.panel.addMessage("SYSTEM: Your oauthToken was not successful. Please go to the sigIRC folder and make sure your oauthToken.txt file is correct!!! SwiftRage");
|
sigIRC.panel.addMessage("SYSTEM: Your oauthToken was not successful. Please go to the sigIRC folder and make sure your oauthToken.txt file is correct!!! SwiftRage",!sigIRC.playedoAuthSoundOnce);
|
||||||
|
if (!sigIRC.playedoAuthSoundOnce) {
|
||||||
|
sigIRC.playedoAuthSoundOnce=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (last_autosave<AUTOSAVETIMER) {
|
if (last_autosave<AUTOSAVETIMER) {
|
||||||
last_authentication_msg++;
|
last_authentication_msg++;
|
||||||
@ -89,7 +92,7 @@ public class UpdateEvent implements ActionListener{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Module m : sigIRC.modules) {
|
for (Module m : sigIRC.modules) {
|
||||||
m.run();
|
m.moduleRun();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,31 +11,16 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import sig.DrawUtils;
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.TextUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Button2 {
|
public class KillButton extends TouhouMotherButton{
|
||||||
BufferedImage buttonimg;
|
|
||||||
int x=0;
|
|
||||||
int y=0;
|
|
||||||
TouhouMotherModule module;
|
|
||||||
|
|
||||||
public Button2(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
public KillButton(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
||||||
this.x=x;
|
super(parentmodule,filename,x,y);
|
||||||
this.y=y;
|
|
||||||
this.module=parentmodule;
|
|
||||||
try {
|
|
||||||
buttonimg = ImageIO.read(filename);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
|
||||||
g.drawImage(buttonimg, x, y, sigIRC.panel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onClickEvent(MouseEvent ev) {
|
public void onClickEvent(MouseEvent ev) {
|
||||||
@ -17,18 +17,14 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import sig.DrawUtils;
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.MyPanel;
|
import sig.MyPanel;
|
||||||
import sig.TextUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Button3 {
|
public class SwapButton extends TouhouMotherButton{
|
||||||
BufferedImage buttonimg;
|
|
||||||
int x=0;
|
|
||||||
int y=0;
|
|
||||||
TouhouMotherModule module;
|
|
||||||
final static String GAMEDIR = "D:/Documents/Games/Touhou Mother/Data/";
|
final static String GAMEDIR = "D:/Documents/Games/Touhou Mother/Data/";
|
||||||
|
|
||||||
boolean controlKeyPressed;
|
boolean controlKeyPressed;
|
||||||
@ -39,15 +35,8 @@ public class Button3 {
|
|||||||
|
|
||||||
int slotselected=0;
|
int slotselected=0;
|
||||||
|
|
||||||
public Button3(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
public SwapButton(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
||||||
this.x=x;
|
super(parentmodule,filename,x,y);
|
||||||
this.y=y;
|
|
||||||
this.module=parentmodule;
|
|
||||||
try {
|
|
||||||
buttonimg = ImageIO.read(filename);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -57,7 +46,7 @@ public class Button3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
g.drawImage(buttonimg, x, y, sigIRC.panel);
|
super.draw(g);
|
||||||
if (displaytime>0) {
|
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, MyPanel.smallFont, x+buttonimg.getWidth()+4, y+buttonimg.getHeight(), 2, Color.WHITE, new Color(60,0,150), message);
|
||||||
}
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package sig.modules.TouhouMother;
|
package sig.modules.TouhouMother;
|
||||||
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
|
||||||
public class TimeRecord {
|
public class TimeRecord {
|
||||||
final public static int ERROR_VALUE = Integer.MAX_VALUE;
|
final public static int ERROR_VALUE = Integer.MAX_VALUE;
|
||||||
|
|||||||
66
src/sig/modules/TouhouMother/TouhouMotherButton.java
Normal file
66
src/sig/modules/TouhouMother/TouhouMotherButton.java
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
package sig.modules.TouhouMother;
|
||||||
|
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.awt.event.MouseWheelEvent;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
|
import sig.sigIRC;
|
||||||
|
import sig.modules.TouhouMotherModule;
|
||||||
|
|
||||||
|
public class TouhouMotherButton {
|
||||||
|
protected BufferedImage buttonimg;
|
||||||
|
protected int x=0;
|
||||||
|
protected int y=0;
|
||||||
|
protected TouhouMotherModule module;
|
||||||
|
|
||||||
|
public TouhouMotherButton(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
||||||
|
this.x=x;
|
||||||
|
this.y=y;
|
||||||
|
this.module=parentmodule;
|
||||||
|
try {
|
||||||
|
buttonimg = ImageIO.read(filename);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(Graphics g) {
|
||||||
|
g.drawImage(buttonimg, x, y, sigIRC.panel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onClickEvent(MouseEvent ev) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyPressEvent(KeyEvent ev) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void keyReleaseEvent(KeyEvent ev) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onMouseWheelEvent(MouseWheelEvent ev) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updatePosition(int oldX, int oldY, int newX, int newY) {
|
||||||
|
int diffx = x - oldX;
|
||||||
|
int diffy = y - oldY;
|
||||||
|
x = newX + diffx;
|
||||||
|
y = newY + diffy;
|
||||||
|
/*System.out.println("Old: "+oldX+","+oldY);
|
||||||
|
System.out.println("New: "+newX+","+newY);
|
||||||
|
System.out.println("Diffs: "+diffx+","+diffy);*/
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,41 +11,30 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
|
|
||||||
import sig.DrawUtils;
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.TextUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class Button {
|
public class UpdateButton extends TouhouMotherButton{
|
||||||
BufferedImage buttonimg;
|
|
||||||
int x=0;
|
|
||||||
int y=0;
|
|
||||||
String[] data;
|
String[] data;
|
||||||
int currentselection=4;
|
int currentselection=4;
|
||||||
TouhouMotherModule module;
|
|
||||||
boolean buttonEnabled = false;
|
boolean buttonEnabled = false;
|
||||||
|
|
||||||
public Button(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
public UpdateButton(TouhouMotherModule parentmodule, File filename, int x, int y) {
|
||||||
this.x=x;
|
super(parentmodule,filename,x,y);
|
||||||
this.y=y;
|
|
||||||
data = FileUtils.readFromFile(sigIRC.BASEDIR+"WSplits");
|
data = FileUtils.readFromFile(sigIRC.BASEDIR+"WSplits");
|
||||||
if (data.length>4) {
|
if (data.length>4) {
|
||||||
buttonEnabled=true;
|
buttonEnabled=true;
|
||||||
}
|
}
|
||||||
this.module=parentmodule;
|
|
||||||
try {
|
|
||||||
buttonimg = ImageIO.read(filename);
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (buttonEnabled) {
|
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.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),
|
||||||
data[currentselection].split(",")[0]);
|
data[currentselection].split(",")[0]);
|
||||||
g.drawImage(buttonimg, x, y, sigIRC.panel);
|
super.draw(g);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,22 +19,23 @@ import java.util.List;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
import sig.DrawUtils;
|
|
||||||
import sig.FileUtils;
|
|
||||||
import sig.Module;
|
import sig.Module;
|
||||||
import sig.TextUtils;
|
|
||||||
import sig.sigIRC;
|
import sig.sigIRC;
|
||||||
import sig.modules.TouhouMother.Button;
|
|
||||||
import sig.modules.TouhouMother.Button2;
|
|
||||||
import sig.modules.TouhouMother.Button3;
|
|
||||||
import sig.modules.TouhouMother.DataProperty;
|
import sig.modules.TouhouMother.DataProperty;
|
||||||
import sig.modules.TouhouMother.IncreaseTouhouMotherClockCount;
|
import sig.modules.TouhouMother.IncreaseTouhouMotherClockCount;
|
||||||
|
import sig.modules.TouhouMother.KillButton;
|
||||||
|
import sig.modules.TouhouMother.SwapButton;
|
||||||
import sig.modules.TouhouMother.TimeRecord;
|
import sig.modules.TouhouMother.TimeRecord;
|
||||||
import sig.modules.TouhouMother.TouhouMotherBossData;
|
import sig.modules.TouhouMother.TouhouMotherBossData;
|
||||||
|
import sig.modules.TouhouMother.TouhouMotherButton;
|
||||||
import sig.modules.TouhouMother.TouhouMotherCharacterData;
|
import sig.modules.TouhouMother.TouhouMotherCharacterData;
|
||||||
import sig.modules.TouhouMother.TouhouPlayerCharacter;
|
import sig.modules.TouhouMother.TouhouPlayerCharacter;
|
||||||
|
import sig.modules.TouhouMother.UpdateButton;
|
||||||
import sig.modules.utils.SemiValidInteger;
|
import sig.modules.utils.SemiValidInteger;
|
||||||
import sig.modules.utils.SemiValidString;
|
import sig.modules.utils.SemiValidString;
|
||||||
|
import sig.utils.DrawUtils;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class TouhouMotherModule extends Module implements ActionListener{
|
public class TouhouMotherModule extends Module implements ActionListener{
|
||||||
Timer filereadClock = new Timer(200,this);
|
Timer filereadClock = new Timer(200,this);
|
||||||
@ -66,9 +67,11 @@ public class TouhouMotherModule extends Module implements ActionListener{
|
|||||||
|
|
||||||
boolean diamondSparkyMsg = false;
|
boolean diamondSparkyMsg = false;
|
||||||
|
|
||||||
Button updateButton;
|
List<TouhouMotherButton> moduleButtons = new ArrayList<TouhouMotherButton>();
|
||||||
Button2 killButton;
|
|
||||||
Button3 swapButton;
|
UpdateButton updateButton;
|
||||||
|
KillButton killButton;
|
||||||
|
SwapButton swapButton;
|
||||||
|
|
||||||
public TouhouMotherModule(Rectangle2D bounds, String moduleName) {
|
public TouhouMotherModule(Rectangle2D bounds, String moduleName) {
|
||||||
super(bounds, moduleName);
|
super(bounds, moduleName);
|
||||||
@ -109,6 +112,12 @@ public class TouhouMotherModule extends Module implements ActionListener{
|
|||||||
EnableAndDisableTimer();
|
EnableAndDisableTimer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ModuleDragEvent(int oldX, int oldY, int newX, int newY) {
|
||||||
|
for (TouhouMotherButton tmb : moduleButtons) {
|
||||||
|
tmb.updatePosition(oldX,oldY,newX,newY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void draw(Graphics g) {
|
public void draw(Graphics g) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
super.draw(g);
|
super.draw(g);
|
||||||
@ -487,15 +496,18 @@ public class TouhouMotherModule extends Module implements ActionListener{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void DefineButton() {
|
private void DefineButton() {
|
||||||
updateButton = new Button(this, //56x20 pixels
|
updateButton = new UpdateButton(this, //56x20 pixels
|
||||||
new File(sigIRC.BASEDIR+"update.png"),
|
new File(sigIRC.BASEDIR+"update.png"),
|
||||||
(int)bounds.getX()+320-56,(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
|
(int)bounds.getX()+320-56,(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
|
||||||
killButton = new Button2(this,
|
killButton = new KillButton(this,
|
||||||
new File(sigIRC.BASEDIR+"kill.png"),
|
new File(sigIRC.BASEDIR+"kill.png"),
|
||||||
(int)bounds.getX(),(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
|
(int)bounds.getX(),(int)bounds.getY()+sigIRC.panel.getHeight()/2-20);
|
||||||
swapButton = new Button3(this,
|
swapButton = new SwapButton(this,
|
||||||
new File(sigIRC.BASEDIR+"swap.png"),
|
new File(sigIRC.BASEDIR+"swap.png"),
|
||||||
(int)bounds.getX(),(int)bounds.getY()+sigIRC.panel.getHeight()/2-40);
|
(int)bounds.getX(),(int)bounds.getY()+sigIRC.panel.getHeight()/2-40);
|
||||||
|
moduleButtons.add(updateButton);
|
||||||
|
moduleButtons.add(killButton);
|
||||||
|
moduleButtons.add(swapButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Rectangle2D getBounds() {
|
public Rectangle2D getBounds() {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package sig.modules.utils;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import sig.TextUtils;
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class SemiValidInteger {
|
public class SemiValidInteger {
|
||||||
final public static int ERROR_VALUE = Integer.MIN_VALUE;
|
final public static int ERROR_VALUE = Integer.MIN_VALUE;
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package sig.modules.utils;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
import sig.TextUtils;
|
import sig.utils.TextUtils;
|
||||||
|
|
||||||
public class SemiValidString {
|
public class SemiValidString {
|
||||||
final public static String ERROR_VALUE = "nil";
|
final public static String ERROR_VALUE = "nil";
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import org.json.JSONException;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import sig.modules.TouhouMotherModule;
|
import sig.modules.TouhouMotherModule;
|
||||||
|
import sig.utils.FileUtils;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -70,11 +71,12 @@ public class sigIRC{
|
|||||||
static int chatScrollSpd=4;
|
static int chatScrollSpd=4;
|
||||||
static int rowSpacing=64;
|
static int rowSpacing=64;
|
||||||
static String messageFont="Gill Sans Ultra Bold Condensed";
|
static String messageFont="Gill Sans Ultra Bold Condensed";
|
||||||
static String usernameFont="Gill Sans";
|
static String usernameFont="GillSansMTStd-Book";
|
||||||
static String touhoumotherConsoleFont="Agency FB Bold";
|
static String touhoumotherConsoleFont="Agency FB Bold";
|
||||||
static boolean touhoumothermodule_enabled=true;
|
static boolean touhoumothermodule_enabled=true;
|
||||||
static boolean downloadsComplete=false;
|
static boolean downloadsComplete=false;
|
||||||
static boolean hardwareAcceleration=true;
|
static boolean hardwareAcceleration=true;
|
||||||
|
static boolean playedoAuthSoundOnce=false;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
@ -148,10 +150,16 @@ public class sigIRC{
|
|||||||
manager = new FileManager("swap.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("swap.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("update.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
|
||||||
|
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
|
||||||
manager = new FileManager("WSplits"); manager.verifyAndFetchFileFromServer();
|
manager = new FileManager("WSplits"); manager.verifyAndFetchFileFromServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitializeModules() {
|
private static void InitializeModules() {
|
||||||
|
try {
|
||||||
|
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png"));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
if (touhoumothermodule_enabled) {
|
if (touhoumothermodule_enabled) {
|
||||||
modules.add(new TouhouMotherModule(
|
modules.add(new TouhouMotherModule(
|
||||||
new Rectangle(0,panel.getHeight()/2,320,panel.getHeight()/2),
|
new Rectangle(0,panel.getHeight()/2,320,panel.getHeight()/2),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package sig;
|
package sig.utils;
|
||||||
import java.awt.BasicStroke;
|
import java.awt.BasicStroke;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
@ -13,6 +13,8 @@ import java.awt.font.TextAttribute;
|
|||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
import java.text.AttributedString;
|
import java.text.AttributedString;
|
||||||
|
|
||||||
|
import sig.MyPanel;
|
||||||
|
|
||||||
public class DrawUtils {
|
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) {
|
public static void drawOutlineText(Graphics g, Font font, double x, double y, int outline_size, Color text_color, Color shadow_color, String message) {
|
||||||
AttributedString as = new AttributedString(message);
|
AttributedString as = new AttributedString(message);
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package sig;
|
package sig.utils;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package sig;
|
package sig.utils;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
package sig;
|
package sig.utils;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.Rectangle2D;
|
||||||
|
|
||||||
|
import sig.sigIRC;
|
||||||
|
|
||||||
public class TextUtils {
|
public class TextUtils {
|
||||||
|
|
||||||
public static Rectangle2D calculateStringBoundsFont(String msg, Font font) {
|
public static Rectangle2D calculateStringBoundsFont(String msg, Font font) {
|
||||||
Loading…
x
Reference in New Issue
Block a user