diff --git a/landlords-client-javafx/README.md b/landlords-client-javafx/README.md
deleted file mode 100644
index f635f45..0000000
--- a/landlords-client-javafx/README.md
+++ /dev/null
@@ -1,59 +0,0 @@
-## 介绍
-本项目是一个使用 `javafx` + `netty` 技术构建的一个桌面应用,
-是对`ratel`应用命令行客户端的扩展,为`ratel`应用提供可视化界面操作方式。
-
-### 系统架构
-* 使用`netty`构建和**ratel**服务端的通讯
-* 使用`javafx`构建`GUI`界面
-
-## 快速启动
-### 依赖
-* `jdk`
-本项目是一个`java`应用,所以运行需要`java`环境,前往[oracle](https://www.oracle.com/java/technologies/java-downloads.html)下载最新版本jdk进行安装
-
-* `maven`
-本项目由maven构建,构建本应用需要先安装maven,前往[apache maven](https://maven.apache.org)下载最新版本maven进行安装
-
-### 安装
-```powershell
-git clone https://github.com/ainilili/ratel.git
-cd ratel
-mvn install package
-```
-#### 启动服务器
-```shell
-java -jar landlords-server/target/landlords-server-#{version}.jar -p 1024
-```
-
-#### 启动`javafx`客户端
-```shell
-java -jar landlords-client-javafx/target/landlords-client-javafx-#{version}.jar
-```
-
-## 使用
-1. 选择服务器地址连接
-
-2. 输入昵称
-
-3. 选择模式
-
-4. 选择房间
-
-5. 开始游戏
-
-
-## TODO List
-- [X] PVE模式
-- [ ] PVP模式
-- [ ] 优化界面
-- [ ] 页面切换
-- [ ] 挂机检测
-
-## 反馈
-如果你发现此客户端的bug或有任何疑问,欢迎提[issue](https://github.com/ainilili/ratel/issues),
-或者你也可以直接联系我([zhangxunweia@gmail.com](zhangxunweia@gmail.com))
-
-## 参考
-* [NaiveChat](https://github.com/fuzhengwei/NaiveChat)
-* [ratel部分协议](https://github.com/ainilili/ratel/blob/master/PROTOCO_CN.md)
-* [javafx和netty之间的通信](./javafx-netty-communication.md)
\ No newline at end of file
diff --git a/landlords-client-javafx/images/choose-room.png b/landlords-client-javafx/images/choose-room.png
deleted file mode 100644
index 3c40893..0000000
Binary files a/landlords-client-javafx/images/choose-room.png and /dev/null differ
diff --git a/landlords-client-javafx/images/connect.png b/landlords-client-javafx/images/connect.png
deleted file mode 100644
index 087e2cc..0000000
Binary files a/landlords-client-javafx/images/connect.png and /dev/null differ
diff --git a/landlords-client-javafx/images/input-nickname.png b/landlords-client-javafx/images/input-nickname.png
deleted file mode 100644
index 2818cfd..0000000
Binary files a/landlords-client-javafx/images/input-nickname.png and /dev/null differ
diff --git a/landlords-client-javafx/images/play.png b/landlords-client-javafx/images/play.png
deleted file mode 100644
index d58c6fc..0000000
Binary files a/landlords-client-javafx/images/play.png and /dev/null differ
diff --git a/landlords-client-javafx/images/select-modal.png b/landlords-client-javafx/images/select-modal.png
deleted file mode 100644
index 8bc9184..0000000
Binary files a/landlords-client-javafx/images/select-modal.png and /dev/null differ
diff --git a/landlords-client-javafx/images/ui-class-struct.png b/landlords-client-javafx/images/ui-class-struct.png
deleted file mode 100644
index 13f80a3..0000000
Binary files a/landlords-client-javafx/images/ui-class-struct.png and /dev/null differ
diff --git a/landlords-client-javafx/javafx-netty-communication.md b/landlords-client-javafx/javafx-netty-communication.md
deleted file mode 100644
index a206029..0000000
--- a/landlords-client-javafx/javafx-netty-communication.md
+++ /dev/null
@@ -1,178 +0,0 @@
-## 页面如何将用户信息传递给服务端
-### UI组件的介绍
-* `UIObject`:继承于`Stage`的一个抽象类,用于用户视图扩展
-* `Controller`:基础于`UIObject`,代表一个自定义视图
-* `Method`:定义视图上可以进行的操作
-* `EventRegister`:用于视图上元素的事件注册
-* `IEvent`:定义事件可以进行的操作
-
-### ui类结构
-
-1. `Controller`通过`EventRegister`进行页面元素的事件注册
-2. `EventRegister`将`IEvent`注册为页面元素上的事件回调函数
-3. `IEvent`的实现类`DemoEvent`可以操纵`channel`和`netty`服务端进行通信
-
-以上组件的简单流程图如下:
-```
-// 注册元素事件
-controller -> init -> EventRegister.registerEvent -> element.setOnAction
-
-// 元素事件响应
-elemnt -> onAction -> event -> channel -> netty server
-```
-
-### 示例
-场景:编写一个页面,点击页面上的退出按钮向`netty`服务端发送退出房间信号
-
-1. 编写一个`demo.fxml`视图文件
-```fxml
-
-
-
-
-
-```
-2. 编写一个`Controller`用于视图展示
-```java
-public class Controller extends UIObject implements Method {
- private IEvent event;
- private EventRegister demoEventRegister;
-
- public Controller(IEvent event) throws IOException {
- super();
-
- // 加载fxml视图文件
- root = FXMLLoader.load(getClass().getClassLoader().getResource("demo.fxml"));
- setScene(new Scene(root));
-
- this.roomEvent = roomEvent;
-
- // 注册元素事件
- registerEvent();
- }
-
- @Override
- public void registerEvent() {
- demoEventRegister = new DemoEventRegister(this, event);
- }
-}
-```
-3. 编写一个`Event`用于事件处理
-```java
-public interface Event {
- void quit();
-}
-
-public class DemoEvent implements Event {
- @Override
- public void quit() {
- // 获取channel,通过工具类向netty服务端发送退出房间信号
- Channel channel = BeanUtil.getBean("channel");
- ChannelUtil.pushToServer(channel, ServerEventCode.CODE_CLIENT_EXIT, null);
- }
-}
-```
-4. 编写一个`EventDefiner`用于页面元素事件注册
-```java
-public class DemoEventRegister implements EventRegister {
-
- private UIObject uiObject;
- private IEvent event;
-
- public DemoEventRegister(UIObject uiObject, IEvent event) {
- this.uiObject = uiObject;
- this.event = event;
-
- registerEvent();
- }
-
- @Override
- public void registerEvent() {
- quitRoom();
- }
-
- private void quitRoom() {
- // 为退出按钮设置点击事件回调函数
- uiObject.$("#quitButton", Button.clas).setOnAction(e -> event.quit());
- }
-}
-```
-
-## 服务端如何将信息传递给页面
-如果您还不清楚`netty`服务端和`netty`客户端之间的事件通信,请先阅读[ratel部分协议](https://github.com/ainilili/ratel/blob/master/PROTOCO_CN.md)。
-
-### 编写客户端事件监听器
-编写自己的事件监听器,设置感兴趣的服务端事件编码,当对应事件出现时,会执行事件监听器中的代码。实现`ClientListener`或者继承`AbstractClientListener`编写自己的客户端事件监听器:
-```java
-public class ClientExitListener extends AbstractClientListener {
-
- public ClientExitListener() {
- // 设置感兴趣的服务端事件编码(CODE_CLIENT_EXIT 客户端退出事件编码)
- super(ClientEventCode.CODE_CLIENT_EXIT);
- }
-
- /**
- * 事件处理业务
- * @param channel 客户端通信channel
- * @param json 事件数据
- */
- @Override
- public void handle(Channel channel, String json) {
- // do something ...
- }
-}
-```
-
-### 在客户端事件监听器中改变页面
-每一个客户端事件监听器中都有`uiService`属性,通过`uiService`可以获取各个`Method`对页面进行操作:
-```java
-@Override
-public void handler(Channel channel, String json) {
- Method method = uiService.getMethod(Controller.METHOD_NAME);
-
- // 一定要在javafx线程中进行视图的更改
- Platform.runLater(() -> method.updateView(json));
-}
-```
-
-### 示例
-场景:客户端退出后服务端向客户端发送退出成功事件响应,客户端接收事件后弹出弹框提示退出成功。
-1. 编写一个`Method`定义视图的弹出弹框行为
-```java
-public interface Method {
- void alert(String message);
-}
-
-public class Controller extends UIObject implements Method {
- private static final String METHOD_NAME = "method";
-
- @Override
- public void alert(String message) {
- Alert alert = new Alert(Alert.AlertType.INFORMATION);
- alert.setContentText(message);
- alert.showAndWait();
- }
-}
-```
-2. 编写一个客户端事件监听器
-```java
-public class ClientExitListener extends AbstractClientListener {
-
- public ClientExitListener() {
- // 设置感兴趣的服务端事件编码(CODE_CLIENT_EXIT 客户端退出事件编码)
- super(ClientEventCode.CODE_CLIENT_EXIT);
- }
-
- /**
- * 事件处理业务
- * @param channel 客户端通信channel
- * @param json 事件数据
- */
- @Override
- public void handle(Channel channel, String json) {
- Method method = uiService.getMethod(Controller.METHOD_NAME);
-
- Platform.runLater(() -> method.alert(json));
- }
-}
-```
\ No newline at end of file
diff --git a/landlords-client-javafx/pom.xml b/landlords-client-javafx/pom.xml
deleted file mode 100644
index 4428981..0000000
--- a/landlords-client-javafx/pom.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-
-
-
- landlords
- com.smallnico.ratel
- 1.2.2
-
- 4.0.0
-
- landlords-client-javafx
-
-
- priv.zxw.ratel.landlords.client.javafx.SimpleClient
-
-
-
-
- com.smallnico.ratel
- landlords-common
- 1.2.2
-
-
-
-
- ch.qos.logback
- logback-core
- 1.2.3
-
-
-
- ch.qos.logback
- logback-classic
- 1.2.3
-
-
-
-
- com.alibaba
- fastjson
- 1.2.56
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- ${start-class}
-
-
-
-
- repackage
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
- 1.8
- 1.8
-
- -parameters
-
- true
-
-
-
-
-
-
\ No newline at end of file
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/NettyClient.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/NettyClient.java
deleted file mode 100644
index d3bd9b6..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/NettyClient.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx;
-
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.Channel;
-import io.netty.channel.EventLoopGroup;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import org.nico.noson.util.string.StringUtils;
-import priv.zxw.ratel.landlords.client.javafx.listener.ClientListenerUtils;
-import priv.zxw.ratel.landlords.client.javafx.handler.DefaultChannelInitializer;
-import priv.zxw.ratel.landlords.client.javafx.ui.UIService;
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-
-import java.io.IOException;
-import java.util.concurrent.*;
-
-
-public class NettyClient {
- private String host;
- private int port;
-
- private ExecutorService executorService;
-
- private Channel channel;
- private EventLoopGroup workerGroup;
-
- private int id = -1;
- private String username;
-
- public NettyClient(UIService uiService) {
- executorService = Executors.newSingleThreadExecutor();
-
- ClientListenerUtils.setUIService(uiService);
- }
-
- public void start(String host, int port) throws Exception {
- if (StringUtils.isBlank(host)) {
- throw new IllegalArgumentException("不合法的host:" + host);
- }
-
- if (port < 0) {
- throw new IllegalArgumentException("不合法的端口:" + port);
- }
-
- this.host = host;
- this.port = port;
-
- try {
- // 直接启动netty会别javafx阻塞消息接受
- // 使用线程池启动则可以正常运行,why !!!!
- Future channelFuture = executorService.submit(new ClientThread());
- Channel channel = channelFuture.get();
-
- if (!channel.isActive()) {
- Exception gotoCatch = new Exception();
- throw gotoCatch;
- }
- } catch (Exception e) {
- // 清理资源
- if (channel != null) {
- channel.close().syncUninterruptibly();
- }
- workerGroup.shutdownGracefully().syncUninterruptibly();
-
- throw new IOException(String.format("连接netty服务端(%s:%d)失败", host, port), e);
- }
-
- BeanUtil.addBean("channel", channel);
- }
-
- private class ClientThread implements Callable {
-
- @Override
- public Channel call() throws Exception {
- workerGroup = new NioEventLoopGroup();
- Bootstrap bootstrap = new Bootstrap()
- .group(workerGroup)
- .channel(NioSocketChannel.class)
- .handler(new DefaultChannelInitializer());
- channel = bootstrap.connect(host, port).syncUninterruptibly().channel();
-
- return channel;
- }
- }
-
- public void destroy() {
- if (channel == null) {
- return;
- }
-
- channel.close().syncUninterruptibly();
- workerGroup.shutdownGracefully().syncUninterruptibly();
-
- executorService.shutdown();
- try {
- executorService.awaitTermination(10, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- }
- }
-
- public int getId() {
- return id;
- }
-
- public void setId(int id) {
- this.id = id;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/SimpleClient.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/SimpleClient.java
deleted file mode 100644
index cd1dfae..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/SimpleClient.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx;
-
-import com.alibaba.fastjson.JSONArray;
-import javafx.application.Application;
-import javafx.application.Platform;
-import javafx.stage.Stage;
-import org.nico.ratel.landlords.utils.StreamUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import priv.zxw.ratel.landlords.client.javafx.event.IndexEvent;
-import priv.zxw.ratel.landlords.client.javafx.event.LobbyEvent;
-import priv.zxw.ratel.landlords.client.javafx.event.LoginEvent;
-import priv.zxw.ratel.landlords.client.javafx.event.RoomEvent;
-import priv.zxw.ratel.landlords.client.javafx.ui.UIService;
-import priv.zxw.ratel.landlords.client.javafx.ui.view.index.IndexController;
-import priv.zxw.ratel.landlords.client.javafx.ui.view.index.IndexMethod;
-import priv.zxw.ratel.landlords.client.javafx.ui.view.lobby.LobbyController;
-import priv.zxw.ratel.landlords.client.javafx.ui.view.login.LoginController;
-import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController;
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.List;
-
-
-public class SimpleClient extends Application {
-
- private static final Logger LOGGER = LoggerFactory.getLogger(SimpleClient.class);
-
- @Override
- public void start(Stage primaryStage) throws Exception {
- UIService uiService = new UIService();
- IndexMethod indexMethod = new IndexController(new IndexEvent());
- uiService.addMethods(indexMethod, new LoginController(new LoginEvent()),
- new LobbyController(new LobbyEvent()), new RoomController(new RoomEvent()));
- uiService.getMethod(IndexController.METHOD_NAME).doShow();
-
- NettyClient nettyClient = new NettyClient(uiService);
- BeanUtil.addBean("nettyClient", nettyClient);
-
- try {
- List remoteServerAddressList = fetchRemoteServerAddresses();
- Platform.runLater(() -> indexMethod.generateRemoteServerAddressOptions(remoteServerAddressList));
- } catch (IOException e) {
- LOGGER.error("获取远程服务器列表失败", e);
- Platform.runLater(() -> indexMethod.setFetchRemoteServerAddressErrorTips());
- }
- }
-
- private List fetchRemoteServerAddresses() throws IOException {
- String serverInfo = StreamUtils.convertToString(
- new URL("https://raw.githubusercontent.com/ainilili/ratel/master/serverlist.json"));
- return JSONArray.parseArray(serverInfo, String.class);
- }
-
- public static void main(String[] args) {
- launch(args);
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/CurrentRoomInfo.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/CurrentRoomInfo.java
deleted file mode 100644
index 1d9b7d8..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/CurrentRoomInfo.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.entity;
-
-import org.nico.ratel.landlords.entity.Poker;
-import org.nico.ratel.landlords.enums.ClientType;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class CurrentRoomInfo {
- private int roomId;
- private String roomOwner;
-
- private User player;
- private String prevPlayerName;
- private ClientType prevPlayerRole;
- private int prevPlayerSurplusPokerCount;
- private String nextPlayerName;
- private ClientType nextPlayerRole;
- private int nextPlayerSurplusPokerCount;
-
- private String recentPlayerName;
- private List recentPokers;
-
- private List checkedPokers;
-
- public CurrentRoomInfo(int roomId, String roomOwner) {
- this.roomId = roomId;
- this.roomOwner = roomOwner;
- this.checkedPokers = new ArrayList<>();
- }
-
- public void setLandlord(String landlordName) {
- if (landlordName.equals(player.getNickname())) {
- player.setRole(ClientType.LANDLORD);
- prevPlayerRole = nextPlayerRole = ClientType.PEASANT;
- } else if (landlordName.equals(prevPlayerName)) {
- prevPlayerRole = ClientType.LANDLORD;
- nextPlayerRole = ClientType.PEASANT;
- player.setRole(ClientType.PEASANT);
- } else {
- nextPlayerRole = ClientType.LANDLORD;
- prevPlayerRole = ClientType.PEASANT;
- player.setRole(ClientType.PEASANT);
- }
- }
-
- public String getRecentPlayerName() {
- return recentPlayerName;
- }
-
- public void setRecentPlayerName(String recentPlayerName) {
- this.recentPlayerName = recentPlayerName;
- }
-
- public List getRecentPokers() {
- return recentPokers;
- }
-
- public void setRecentPokers(List recentPokers) {
- this.recentPokers = recentPokers;
- }
-
- public void setPlayer(User player) {
- this.player = player;
- }
-
- public User getPlayer() {
- return player;
- }
-
- public void setPrevPlayerName(String prevPlayerName) {
- this.prevPlayerName = prevPlayerName;
- }
-
- public void setNextPlayerName(String nextPlayerName) {
- this.nextPlayerName = nextPlayerName;
- }
-
- public String getPrevPlayerName() {
- return prevPlayerName;
- }
-
- public String getNextPlayerName() {
- return nextPlayerName;
- }
-
- public ClientType getPrevPlayerRole() {
- return prevPlayerRole;
- }
-
- public ClientType getNextPlayerRole() {
- return nextPlayerRole;
- }
-
- public void addCheckedPoker(Poker poker) {
- checkedPokers.add(poker);
- }
-
- public void removeUncheckedPoker(Poker poker) {
- checkedPokers.remove(poker);
- }
-
- public List pollCheckedPokers() {
- List pokers = new ArrayList<>(checkedPokers);
- checkedPokers.clear();
-
- return pokers;
- }
-
- public int getPrevPlayerSurplusPokerCount() {
- return prevPlayerSurplusPokerCount;
- }
-
- public void setPrevPlayerSurplusPokerCount(int prevPlayerSurplusPokerCount) {
- this.prevPlayerSurplusPokerCount = prevPlayerSurplusPokerCount;
- }
-
- public int getNextPlayerSurplusPokerCount() {
- return nextPlayerSurplusPokerCount;
- }
-
- public void setNextPlayerSurplusPokerCount(int nextPlayerSurplusPokerCount) {
- this.nextPlayerSurplusPokerCount = nextPlayerSurplusPokerCount;
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/RoomInfo.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/RoomInfo.java
deleted file mode 100644
index 104d019..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/RoomInfo.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.entity;
-
-
-public class RoomInfo {
- private Integer roomId;
- private String roomOwner;
- private Integer roomClientCount;
- private String roomType;
-
- public Integer getRoomId() {
- return roomId;
- }
-
- public void setRoomId(Integer roomId) {
- this.roomId = roomId;
- }
-
- public String getRoomOwner() {
- return roomOwner;
- }
-
- public void setRoomOwner(String roomOwner) {
- this.roomOwner = roomOwner;
- }
-
- public Integer getRoomClientCount() {
- return roomClientCount;
- }
-
- public void setRoomClientCount(Integer roomClientCount) {
- this.roomClientCount = roomClientCount;
- }
-
- public String getRoomType() {
- return roomType;
- }
-
- public void setRoomType(String roomType) {
- this.roomType = roomType;
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/User.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/User.java
deleted file mode 100644
index 8633c64..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/entity/User.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.entity;
-
-import org.nico.ratel.landlords.entity.Poker;
-import org.nico.ratel.landlords.enums.ClientType;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class User {
- private String nickname;
-
- private boolean playing = false;
- private int currentRoomId = -1;
- private List pokers;
-
- // null, ClientType.LANDLORD, ClientType.PEASANT
- private ClientType role;
-
- public User(String nickname) {
- this.nickname = nickname;
- }
-
- public void joinRoom(int roomId) {
- currentRoomId = roomId;
- playing = true;
- }
-
- public void exitRoom() {
- currentRoomId = -1;
- playing = false;
- role = null;
- pokers.clear();
- pokers = null;
- }
-
- public void addPokers(List pokers) {
- if (this.pokers != null) {
- this.pokers.addAll(pokers);
- } else {
- this.pokers = pokers;
- }
-
- this.pokers = this.pokers.stream()
- .sorted((a, b) -> Integer.compare(b.getLevel().getLevel(), a.getLevel().getLevel()))
- .collect(Collectors.toList());
- }
-
- public void removePokers(List sellPokerList) {
- for (Poker sellPoker : sellPokerList) {
- pokers.remove(sellPoker);
- }
- }
-
- public List getPokers() {
- return pokers;
- }
-
- public ClientType getRole() {
- return role;
- }
-
- public boolean isPlaying() {
- return playing;
- }
-
- public void setRole(ClientType role) {
- this.role = role;
- }
-
- public String getNickname() {
- return nickname;
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/IndexEvent.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/IndexEvent.java
deleted file mode 100644
index 477884b..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/IndexEvent.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.event;
-
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-import priv.zxw.ratel.landlords.client.javafx.NettyClient;
-import priv.zxw.ratel.landlords.client.javafx.ui.event.IIndexEvent;
-
-public class IndexEvent implements IIndexEvent {
-
- @Override
- public void connect(String host, int port) throws Exception {
- NettyClient nettyClient = BeanUtil.getBean("nettyClient");
-
- nettyClient.start(host, port);
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LobbyEvent.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LobbyEvent.java
deleted file mode 100644
index 2d4026b..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LobbyEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.event;
-
-
-import io.netty.channel.Channel;
-import org.nico.ratel.landlords.channel.ChannelUtils;
-import org.nico.ratel.landlords.enums.ClientEventCode;
-import org.nico.ratel.landlords.enums.ServerEventCode;
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-import priv.zxw.ratel.landlords.client.javafx.listener.ClientListener;
-import priv.zxw.ratel.landlords.client.javafx.listener.ClientListenerUtils;
-import priv.zxw.ratel.landlords.client.javafx.ui.event.ILobbyEvent;
-
-
-public class LobbyEvent implements ILobbyEvent {
-
- @Override
- public void selectPVPModal() {
- ClientListener listener = ClientListenerUtils.getListener(ClientEventCode.CODE_SHOW_OPTIONS_PVP);
-
- listener.handle(BeanUtil.getBean("channel"), ".");
- }
-
- @Override
- public void selectPVEModal() {
- ClientListener listener = ClientListenerUtils.getListener(ClientEventCode.CODE_SHOW_OPTIONS_PVE);
-
- listener.handle(BeanUtil.getBean("channel"), ".");
- }
-
- @Override
- public void createPVPRoom() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_ROOM_CREATE, null);
- }
-
- @Override
- public void createPVERoom(int modal) {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_ROOM_CREATE_PVE, String.valueOf(modal));
- }
-
- @Override
- public void showRooms() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GET_ROOMS, null);
- }
-
- @Override
- public void joinRoom(int roomId) {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_ROOM_JOIN, String.valueOf(roomId));
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LoginEvent.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LoginEvent.java
deleted file mode 100644
index 9bcc7d1..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/LoginEvent.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.event;
-
-
-import io.netty.channel.Channel;
-import org.nico.ratel.landlords.channel.ChannelUtils;
-import org.nico.ratel.landlords.enums.ServerEventCode;
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-import priv.zxw.ratel.landlords.client.javafx.NettyClient;
-import priv.zxw.ratel.landlords.client.javafx.entity.User;
-import priv.zxw.ratel.landlords.client.javafx.ui.event.ILoginEvent;
-
-public class LoginEvent implements ILoginEvent {
-
- @Override
- public void setNickname(String nickname) {
- NettyClient nettyClient = BeanUtil.getBean("nettyClient");
- nettyClient.setUsername(nickname);
-
- User user = new User(nickname);
- BeanUtil.addBean("user", user);
-
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_CLIENT_NICKNAME_SET, nickname);
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/RoomEvent.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/RoomEvent.java
deleted file mode 100644
index e7c3281..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/event/RoomEvent.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.event;
-
-
-import com.alibaba.fastjson.JSONObject;
-import io.netty.channel.Channel;
-import org.nico.ratel.landlords.channel.ChannelUtils;
-import org.nico.ratel.landlords.entity.Poker;
-import org.nico.ratel.landlords.enums.ServerEventCode;
-import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil;
-import priv.zxw.ratel.landlords.client.javafx.ui.event.IRoomEvent;
-
-import java.util.Comparator;
-import java.util.List;
-import java.util.stream.Collectors;
-
-public class RoomEvent implements IRoomEvent {
-
- @Override
- public void robLandlord() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GAME_LANDLORD_ELECT, "TRUE");
- }
-
- @Override
- public void notRobLandlord() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GAME_LANDLORD_ELECT, "FALSE");
- }
-
- @Override
- public void submitPokers(List pokerList) {
- Channel channel = BeanUtil.getBean("channel");
-
- String[] chars = pokerList.stream()
- .sorted(Comparator.comparingInt(poker -> poker.getLevel().getLevel()))
- .map(p -> {
- String name = p.getLevel().getName();
- // 10 实际出牌值为 0
- return name.length() > 1 ? name.substring(1, 2) : name;
- })
- .collect(Collectors.toList())
- .toArray(new String[] {});
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY, JSONObject.toJSONString(chars));
- }
-
- @Override
- public void passRound() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GAME_POKER_PLAY_PASS, null);
- }
-
- @Override
- public void exit() {
- Channel channel = BeanUtil.getBean("channel");
-
- ChannelUtils.pushToServer(channel, ServerEventCode.CODE_CLIENT_EXIT, null);
- }
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/DefaultChannelInitializer.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/DefaultChannelInitializer.java
deleted file mode 100644
index 9dd77e2..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/DefaultChannelInitializer.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.handler;
-
-import io.netty.channel.ChannelInitializer;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.handler.codec.protobuf.ProtobufDecoder;
-import io.netty.handler.codec.protobuf.ProtobufEncoder;
-import io.netty.handler.codec.protobuf.ProtobufVarint32FrameDecoder;
-import io.netty.handler.codec.protobuf.ProtobufVarint32LengthFieldPrepender;
-import io.netty.handler.timeout.IdleStateHandler;
-import org.nico.ratel.landlords.entity.ClientTransferData;
-
-import java.util.concurrent.TimeUnit;
-
-/**
- * @ClassName DefaultChannelInitializer
- * @Desc TODO
- * @Author zxw
- * @Date 2020/8/5 13:25
- * @Version 1.0
- */
-public class DefaultChannelInitializer extends ChannelInitializer {
-
- @Override
- protected void initChannel(SocketChannel ch) throws Exception {
- ch.pipeline()
- .addLast(new IdleStateHandler(0, 4, 0, TimeUnit.SECONDS))
- .addLast(new ProtobufVarint32FrameDecoder())
- .addLast(new ProtobufDecoder(ClientTransferData.ClientTransferDataProtoc.getDefaultInstance()))
- .addLast(new ProtobufVarint32LengthFieldPrepender())
- .addLast(new ProtobufEncoder())
- .addLast(new SecondProtobufCodec())
- .addLast(new TransferHandler());
- }
-
-}
diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/SecondProtobufCodec.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/SecondProtobufCodec.java
deleted file mode 100644
index 845efad..0000000
--- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/handler/SecondProtobufCodec.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package priv.zxw.ratel.landlords.client.javafx.handler;
-
-import com.google.protobuf.MessageLite;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.handler.codec.MessageToMessageCodec;
-import org.nico.ratel.landlords.entity.ClientTransferData;
-
-import java.util.List;
-
-/**
- * @ClassName SecondProtobufCodec
- * @Desc TODO
- * @Author zxw
- * @Date 2020/8/5 13:26
- * @Version 1.0
- */
-public class SecondProtobufCodec extends MessageToMessageCodec {
-
- @Override
- protected void encode(ChannelHandlerContext ctx, MessageLite msg, List