Skip to content

Commit

Permalink
Merge pull request #68 from anlingyi/release
Browse files Browse the repository at this point in the history
1.6.3-beta
  • Loading branch information
anlingyi authored Aug 20, 2022
2 parents ee84684 + 437ea26 commit 31ca438
Show file tree
Hide file tree
Showing 31 changed files with 2,275 additions and 38 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# XEChat-Idea

> Version 1.6.2-beta
> Version 1.6.3-beta
> 基于Netty的IDEA即时聊天插件:让你能够在IDEA里实现聊天、下棋、斗地主!(理论上支持JetBrains全系列开发工具🙂)
Expand Down Expand Up @@ -37,11 +37,14 @@
* 五子棋(支持2人联机、人机对战,内置"人工制杖")
* 斗地主(支持2~3人联机、人机对战)
* 不贪吃蛇
* 2048(作者 @[浓睡不消残酒](https://github.com/CodeNoobLH) ,感谢PR😊)
* 数独(作者 @[Speciallei](https://github.com/Specialleiliei) ,感谢PR😊)

**工具类**

* 阅读(作者 @[MINIPuffer](https://github.com/MINIPuffer) ,感谢PR😊)
* 天气查询(基于[和风天气](https://dev.qweather.com/),作者 @[猎隼丶止戈](https://github.com/nn200433) ,感谢PR😊)
* 浏览器

[了解更多...](https://xeblog.cn/?tag=xechat-idea)

Expand All @@ -51,6 +54,8 @@

![](https://oss.xeblog.cn/prod/40ddad661991451889acea177c7f5293.png)

![](https://oss.xeblog.cn/prod/3af16813518b4e4592ece13b0330be9b.png)

### 项目结构

```
Expand Down
5 changes: 5 additions & 0 deletions server_list.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"name": "野生鱼塘",
"ip": "1649991905.cn",
"port": 1024
},
{
"name": "有鱼溪",
"ip": "47.96.115.18",
"port": 1024
}
]
2 changes: 1 addition & 1 deletion xechat-commons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>cn.xeblog</groupId>
<artifactId>xechat-commons</artifactId>
<version>1.6.2-beta</version>
<version>1.6.3-beta</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
public enum Game {
GOBANG("五子棋", false),
LANDLORDS("斗地主", false),
NON_GLUTTONOUS_SNAKE("不贪吃蛇", false);
NON_GLUTTONOUS_SNAKE("不贪吃蛇", false),
GAME_2048("2048", false),
SUDOKU("数独", false);

/**
* 游戏名称
Expand Down
4 changes: 2 additions & 2 deletions xechat-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'cn.xeblog'
version '1.6.2-beta'
version '1.6.3-beta'

sourceCompatibility = 11
targetCompatibility = 11
Expand All @@ -20,7 +20,7 @@ repositories {
}

ext {
xechatCommonsVersion = '1.6.2-beta'
xechatCommonsVersion = '1.6.3-beta'
lombokVersion = '1.18.24'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ public void process(String[] args) {
username = name;
}
}
username = StrUtil.trim(username);

if (StringUtils.isBlank(username)) {
ConsoleAction.showSimpleMsg("用户名不能为空!");
return;
}

username = username.replaceAll("\\s*|\t|\r|\n", "");
if (username.length() > 12) {
ConsoleAction.showSimpleMsg("用户名长度不能超过12个字符!");
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cn.xeblog.plugin.factory;

import cn.hutool.core.thread.GlobalThreadPool;
import cn.xeblog.commons.util.ThreadUtils;
import cn.xeblog.plugin.action.InputAction;
import cn.xeblog.plugin.cache.DataCache;
import cn.xeblog.plugin.ui.MainWindow;
Expand Down Expand Up @@ -30,8 +31,8 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
@Override
public void ancestorAdded(AncestorEvent event) {
GlobalThreadPool.execute(() -> {
while (!InputAction.restCursor()) {
}
ThreadUtils.spinMoment(800);
InputAction.restCursor();
});
}
});
Expand Down
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);
}
}
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;
}

}
Loading

0 comments on commit 31ca438

Please sign in to comment.