From d113ce97cc2d5d93b34eb52a169bdcaede45a520 Mon Sep 17 00:00:00 2001 From: zxw Date: Wed, 12 Aug 2020 21:45:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=A7=E5=8E=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=EF=BC=9B=E6=B7=BB=E5=8A=A0READEME=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- landlords-client-javafx/README_CN.md | 57 +++++++++++ .../landlords/client/javafx/NettyClient.java | 1 + .../landlords/client/javafx/SimpleClient.java | 8 +- .../client/javafx/event/IndexEvent.java | 2 +- .../client/javafx/event/LobbyEvent.java | 2 +- .../client/javafx/event/LoginEvent.java | 2 +- .../client/javafx/event/RoomEvent.java | 2 +- .../ClientConfirmLandlordListener.java | 2 +- .../listener/ClientConnectListener.java | 2 +- .../javafx/listener/ClientKickListener.java | 2 +- .../javafx/listener/ClientPassListener.java | 4 +- .../listener/ClientPokerPlayListener.java | 8 +- .../ClientPokerPlayRedirectListener.java | 17 +++- .../ClientSelectLandlordListener.java | 2 +- .../ClientShowOptionsPVEListener.java | 8 +- .../ClientShowOptionsPVPListener.java | 11 +-- .../listener/ClientShowPokersListener.java | 5 +- .../listener/ClientStartGameListener.java | 2 +- .../client/javafx/ui/view/UIObject.java | 2 +- .../ui/view/index/IndexEventRegister.java | 2 - .../ui/view/index/ServerAddressLabel.java | 2 - .../javafx/ui/view/lobby/LobbyController.java | 15 +-- .../ui/view/lobby/LobbyEventRegister.java | 9 +- .../client/javafx/ui/view/lobby/RoomPane.java | 74 +++++++------- .../client/javafx/ui/view/room/PokerPane.java | 2 +- .../javafx/ui/view/room/RoomController.java | 2 +- .../ui/view/room/RoomEventRegister.java | 5 +- .../javafx/ui/view/util/AlertUtils.java | 29 ++++++ .../javafx/ui/view/util/CountDownTask.java | 93 ++++++++++++++++++ .../client/javafx/util/BeanUtil.java | 17 ++++ .../main/resources/view/assets/css/lobby.css | 57 +++++++++++ .../main/resources/view/assets/css/room.css | 2 - .../resources/view/assets/image/add_0.png | Bin 0 -> 1533 bytes .../resources/view/assets/image/add_1.png | Bin 0 -> 1535 bytes .../resources/view/assets/image/face_0.png | Bin 0 -> 2235 bytes .../src/main/resources/view/lobby.fxml | 24 +++-- 36 files changed, 353 insertions(+), 119 deletions(-) create mode 100644 landlords-client-javafx/README_CN.md create mode 100644 landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/AlertUtils.java create mode 100644 landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/CountDownTask.java create mode 100644 landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/util/BeanUtil.java create mode 100644 landlords-client-javafx/src/main/resources/view/assets/css/lobby.css create mode 100644 landlords-client-javafx/src/main/resources/view/assets/image/add_0.png create mode 100644 landlords-client-javafx/src/main/resources/view/assets/image/add_1.png create mode 100644 landlords-client-javafx/src/main/resources/view/assets/image/face_0.png diff --git a/landlords-client-javafx/README_CN.md b/landlords-client-javafx/README_CN.md new file mode 100644 index 0000000..c8fcb1c --- /dev/null +++ b/landlords-client-javafx/README_CN.md @@ -0,0 +1,57 @@ +## 介绍 +本项目是一个使用 `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] PVP模式 +-[] 优化界面 +-[] PVE模式 +-[] 页面切换 +-[] 挂机检测 + +## 反馈与贡献 + - 如果您想贡献代码,非常欢迎提``PR``,我们将会合并优秀的代码. + - 如果您发现了``Bug``或想提问,非常欢迎提[issue](https://github.com/marmot-z/ratel/issues)给我们. + +## 联系方式 +* [zhangxunweia@gmail.com](zhangxunweia@gmail.com) +* [15870664270@163.com](15870664270@163.com) + +## 参考 +* [NaiveChat](https://github.com/fuzhengwei/NaiveChat) +* [ratel部分协议](https://github.com/ainilili/ratel/blob/master/PROTOCO_CN.md) \ 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 index d8f8c13..d3bd9b6 100644 --- 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 @@ -9,6 +9,7 @@ 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.*; 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 index bb25593..cd1dfae 100644 --- 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 @@ -1,12 +1,9 @@ package priv.zxw.ratel.landlords.client.javafx; import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; import javafx.application.Application; import javafx.application.Platform; import javafx.stage.Stage; -import org.nico.noson.Noson; -import org.nico.noson.entity.NoType; import org.nico.ratel.landlords.utils.StreamUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,14 +17,11 @@ 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.MalformedURLException; import java.net.URL; -import java.util.Arrays; import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; public class SimpleClient extends Application { 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 index 6288c3e..477884b 100644 --- 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 @@ -1,6 +1,6 @@ package priv.zxw.ratel.landlords.client.javafx.event; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +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; 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 index 392eed2..cbf3834 100644 --- 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 @@ -5,7 +5,7 @@ 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.BeanUtil; +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; 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 index 248383a..9bcc7d1 100644 --- 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 @@ -4,7 +4,7 @@ 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.BeanUtil; +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; 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 index 75fe514..c0ea70c 100644 --- 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 @@ -6,7 +6,7 @@ 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.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.ui.event.IRoomEvent; import java.util.Comparator; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConfirmLandlordListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConfirmLandlordListener.java index da8e496..b90cad9 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConfirmLandlordListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConfirmLandlordListener.java @@ -7,7 +7,7 @@ import org.nico.ratel.landlords.channel.ChannelUtils; import org.nico.ratel.landlords.entity.Poker; import org.nico.ratel.landlords.enums.ClientEventCode; import org.nico.ratel.landlords.enums.ServerEventCode; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; import priv.zxw.ratel.landlords.client.javafx.entity.User; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConnectListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConnectListener.java index acf61c6..f1db49b 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConnectListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientConnectListener.java @@ -4,7 +4,7 @@ import io.netty.channel.Channel; import org.nico.ratel.landlords.enums.ClientEventCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.NettyClient; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientKickListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientKickListener.java index c1220a8..670df67 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientKickListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientKickListener.java @@ -3,7 +3,7 @@ package priv.zxw.ratel.landlords.client.javafx.listener; import io.netty.channel.Channel; import javafx.application.Platform; import org.nico.ratel.landlords.enums.ClientEventCode; -import priv.zxw.ratel.landlords.client.javafx.ui.view.AlertUtils; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.AlertUtils; import priv.zxw.ratel.landlords.client.javafx.ui.view.Method; import priv.zxw.ratel.landlords.client.javafx.ui.view.lobby.LobbyController; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPassListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPassListener.java index 139fa2a..ae5a06e 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPassListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPassListener.java @@ -8,10 +8,10 @@ import javafx.scene.control.Label; 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.BeanUtil; +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.CurrentRoomInfo; -import priv.zxw.ratel.landlords.client.javafx.ui.view.CountDownTask; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.CountDownTask; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomMethod; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayListener.java index 7b80ccd..920d64e 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayListener.java @@ -4,9 +4,9 @@ import io.netty.channel.Channel; import javafx.application.Platform; import javafx.scene.control.Label; import org.nico.ratel.landlords.enums.ClientEventCode; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.User; -import priv.zxw.ratel.landlords.client.javafx.ui.view.CountDownTask; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.CountDownTask; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomMethod; @@ -33,11 +33,7 @@ public class ClientPokerPlayListener extends AbstractClientListener { if (future == null || future.isDone()) { CountDownTask task = new CountDownTask(timer, 30, node -> { - // 由于服务器查找挂机客户端响应太慢,此处直接模拟服务器发送 CODE_CLIENT_KICK 事件将玩家请出房间, - // 然后由客户端模拟机器人代替用户进行出牌,从而规避长时间的无响应对游戏的影响。 - // 暨此处不使用服务器的机器人功能,而由客户端自己实现机器人功能来解决玩家挂机的问题。 Platform.runLater(() -> roomMethod.hidePokerPlayButtons()); - ClientListenerUtils.getListener(ClientEventCode.CODE_CLIENT_KICK).handle(channel, null); }, surplusTime -> Platform.runLater(() -> timer.setText(surplusTime.toString()))); BeanUtil.addBean(user.getNickname(), task.start()); diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayRedirectListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayRedirectListener.java index feab2c7..f227c3c 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayRedirectListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientPokerPlayRedirectListener.java @@ -2,10 +2,15 @@ package priv.zxw.ratel.landlords.client.javafx.listener; import com.alibaba.fastjson.JSONObject; import io.netty.channel.Channel; +import javafx.application.Platform; +import javafx.scene.control.Label; import org.nico.ratel.landlords.enums.ClientEventCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.CountDownTask; +import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; +import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomMethod; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.NettyClient; public class ClientPokerPlayRedirectListener extends AbstractClientListener { @@ -21,11 +26,19 @@ public class ClientPokerPlayRedirectListener extends AbstractClientListener { NettyClient nettyClient = BeanUtil.getBean("nettyClient"); int sellClientId = jsonObject.getIntValue("sellClientId"); + String sellClientNickname = jsonObject.getString("sellClinetNickname"); + // 通知下一个玩家出牌 if (sellClientId == nettyClient.getId()) { ClientListenerUtils.getListener(ClientEventCode.CODE_GAME_POKER_PLAY).handle(channel, json); } + // 为下一个出牌的玩家设置倒计时定时器 + else { + RoomMethod method = (RoomMethod) uiService.getMethod(RoomController.METHOD_NAME); - LOGGER.info("下一个出牌玩家为 {} ", jsonObject.getString("sellClinetNickname")); + Label timer = (Label) method.getTimer(sellClientNickname); + CountDownTask task = new CountDownTask(timer, 30, n -> {}, i -> Platform.runLater(() -> timer.setText(i.toString()))); + BeanUtil.addBean(sellClientNickname, task.start()); + } } } diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientSelectLandlordListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientSelectLandlordListener.java index 396a495..e6811c7 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientSelectLandlordListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientSelectLandlordListener.java @@ -6,7 +6,7 @@ import javafx.application.Platform; import org.nico.ratel.landlords.enums.ClientEventCode; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +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.view.room.RoomController; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomMethod; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVEListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVEListener.java index 9b014c3..5ad9b3c 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVEListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVEListener.java @@ -3,13 +3,7 @@ package priv.zxw.ratel.landlords.client.javafx.listener; import io.netty.channel.Channel; import org.nico.ratel.landlords.enums.ClientEventCode; -/** - * @ClassName ClientShowOptionsPVEListener - * @Desc TODO - * @Author zxw - * @Date 2020/8/7 10:14 - * @Version 1.0 - */ + public class ClientShowOptionsPVEListener extends AbstractClientListener { public ClientShowOptionsPVEListener() { diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVPListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVPListener.java index 8e57928..6f03af4 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVPListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowOptionsPVPListener.java @@ -2,17 +2,13 @@ package priv.zxw.ratel.landlords.client.javafx.listener; import io.netty.channel.Channel; import javafx.application.Platform; +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.ui.view.lobby.LobbyController; import priv.zxw.ratel.landlords.client.javafx.ui.view.lobby.LobbyMethod; -/** - * @ClassName ClientShowOptionsPVPListener - * @Desc TODO - * @Author zxw - * @Date 2020/8/7 10:13 - * @Version 1.0 - */ + public class ClientShowOptionsPVPListener extends AbstractClientListener { public ClientShowOptionsPVPListener() { @@ -24,5 +20,6 @@ public class ClientShowOptionsPVPListener extends AbstractClientListener { LobbyMethod lobbyMethod = (LobbyMethod) uiService.getMethod(LobbyController.METHOD_NAME); Platform.runLater(lobbyMethod::toggleToPVPMenu); + ChannelUtils.pushToServer(channel, ServerEventCode.CODE_GET_ROOMS, null); } } diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowPokersListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowPokersListener.java index 1c2e86e..896dbb8 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowPokersListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientShowPokersListener.java @@ -3,14 +3,13 @@ package priv.zxw.ratel.landlords.client.javafx.listener; import com.alibaba.fastjson.JSONObject; import io.netty.channel.Channel; import javafx.application.Platform; -import javafx.scene.Node; import javafx.scene.control.Label; import org.nico.ratel.landlords.entity.Poker; import org.nico.ratel.landlords.enums.ClientEventCode; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; import priv.zxw.ratel.landlords.client.javafx.entity.User; -import priv.zxw.ratel.landlords.client.javafx.ui.view.CountDownTask; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.CountDownTask; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomController; import priv.zxw.ratel.landlords.client.javafx.ui.view.room.RoomMethod; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientStartGameListener.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientStartGameListener.java index 0769973..30feaa8 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientStartGameListener.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/listener/ClientStartGameListener.java @@ -6,7 +6,7 @@ import javafx.application.Platform; import org.nico.ratel.landlords.entity.ClientSide; import org.nico.ratel.landlords.entity.Poker; import org.nico.ratel.landlords.enums.ClientEventCode; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; import priv.zxw.ratel.landlords.client.javafx.entity.User; import priv.zxw.ratel.landlords.client.javafx.ui.view.Method; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/UIObject.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/UIObject.java index b0c1444..df3dec1 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/UIObject.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/UIObject.java @@ -7,7 +7,7 @@ import javafx.scene.Node; import javafx.scene.Parent; import javafx.stage.Stage; import javafx.util.Duration; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.NettyClient; import java.util.concurrent.ExecutorService; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/IndexEventRegister.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/IndexEventRegister.java index a0bcbc7..5dbd111 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/IndexEventRegister.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/IndexEventRegister.java @@ -10,8 +10,6 @@ import priv.zxw.ratel.landlords.client.javafx.ui.event.IIndexEvent; import priv.zxw.ratel.landlords.client.javafx.ui.view.EventRegister; import priv.zxw.ratel.landlords.client.javafx.ui.view.UIObject; -import java.io.IOException; - public class IndexEventRegister implements EventRegister { private static final Logger LOGGER = LoggerFactory.getLogger(IndexEventRegister.class); diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/ServerAddressLabel.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/ServerAddressLabel.java index 77cff22..ebcce4d 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/ServerAddressLabel.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/index/ServerAddressLabel.java @@ -11,8 +11,6 @@ public class ServerAddressLabel { label.setText(serverAddress); label.setLayoutY(index * 30); label.getStyleClass().add("remoteServerOption"); - - } public Label getLabel() { diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyController.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyController.java index 9145522..242381c 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyController.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyController.java @@ -8,7 +8,7 @@ import javafx.scene.Scene; import javafx.scene.layout.Pane; import priv.zxw.ratel.landlords.client.javafx.entity.RoomInfo; import priv.zxw.ratel.landlords.client.javafx.ui.event.ILobbyEvent; -import priv.zxw.ratel.landlords.client.javafx.ui.view.AlertUtils; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.AlertUtils; import priv.zxw.ratel.landlords.client.javafx.ui.view.UIObject; import java.io.IOException; @@ -52,14 +52,15 @@ public class LobbyController extends UIObject implements LobbyMethod { @Override public void showRoomList(List roomInfoList) { - Pane buttonsPane = $("buttonsPane", Pane.class); - buttonsPane.setVisible(false); - Pane roomsPane = $("roomsPane", Pane.class); - roomsPane.setVisible(true); - ObservableList children = roomsPane.getChildren(); - roomInfoList.forEach(roomInfo -> children.add(new RoomPane(roomInfo, lobbyEvent).getPane())); + for (int i = 0, size = roomInfoList.size(); i < size; i++) { + RoomInfo roomInfo = roomInfoList.get(i); + Pane roomPane = new RoomPane(roomInfo, i).getPane(); + roomPane.setOnMouseClicked(e -> lobbyEvent.joinRoom(roomInfo.getRoomId())); + + roomsPane.getChildren().add(roomPane); + } } @Override diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyEventRegister.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyEventRegister.java index 9735f82..0f7b1b0 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyEventRegister.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/LobbyEventRegister.java @@ -23,22 +23,17 @@ public class LobbyEventRegister implements EventRegister { selectPVPModal(); selectPVEModal(); createPVPRoom(); - showRooms(); } private void selectPVPModal() { - uiObject.$("pvpButton", Button.class).setOnAction(e -> lobbyEvent.selectPVPModal()); + uiObject.$("pvpModalButton", Button.class).setOnAction(e -> lobbyEvent.selectPVPModal()); } private void selectPVEModal() { - uiObject.$("pveButton", Button.class).setOnAction(e -> lobbyEvent.selectPVEModal()); + uiObject.$("pveModalButton", Button.class).setOnAction(e -> lobbyEvent.selectPVEModal()); } private void createPVPRoom() { uiObject.$("createRoomButton", Button.class).setOnAction(e -> lobbyEvent.createPVPRoom()); } - - private void showRooms() { - uiObject.$("listRoomsButton", Button.class).setOnAction(e -> lobbyEvent.showRooms()); - } } diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/RoomPane.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/RoomPane.java index 735db05..bb7fd25 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/RoomPane.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/lobby/RoomPane.java @@ -2,57 +2,57 @@ package priv.zxw.ratel.landlords.client.javafx.ui.view.lobby; import javafx.collections.ObservableList; -import javafx.scene.Cursor; import javafx.scene.Node; import javafx.scene.control.Label; import javafx.scene.layout.Pane; import priv.zxw.ratel.landlords.client.javafx.entity.RoomInfo; -import priv.zxw.ratel.landlords.client.javafx.ui.event.ILobbyEvent; public class RoomPane { + private static final int MARGIN_TOP = 25; + private static final int MARGIN_LEFT = 40; + private Pane pane; - private Label idLabel; - private Label roomOwnerLabel; - private Label modalLabel; - private Label clientCountLabel; - - public RoomPane(RoomInfo roomInfo, ILobbyEvent lobbyEvent) { + public RoomPane(RoomInfo roomInfo, int index) { pane = new Pane(); - pane.setId("roomPane" + roomInfo.getRoomId()); - pane.setPrefSize(200, 150); - pane.setStyle("-fx-border-color: black"); - pane.setCursor(Cursor.HAND); - pane.setOnMouseClicked(e -> lobbyEvent.joinRoom(roomInfo.getRoomId())); - ObservableList children = pane.getChildren(); + pane.getStyleClass().add("roomPane"); + pane.setLayoutX(35 + (index % 3) * (150 + MARGIN_LEFT)); + pane.setLayoutY(65 + ((index / 3) * (120 + MARGIN_TOP))); - // 房间id label - idLabel = new Label(); - idLabel.setLayoutX(14); - idLabel.setLayoutY(14); + Label idLabel = new Label(); + idLabel.setLayoutX(6); + idLabel.setLayoutY(3); + idLabel.getStyleClass().add("idLabel"); idLabel.setText(roomInfo.getRoomId().toString()); + + Label roomOwnerLabel = new Label(); + roomOwnerLabel.setLayoutX(0); + roomOwnerLabel.setLayoutY(22); + roomOwnerLabel.getStyleClass().add("roomOwnerLabel"); + + Label roomOwnerNameLabel = new Label(); + roomOwnerNameLabel.setLayoutX(34); + roomOwnerNameLabel.setLayoutY(32); + roomOwnerNameLabel.setText(roomInfo.getRoomOwner()); + + Label modalLabel = new Label(); + modalLabel.setLayoutX(54); + modalLabel.setLayoutY(60); + modalLabel.getStyleClass().add("modalLabel"); + modalLabel.setText(roomInfo.getRoomType()); + + Label playerCountLabel = new Label(); + playerCountLabel.setLayoutX(60); + playerCountLabel.setLayoutY(100); + playerCountLabel.getStyleClass().add("playerCountLabel"); + playerCountLabel.setText("当前人数:" + roomInfo.getRoomClientCount() + "/3"); + + ObservableList children = pane.getChildren(); children.add(idLabel); - - // 房主label - roomOwnerLabel = new Label(); - roomOwnerLabel.setLayoutX(14); - roomOwnerLabel.setLayoutY(40); - roomOwnerLabel.setText("房主:" + roomInfo.getRoomOwner()); children.add(roomOwnerLabel); - - // 模式label - modalLabel = new Label(); - modalLabel.setLayoutX(14); - modalLabel.setLayoutY(112); - modalLabel.setText(roomInfo.getRoomType() + "模式"); + children.add(roomOwnerNameLabel); children.add(modalLabel); - - // 当前人数 - clientCountLabel = new Label(); - clientCountLabel.setLayoutX(136); - clientCountLabel.setLayoutY(112); - clientCountLabel.setText(roomInfo.getRoomClientCount() + "/3人"); - children.add(clientCountLabel); + children.add(playerCountLabel); } public Pane getPane() { diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/PokerPane.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/PokerPane.java index 68a5bf8..6f37393 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/PokerPane.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/PokerPane.java @@ -8,7 +8,7 @@ import javafx.scene.text.Text; import org.nico.ratel.landlords.entity.Poker; import org.nico.ratel.landlords.enums.PokerLevel; import org.nico.ratel.landlords.enums.PokerType; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; public class PokerPane { diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomController.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomController.java index 414470b..bffa357 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomController.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomController.java @@ -10,7 +10,7 @@ import javafx.scene.layout.Pane; import javafx.scene.text.Text; import org.nico.ratel.landlords.entity.Poker; import org.nico.ratel.landlords.enums.ClientType; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; import priv.zxw.ratel.landlords.client.javafx.entity.User; import priv.zxw.ratel.landlords.client.javafx.ui.event.IRoomEvent; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomEventRegister.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomEventRegister.java index e95c52f..27bd4be 100644 --- a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomEventRegister.java +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/room/RoomEventRegister.java @@ -1,14 +1,13 @@ package priv.zxw.ratel.landlords.client.javafx.ui.view.room; -import javafx.scene.Node; import javafx.scene.control.Button; import org.nico.ratel.landlords.entity.Poker; -import priv.zxw.ratel.landlords.client.javafx.BeanUtil; +import priv.zxw.ratel.landlords.client.javafx.util.BeanUtil; import priv.zxw.ratel.landlords.client.javafx.entity.CurrentRoomInfo; import priv.zxw.ratel.landlords.client.javafx.entity.User; import priv.zxw.ratel.landlords.client.javafx.ui.event.IRoomEvent; -import priv.zxw.ratel.landlords.client.javafx.ui.view.CountDownTask; +import priv.zxw.ratel.landlords.client.javafx.ui.view.util.CountDownTask; import priv.zxw.ratel.landlords.client.javafx.ui.view.EventRegister; import priv.zxw.ratel.landlords.client.javafx.ui.view.UIObject; diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/AlertUtils.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/AlertUtils.java new file mode 100644 index 0000000..e640046 --- /dev/null +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/AlertUtils.java @@ -0,0 +1,29 @@ +package priv.zxw.ratel.landlords.client.javafx.ui.view.util; + +import javafx.scene.control.Alert; + +public class AlertUtils { + + public static void info(String headerText, String contentText) { + createAndShowAlert(Alert.AlertType.INFORMATION, headerText, contentText); + } + + private static void createAndShowAlert(Alert.AlertType alertType, + String headerText, String contentText) { + Alert alert = new Alert(Alert.AlertType.INFORMATION); + alert.setTitle(Alert.AlertType.INFORMATION.equals(alertType) ? "信息" : + Alert.AlertType.WARNING.equals(alertType) ? "警告" : "错误"); + alert.setHeaderText(headerText); + alert.setContentText(contentText); + + alert.showAndWait(); + } + + public static void warn(String headerText, String contentText) { + createAndShowAlert(Alert.AlertType.WARNING, headerText, contentText); + } + + public static void error(String headerText, String contentText) { + createAndShowAlert(Alert.AlertType.ERROR, headerText, contentText); + } +} diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/CountDownTask.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/CountDownTask.java new file mode 100644 index 0000000..dfeb9b8 --- /dev/null +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/ui/view/util/CountDownTask.java @@ -0,0 +1,93 @@ +package priv.zxw.ratel.landlords.client.javafx.ui.view.util; + + +import javafx.scene.Node; + +import java.util.Objects; +import java.util.function.Consumer; + +public class CountDownTask { + public static final int DEFAULT_TIME_OUT = 30; + + private Consumer finallyExecuteConsumer; + private Consumer preSecondExecuteConsumer; + private Node targetElement; + private int duration; + + public CountDownTask(Node targetElement, + Consumer finallyExecuteConsumer, Consumer preSecondExecuteConsumer) { + this.finallyExecuteConsumer = finallyExecuteConsumer; + this.preSecondExecuteConsumer = preSecondExecuteConsumer; + this.targetElement = targetElement; + } + + public CountDownTask(Node targetElement, int duration, + Consumer finallyExecuteConsumer, Consumer preSecondExecuteConsumer) { + Objects.requireNonNull(finallyExecuteConsumer); + + this.finallyExecuteConsumer = finallyExecuteConsumer; + this.preSecondExecuteConsumer = preSecondExecuteConsumer; + this.duration = duration < 0 ? DEFAULT_TIME_OUT : duration; + this.targetElement = targetElement; + } + + public CountDownFuture start() { + targetElement.setVisible(true); + + CountDownFuture future = new CountDownFuture(); + future.start(); + + return future; + } + + public class CountDownFuture extends Thread { + + private volatile boolean done = false; + + private CountDownFuture() { + setDaemon(true); + } + + @Override + public void run() { + long startTimeMillis = System.currentTimeMillis(); + + long interval; + try { + while (true) { + long currentTimeMillis = System.currentTimeMillis(); + interval = (currentTimeMillis - startTimeMillis) / 1000; + + if (interval > duration) { + break; + } + + preSecondExecuteConsumer.accept((int) (duration - interval)); + + sleep(1000L); + } + + finallyExecuteConsumer.accept(targetElement); + } catch (InterruptedException cancelFlag) { + // exit + return; + } finally { + done = true; + targetElement.setVisible(false); + } + } + + public void cancel() { + if (done) { + return; + } + + done = true; + interrupt(); + } + + public boolean isDone() { + return done; + } + } +} diff --git a/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/util/BeanUtil.java b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/util/BeanUtil.java new file mode 100644 index 0000000..e814ed3 --- /dev/null +++ b/landlords-client-javafx/src/main/java/priv/zxw/ratel/landlords/client/javafx/util/BeanUtil.java @@ -0,0 +1,17 @@ +package priv.zxw.ratel.landlords.client.javafx.util; + + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +public class BeanUtil { + private static final Map CACHE_MAP = new ConcurrentHashMap<>(); + + public static void addBean(String name, Object object) { + CACHE_MAP.put(name, object); + } + + public static T getBean(String name) { + return (T) CACHE_MAP.get(name); + } +} diff --git a/landlords-client-javafx/src/main/resources/view/assets/css/lobby.css b/landlords-client-javafx/src/main/resources/view/assets/css/lobby.css new file mode 100644 index 0000000..e59c1b5 --- /dev/null +++ b/landlords-client-javafx/src/main/resources/view/assets/css/lobby.css @@ -0,0 +1,57 @@ +#createRoomButton { + -fx-pref-width: 30; + -fx-pref-height: 30; + -fx-background-color: #dbd9d8; + -fx-border-width: 1; + -fx-border-radius: 5; + -fx-background-radius: 5; + -fx-border-color: #dbd9d8; + -fx-cursor: hand; + -fx-background-image: url("../image/add_0.png"); +} + +.title { + -fx-pref-width: 600; + -fx-pref-height: 40; + -fx-border-color: black; + -fx-border-width: 0 0 1 0; +} + +.roomListTitle { + -fx-font-size: 20; +} + +.roomPane { + -fx-pref-width: 150; + -fx-pref-height: 120; + -fx-border-color: #afadab; + -fx-background-color: #dddbd8; + -fx-background-radius: 10; + -fx-border-radius: 10; + -fx-cursor: hand; +} + +.roomPane:hover { + -fx-border-color: #3f91af; +} + +.roomPane > .idLabel { + -fx-font-size: 16; + -fx-border-color: black; + -fx-border-width: 0 0 1 0; +} + +.roomPane > .roomOwnerLabel { + -fx-pref-width: 30; + -fx-pref-height: 30; + -fx-background-image: url("../image/face_0.png"); +} + +.roomPane > .modalLabel { + -fx-font-size: 30; + -fx-text-fill: silver; + -fx-opacity: 0.8; +} + +.roomPane > .playerCountLabel { +} \ No newline at end of file diff --git a/landlords-client-javafx/src/main/resources/view/assets/css/room.css b/landlords-client-javafx/src/main/resources/view/assets/css/room.css index 7e54c65..9f517f9 100644 --- a/landlords-client-javafx/src/main/resources/view/assets/css/room.css +++ b/landlords-client-javafx/src/main/resources/view/assets/css/room.css @@ -1,5 +1,3 @@ -@import "./poker.css"; - #waitingPane, #gameOverPane { -fx-background-color: silver; diff --git a/landlords-client-javafx/src/main/resources/view/assets/image/add_0.png b/landlords-client-javafx/src/main/resources/view/assets/image/add_0.png new file mode 100644 index 0000000000000000000000000000000000000000..e9e0f6f95b37e24b954bbdb04cb65b6c1f8be4f7 GIT binary patch literal 1533 zcmbVMU1;4@9M9Cs>{`hLV z9X@2#59nQOKU{x1QA1X+>yCXgz!2^`5LMFp(*_O>1P7(yQXkv+L4{eA`QR18I#kS zi&eb2jty6sJIWvFKt>Rd6!D#)878n}3O!!P*4Z%-_#Px(H--63AiwNXc#Fn_pO$nH zE1JsB7?PsPhN?~Rs;tZac?Kv2QC6U=!-ByNK7mP#T@Nl5PYh(SohdZZG=c!M+ij^` zkZ4>7ieVT)R)MOD3?U{PVTw9pm`n^AiX_3YAEiDG`HT_OXe%`ZrfJ`VAj)aOWZ)*| zFwj8}P$W4ssRwj%j*D7xvnSlefHX-!!Zcx6CC5e$n$n~}|AjigzDodet>fe}cGV>a zauG>dI>*cyIAm9JQr(CMSRx5+#h8@NF*PSLYa(dH1f?{tQra8_sxnlWw=910j32tR zojkn*PKqccrl88I%%UZ#vsFcgY5^AXXXIHZ%YCRrUEkZ-6{Iauo9rT4S~$+zB}-QfT^ChJ>8a~D z&<>Lng_zhyQ(&%dAktRCHe@~P`z)mC5GzIN!F#rL_7ews9=ZrfW|-+1riuTNcA e5D))$@Ih|k*5hxjZX0V^gSJbH#f!(+&i@Uk{OvaY literal 0 HcmV?d00001 diff --git a/landlords-client-javafx/src/main/resources/view/assets/image/add_1.png b/landlords-client-javafx/src/main/resources/view/assets/image/add_1.png new file mode 100644 index 0000000000000000000000000000000000000000..41636920e1405a88117a83ada7a2e7b997b9ffea GIT binary patch literal 1535 zcmbVMO^n+_6m~1Rf{5(E`U7q#~;Ag#)V80|zAj#0`l995^7Aaek~VTBxWcd&V>0 zeBXO--h1a47f$ZYJeuJ+Zf~_>)!29-dGDWM-zUK357_WPRC%6o+=J7}yNkQ{?jszx zXP;kRqD%HO(8Yn|c({qAK@c%C#~qy;M2@?RDBnbFKQx5jKEEdLzGn!h^ER*}6LtK` zT8vJuE!5q$Ww+!Bb5HU|2apj2h&ucr=!OIi3}MI%**sa61%3#j%Z5-+1ok5FH1{LiHC_(^6P#b%GYjsCx4(7ofP?j*BL!G;V zJr}lc95~EfKXBSej>5LUr$K}!?&6pUGwZbN>s8ZSjB(5FvJFx@d7Q7#n+2s*D2S@0 z49&G|SPcnvLKjsnLtvqieBXmjUH24SSH&hM7DNr?T(MZlJEH4pNcX(F3XncIZ(+BW zB*5gn_dm}+8~dyPo$fvJBxRXo4y^cu-RbJMa899>@vQ6f!(@Sun-qZ|xXJA!PZ%%z z_Z)!{ZNGyU>3`(K2u5&=_MI4&+bmjl$vT;tE+@r0@5g;MOWt+tjot6Fa8aE6YC=Y literal 0 HcmV?d00001 diff --git a/landlords-client-javafx/src/main/resources/view/assets/image/face_0.png b/landlords-client-javafx/src/main/resources/view/assets/image/face_0.png new file mode 100644 index 0000000000000000000000000000000000000000..2bfc2235fbcd5576da4d112a3053490cb7770847 GIT binary patch literal 2235 zcmbVO4Nw$iA73~`5=r_PBm8JxsVKSI-2?8}#Z&MOv06;7!8scZNLmxEt|(B z72DX1;#4DDyn-eeWbPbzb|DD}EUZMqg%&d}l7$*%gqH+s_cn^aBM@nY28nkIgtH83 zuvW0KaI``tr|~EytR@t=3L}(J5wH@&)hMP$@klv_lbDK(Bw){j0BJVHM5gN!J+i=; z2Fa5oD~Y0ZyIooIFtm`eqPPNcn=}GsXfMuMU^9;hXK0i)vlf<@M1aM;SZkgj z31Xh`C)D2K-w6P&H5j}y?x~B#;uRrE2`hma9*5i$EgFlgESk=WLV=BD6IKE>XS%Ji zl3E)}NrKHN28XN>Uj~MiH~H z7!t!qp$38BOhxyEMv?gMp&(%xN}~Q2%+RDsuvsWzE@z=~S=7qsBCywqq*gEsHXs;i z7kT%-UaL*B2`0`A4#f2N^I&~~R)rHPm0YR7N7OYKNIfq~6i>5yodyA}QE(hXvbZva zB?yp}F)BumV^JzOfvFieql#8BCOitmBXh>?>jb*Mod9F^nSXeHfsF$NNSXgNkGm}0 znL{RVB8X{`r*JaZ7d$I72ahBRNzv{i&>*xs`YeNZwz+@pfl*p}9t%kSA}>Z^qF|Ej zl#Pwg1>X9btV4n7sJmE4tw8^1;Ka~QsfKgQhC?qThx*>%G~>eCo~db3P@Ti!50?%(NcGkRTz^yckgEkf zx7t6o+i{?zdCAPu_D?>U@TsYK&z?QW$2J(Pu>%UMUhEZKd^E;)>icbVV(+Am8ocLr z^qwUrqCcG9HQu$Q+u=9)T;KAlPs@Hl=V0l%Wa);w>t{BCrSru`nRmpxYjh~XB}DZdNqo@ z?RREfkFPmsMljv*S>8TFYhrp^Y03Gaiy@b4ZxpvRSqkFxv5#ve9JSO2f3&-S(C2R6 zu|0hA`W@jPX7J-ueGa%|DQkh8i?UJ3%Kd8^vcXbE*&M1|)E3)S=d|16t z7UO^Ay^_ZMy{8P0aj)l8RBtQU>+gF=*66c%|76$j*6YRqYSzI2$*c9UEwa9~%Ue6Y z`{7!v>Jep18{Y&U3u!`HHLG?vnWiwrk&-jO2}Bl`?hmj%6)}F5kG7(ta(GaIIOsbZN;u-R9=k*V0ud0Yo+J%urF!f%aKv z=4?E;xc|kTNwV`-PuCMZ=f7Uv&}~+{6int0MeCo`2K4Q{HS|T8Yk7?mI=Vf*xbe$; zpQ+=AAbYnX{Nf{PtK&kaO=B6R^tGpL+|(aP^a1tMWx>-Se%AOeI{!Df wR-Cg{Ty{CX%CYle&wih1zo|xTd%S15p`O^0K~S=eSoiORJ|R`tJTH6wZ;>lVzyJUM literal 0 HcmV?d00001 diff --git a/landlords-client-javafx/src/main/resources/view/lobby.fxml b/landlords-client-javafx/src/main/resources/view/lobby.fxml index 1a9bc1b..341b602 100644 --- a/landlords-client-javafx/src/main/resources/view/lobby.fxml +++ b/landlords-client-javafx/src/main/resources/view/lobby.fxml @@ -1,27 +1,25 @@ - - - + + + - - + + - - - - + + + +