Skip to content

Commit

Permalink
Merge pull request #84 from anlingyi/release
Browse files Browse the repository at this point in the history
1.6.4-beta
  • Loading branch information
anlingyi authored Sep 13, 2022
2 parents bb121a1 + c5ea8bb commit 7139198
Show file tree
Hide file tree
Showing 61 changed files with 3,512 additions and 62 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# XEChat-Idea

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

**工具类**

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

[了解更多...](https://xeblog.cn/?tag=xechat-idea)
Expand All @@ -56,6 +58,12 @@

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

![](https://oss.xeblog.cn/prod/154404fccbdd466591df2fbeabdfeb74.png)

![](https://oss.xeblog.cn/prod/8e5bc4004afd48cf9fed4df18a66d070.png)

![](https://oss.xeblog.cn/prod/76dee7f5bb924dd59a5ffaaf333fc45c.png)

### 项目结构

```
Expand Down
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.3-beta</version>
<version>1.6.4-beta</version>
<build>
<plugins>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package cn.xeblog.commons.entity.game.chess;

import cn.xeblog.commons.entity.game.GameDTO;
import lombok.*;

/**
* @author anlingyi
* @date 2020/6/5
*/
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ChessDTO extends GameDTO {

private int x;
private int y;

/** 对战方式:1-红棋 2-黑棋 */
private int type;

/** 棋子索引 */
private int index;

/** 选项 */
Option option = Option.DEFAULT;

/** 当前界面 用途:后期可设置我方和对方不同界面 */
public UI currentUI = UI.CLASSIC;

public enum Option {
SURRENDER, UNDO, GAME_OVER, CHECK, DEFAULT
}

@Getter
@AllArgsConstructor
public enum UI {
CLASSIC("经典模式", 1)
// , FISH("摸鱼模式", 0)

;

private String name;

private int value;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ public enum Game {
LANDLORDS("斗地主", false),
NON_GLUTTONOUS_SNAKE("不贪吃蛇", false),
GAME_2048("2048", false),
SUDOKU("数独", false);
SUDOKU("数独", false),
PUSH_BOX("推箱子", false),
CHINESE_CHESS("中国象棋", 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.3-beta'
version '1.6.4-beta'

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

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public void process(String[] args) {
return;
}

if (GameAction.playing()) {
if (!GameAction.isOfflineGame() && GameAction.playing()) {
// 结束游戏
Command.OVER.exec(args);
}
Expand Down
146 changes: 146 additions & 0 deletions xechat-plugin/src/main/java/cn/xeblog/plugin/game/box/PushBox.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
package cn.xeblog.plugin.game.box;

import cn.hutool.core.util.StrUtil;
import cn.xeblog.commons.enums.Game;
import cn.xeblog.plugin.annotation.DoGame;
import cn.xeblog.plugin.game.AbstractGame;
import cn.xeblog.plugin.game.box.util.ImagesUtils;
import cn.xeblog.plugin.game.box.util.MapsUtils;
import com.intellij.openapi.ui.ComboBox;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

/**
* 功能描述: 数独主方法 D:\代码工程\project\test
*
* @author ☆程序员鼓励师☆
* @date 2022年8月20日01:02:27
*/
@DoGame(Game.PUSH_BOX)
public class PushBox extends AbstractGame {

private int level;
private boolean init;
private PushBoxUI pushBoxUI;

@Override
protected void start() {
initMainPanel();
mainPanel.setLayout(new BorderLayout());
mainPanel.add(Box.createVerticalStrut(10), BorderLayout.NORTH);
mainPanel.add(Box.createHorizontalStrut(10), BorderLayout.EAST);

if (!init && pushBoxUI != null) {
level = pushBoxUI.getLevel();
}
pushBoxUI = new PushBoxUI(level);
mainPanel.add(pushBoxUI, BorderLayout.CENTER);
mainPanel.add(getBottomPanel(), BorderLayout.SOUTH);

mainPanel.setMinimumSize(new Dimension(pushBoxUI.getTheWidth() + 40, pushBoxUI.getTheHeight() + 50));
mainPanel.updateUI();

pushBoxUI.requestFocusInWindow();
init = false;
}

@Override
protected void init() {
// 初始化图片
ImagesUtils.initMapDataDefault();
// 初始化地图
MapsUtils.initMapDataDefault();
// 是否初始化
init = true;
level = 1;

initMainPanel();

mainPanel.setMinimumSize(new Dimension(150, 300));
JPanel menuJPanel = new JPanel();
menuJPanel.setBounds(10, 10, 100, 330);
mainPanel.add(menuJPanel);

JLabel title = new JLabel("推箱子");
title.setFont(new Font("", Font.BOLD, 14));
menuJPanel.add(title);

Box vBox = Box.createVerticalBox();
menuJPanel.add(vBox);

Dimension selectDimension = new Dimension(30, 30);

vBox.add(Box.createVerticalStrut(20));
JLabel levelLabel = new JLabel("关卡选择:");
levelLabel.setFont(new Font("", Font.BOLD, 13));
vBox.add(levelLabel);
vBox.add(Box.createVerticalStrut(5));

ComboBox<String> gameLevelBox = getComboBox(selectDimension);
gameLevelBox.addActionListener(l -> level = gameLevelBox.getSelectedIndex() + 1);
vBox.add(gameLevelBox);

vBox.add(Box.createVerticalStrut(10));
vBox.add(getStartJButton("开始游戏"));
vBox.add(getTipsButton());
vBox.add(getExitButton());

mainPanel.updateUI();
}

// 创建按钮面板
private JPanel getBottomPanel() {
JPanel jPanel = new JPanel();
jPanel.add(getStartJButton("重置本关"));
jPanel.add(getMenuJButton());
return jPanel;
}

public JButton getMenuJButton() {
JButton menu = new JButton("主菜单");
menu.addActionListener(e -> init());
return menu;
}

public JButton getTipsButton() {
JButton tips = new JButton("按键提示");
tips.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
String message = "↑ ↓ ← → 方向键控制人物移动方向<br>";
switch (e.getButton()) {
case 1:
message += "DELETE:撤销/上一步<br>祝你玩得愉快!";
break;
case 2:
message += "DELETE:撤销/上一步<br>隐藏技能都被你发现了!真棒!<br>PAGE UP:上一关<br>PAGE DOWN:下一关<br>";
break;
default:
break;
}
message = StrUtil.format("<html><body>{}<body></html>", message);
JOptionPane.showMessageDialog(null, message, "按键提示", JOptionPane.INFORMATION_MESSAGE);
}
});

return tips;
}

public JButton getStartJButton(String title) {
JButton another = new JButton(title);
another.addActionListener(e -> start());
return another;
}

public ComboBox<String> getComboBox(Dimension dimension) {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setPreferredSize(dimension);
for (int i = 1; i <= MapsUtils.getTotal(); i++) {
comboBox.addItem(StrUtil.format("第{}关", i));
}
comboBox.setSelectedItem(StrUtil.format("第{}关", level));
return comboBox;
}
}
Loading

0 comments on commit 7139198

Please sign in to comment.