-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from anlingyi/release
1.6.3-beta
- Loading branch information
Showing
31 changed files
with
2,275 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,5 +8,10 @@ | |
"name": "野生鱼塘", | ||
"ip": "1649991905.cn", | ||
"port": 1024 | ||
}, | ||
{ | ||
"name": "有鱼溪", | ||
"ip": "47.96.115.18", | ||
"port": 1024 | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
xechat-plugin/src/main/java/cn/xeblog/plugin/game/game2048/Block.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cn.xeblog.plugin.game.game2048; | ||
|
||
import java.awt.*; | ||
|
||
public class Block { | ||
int value; | ||
|
||
public Block() { | ||
this(0); | ||
} | ||
|
||
public Block(int num) { | ||
value = num; | ||
} | ||
|
||
public boolean isEmpty() { | ||
return value == 0; | ||
} | ||
|
||
public Color getForeground() { | ||
return value < 16 ? new Color(0x776e65) : new Color(0xf9f6f2); | ||
} | ||
|
||
public Color getBackground() { | ||
switch (value) { | ||
case 2: | ||
return new Color(0xeee4da); | ||
case 4: | ||
return new Color(0xF1E1CA); | ||
case 8: | ||
return new Color(0xF6B17A); | ||
case 16: | ||
return new Color(0xF99563); | ||
case 32: | ||
return new Color(0xFB7B5E); | ||
case 64: | ||
return new Color(0xFA5D3A); | ||
case 128: | ||
return new Color(0xF1D071); | ||
case 256: | ||
return new Color(0xF1CC61); | ||
case 512: | ||
return new Color(0xF1C94E); | ||
case 1024: | ||
return new Color(0xF1C73F); | ||
case 2048: | ||
return new Color(0xF2C32D); | ||
} | ||
return new Color(0xcdc1b4); | ||
} | ||
} |
69 changes: 69 additions & 0 deletions
69
xechat-plugin/src/main/java/cn/xeblog/plugin/game/game2048/Game2048.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package cn.xeblog.plugin.game.game2048; | ||
|
||
import cn.xeblog.commons.enums.Game; | ||
import cn.xeblog.plugin.annotation.DoGame; | ||
import cn.xeblog.plugin.game.AbstractGame; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
|
||
/** | ||
* @author 浓睡不消残酒 | ||
* @date 2022/8/11 15:11 PM | ||
*/ | ||
@DoGame(Game.GAME_2048) | ||
public class Game2048 extends AbstractGame { | ||
|
||
@Override | ||
protected void init() { | ||
initMainPanel(); | ||
mainPanel.setMinimumSize(new Dimension(150, 200)); | ||
JPanel startPanel = new JPanel(); | ||
startPanel.setBounds(10, 10, 120, 200); | ||
mainPanel.add(startPanel); | ||
|
||
JLabel title = new JLabel("2048小游戏"); | ||
title.setFont(new Font("", 1, 14)); | ||
startPanel.add(title); | ||
|
||
Box vBox = Box.createVerticalBox(); | ||
startPanel.add(vBox); | ||
vBox.add(Box.createVerticalStrut(5)); | ||
vBox.add(getStartGameButton()); | ||
vBox.add(getExitButton()); | ||
mainPanel.updateUI(); | ||
} | ||
|
||
@Override | ||
protected void start() { | ||
initMainPanel(); | ||
int width = 240; | ||
int height = 300; | ||
mainPanel.setMinimumSize(new Dimension(width + 10, height + 10)); | ||
mainPanel.setLayout(new BorderLayout()); | ||
mainPanel.add(Box.createVerticalStrut(10), BorderLayout.NORTH); | ||
GameUI gameUI = new GameUI(); | ||
mainPanel.add(gameUI, BorderLayout.CENTER); | ||
|
||
JPanel buttonPanel = new JPanel(); | ||
buttonPanel.add(getBackGameButton()); | ||
buttonPanel.add(getExitButton()); | ||
mainPanel.add(buttonPanel, BorderLayout.SOUTH); | ||
mainPanel.updateUI(); | ||
|
||
gameUI.requestFocusInWindow(); | ||
} | ||
|
||
private JButton getStartGameButton() { | ||
JButton button = new JButton("开始游戏"); | ||
button.addActionListener(e -> start()); | ||
return button; | ||
} | ||
|
||
private JButton getBackGameButton() { | ||
JButton button = new JButton("返回游戏"); | ||
button.addActionListener(e -> init()); | ||
return button; | ||
} | ||
|
||
} |
Oops, something went wrong.