mirror of
https://github.com/correl/mage.git
synced 2024-11-15 03:00:16 +00:00
Added new christmas logo (auto-enabled from december 15 to january 15)
This commit is contained in:
parent
018439ad43
commit
a80030e8aa
2 changed files with 28 additions and 4 deletions
|
@ -429,17 +429,41 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
|
|||
}
|
||||
}
|
||||
|
||||
private boolean isChrismasTime(){
|
||||
// from december 15 to january 15
|
||||
Calendar cal = Calendar.getInstance();
|
||||
int currentYear = cal.get(Calendar.YEAR);
|
||||
Date currentTime = cal.getTime();
|
||||
|
||||
Date chrisFrom = new GregorianCalendar(currentYear, Calendar.DECEMBER, 15).getTime();
|
||||
Date chrisTo = new GregorianCalendar(currentYear + 1, Calendar.JANUARY, 15 + 1).getTime();
|
||||
|
||||
return currentTime.after(chrisFrom) && currentTime.before(chrisTo);
|
||||
}
|
||||
|
||||
private void addMageLabel() {
|
||||
if (liteMode || grayMode) {
|
||||
return;
|
||||
}
|
||||
String filename = "/label-xmage.png";
|
||||
|
||||
String filename;
|
||||
float ratio;
|
||||
if (isChrismasTime()){
|
||||
// chrismass logo
|
||||
LOGGER.info("Yo Ho Ho, Merry Christmas and a Happy New Year");
|
||||
filename = "/label-xmage-christmas.png";
|
||||
ratio = 539.0f / 318.0f;
|
||||
}else{
|
||||
// standard logo
|
||||
filename = "/label-xmage.png";
|
||||
ratio = 509.0f / 288.0f;
|
||||
}
|
||||
|
||||
try {
|
||||
InputStream is = this.getClass().getResourceAsStream(filename);
|
||||
|
||||
float ratio = 1179.0f / 678.0f;
|
||||
titleRectangle = new Rectangle(540, (int) (640 / ratio));
|
||||
if (is != null) {
|
||||
titleRectangle = new Rectangle(540, (int) (640 / ratio));
|
||||
|
||||
BufferedImage image = ImageIO.read(is);
|
||||
//ImageIcon resized = new ImageIcon(image.getScaledInstance(titleRectangle.width, titleRectangle.height, java.awt.Image.SCALE_SMOOTH));
|
||||
title = new JLabel();
|
||||
|
|
BIN
Mage.Client/src/main/resources/label-xmage-christmas.png
Normal file
BIN
Mage.Client/src/main/resources/label-xmage-christmas.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 141 KiB |
Loading…
Reference in a new issue