Browse Source

优化工具类与服务器目录

johnclot69 4 months ago
parent
commit
ec27f7c5f8
20 changed files with 51 additions and 42 deletions
  1. 1 0
      incubator-game/conf/db.properties
  2. 1 1
      incubator-game/src/main/java/com/incubator/game/GGame.java
  3. 9 4
      incubator-game/src/main/java/com/incubator/game/data/JS2JMain.java
  4. 12 6
      incubator-game/src/main/java/com/incubator/game/data/ParamMain.java
  5. 6 9
      incubator-game/src/main/java/com/incubator/game/data/data/GlobalParamConfig.java
  6. 1 1
      incubator-game/src/main/java/com/incubator/game/data/data/ParametersConfig.java
  7. 4 4
      incubator-game/src/main/java/com/incubator/game/data/jdbc/DBData.java
  8. 4 4
      incubator-game/src/main/java/com/incubator/game/data/jdbc/LSDBHandler.java
  9. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/AccountInfoPO.java
  10. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/GameLogPO.java
  11. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/GlobalInfoPO.java
  12. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/PlayerInfoPO.java
  13. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/RoomPO.java
  14. 1 1
      incubator-game/src/main/java/com/incubator/game/data/po/StatisticsLogPO.java
  15. 1 1
      incubator-game/src/main/java/com/incubator/game/handler/LoginGameHandler.java
  16. 1 1
      incubator-game/src/main/java/com/incubator/game/player/Player.java
  17. 1 1
      incubator-game/src/main/java/com/incubator/game/player/PlayerPool.java
  18. 1 1
      incubator-game/src/main/java/com/incubator/game/room/JDGDRoom.java
  19. 2 2
      incubator-game/src/main/java/com/incubator/game/util/GameDataUtil.java
  20. 1 1
      incubator-game/src/main/java/com/incubator/game/util/PlayerUtil.java

+ 1 - 0
incubator-game/conf/db.properties

@@ -9,6 +9,7 @@ redis.host=123.60.58.84
 redis.port=6379
 redis.auth=
 redis.db=1
+
 redis.timeout=3000
 redis.maxIdle=100
 redis.maxWaitMillis=1000

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/GGame.java

@@ -19,7 +19,7 @@ import com.incubator.game.listener.HttpInnerListener;
 import com.incubator.core.net.ws.NetHandler;
 import com.incubator.core.net.handler.InitalizerHttpServerHandler;
 import com.incubator.core.net.handler.InitalizerProtocolHandler;
-import com.incubator.game.data.entity.GlobalInfoPO;
+import com.incubator.game.data.po.GlobalInfoPO;
 import com.incubator.game.data.jdbc.LSDBHandler;
 import com.incubator.game.listener.PublicListener;
 import com.incubator.game.player.GPlayer;

+ 9 - 4
incubator-game/src/main/java/com/incubator/game/data/JS2JMain.java

@@ -15,6 +15,11 @@ public final class JS2JMain {
 
 	private static final Logger logger = Log4jUtil.getLogger(JS2JMain.class);
 
+	// 生成策划表CO类路径
+	private final static String pathName = "src/main/java/com/incubator/game/data/data";
+	// ext父类路径
+	private final static String pakName = "com.incubator.game.data.data";
+
 	private static int TableCount = 0;
 
 	public static void writeClass(File parent) {
@@ -50,16 +55,16 @@ public final class JS2JMain {
 			}
 
 			File root = new File(GGame.DIR_GAME_DATA);
-			DataUtil.setDir("src/main/java/com/incubator/game/data/data");
-			// 设置某些对象的父类
+			DataUtil.setDir(pathName);
+			// 设置某些策划表CO对象的父类
 
-			DataUtil.addExtClass("com.incubator.game.data.data");
+			DataUtil.addExtClass(pakName);
 
 			writeClass(root);
 			logger.info("生成表格数: {}", TableCount);
 
 			DataUtil.writeGameData();
-			System.out.println("策划数据表转换完成!");
+			logger.info("策划数据表转换完成!");
 		} catch (Exception e) {
 			logger.error("读取策划数据表出错...", e);
 		}

+ 12 - 6
incubator-game/src/main/java/com/incubator/game/data/ParamMain.java

@@ -10,15 +10,17 @@ import java.io.IOException;
 
 /**
  * 读取 json/GlobalConfig/Parameters.json
- * 自动生成 GlobalConfig 常量参数, 不需要手动复制然后覆盖参数
+ * 自动生成 GlobalConfig 全局常量参数, 不需要手动复制然后覆盖参数
  *
  * @author agui 
  */
 public final class ParamMain {
 
+	// 生成类路径
+	private final static String pathName = "src/main/java/com/incubator/game/data/data/ParametersConfig.java";
 	// java类生成头
 	private final static String START = "//================================ParamMain auto generate start================================//";
-	public final static String END = "//================================ParamMain auto generate end================================//";
+	private final static String END = "//================================ParamMain auto generate end================================//";
 
 	public static void main(String[] args) {
 		loadConfig(true);
@@ -47,16 +49,20 @@ public final class ParamMain {
 			JSONArray values = (JSONArray) doc.get(i);
 			String type = values.getString(1);
 			String content = values.getString(2);
-			builder.append("\n\t/**").append(content).append(" */").append("\n\tpublic static ").append("NUMBER".equals(type) ? "int " : "LONG".equals(type) ? "long " : "FLOAT".equals(type) ? "float " : "String ").append(values.get(0).toString().replace(".", "_")).append(";");
+			builder.append("\n\t/**")
+					.append(content).append(" */")
+					.append("\n\tpublic static ")
+					.append("NUMBER".equals(type) ? "int " : "LONG".equals(type) ? "long " : "FLOAT".equals(type) ? "float " : "String ")
+					.append(values.get(0).toString().replace(".", "_"))
+					.append(";");
 		}
 
 		builder.append("\n\n\t" + END);
 
-		String pathName = "src/main/java/com/incubator/game/data/config/ParametersConfig.java";
-		writeToJava(pathName, builder);
+		writeToJava(builder);
 	}
 
-	private static void writeToJava(String pathName, StringBuilder builder) {
+	private static void writeToJava(StringBuilder builder) {
 		File msgFile = new File(pathName);
 		System.out.println(msgFile.getAbsolutePath());
 		StringBuilder msgContent = new StringBuilder(FileUtil.readText(msgFile));

+ 6 - 9
incubator-game/src/main/java/com/incubator/game/data/config/GlobalConfig.java → incubator-game/src/main/java/com/incubator/game/data/data/GlobalParamConfig.java

@@ -1,24 +1,21 @@
-package com.incubator.game.data.config;
+package com.incubator.game.data.data;
 
 import com.incubator.common.log4j.Log4jUtil;
-import com.incubator.game.data.data.GameData;
-import com.incubator.game.data.data.ParametersCO;
-import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 
 import java.lang.reflect.Field;
 
 /**
- * 全局参数配置管理
+ * 全局参数表, 自定义解析管理
  */
-public final class GlobalConfig extends ParametersConfig {
+public final class GlobalParamConfig extends ParametersConfig {
 
-	private static final Logger logger = Log4jUtil.getLogger(GlobalConfig.class);
+	private static final Logger logger = Log4jUtil.getLogger(GlobalParamConfig.class);
 
 	/** 自定义格式解析字段 **/
 
 
-	private static void initParameters(GlobalConfig config) {
+	private static void initParameters(GlobalParamConfig config) {
 		for (ParametersCO param : GameData.Parameterss.values()) {
 			try {
 				Field field = config.getClass().getField(param.paramName.trim().replace(".", "_"));
@@ -47,7 +44,7 @@ public final class GlobalConfig extends ParametersConfig {
 	 * 加载策划脚本
 	 */
 	public static void init(boolean firstInit) {
-		GlobalConfig config = new GlobalConfig();
+		GlobalParamConfig config = new GlobalParamConfig();
 		initParameters(config);
 
 		//自定义格式解析

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/config/ParametersConfig.java → incubator-game/src/main/java/com/incubator/game/data/data/ParametersConfig.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.config;
+package com.incubator.game.data.data;
 
 /**
  * 游戏参数配置

+ 4 - 4
incubator-game/src/main/java/com/incubator/game/data/jdbc/DBData.java

@@ -1,10 +1,10 @@
 package com.incubator.game.data.jdbc;
 
 import com.incubator.core.db.handler.RowMapper;
-import com.incubator.game.data.entity.AccountInfoPO;
-import com.incubator.game.data.entity.GameLogPO;
-import com.incubator.game.data.entity.GlobalInfoPO;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.AccountInfoPO;
+import com.incubator.game.data.po.GameLogPO;
+import com.incubator.game.data.po.GlobalInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 
 import java.sql.ResultSet;
 import java.sql.SQLException;

+ 4 - 4
incubator-game/src/main/java/com/incubator/game/data/jdbc/LSDBHandler.java

@@ -1,10 +1,10 @@
 package com.incubator.game.data.jdbc;
 
 import com.incubator.core.db.handler.DBHandler;
-import com.incubator.game.data.entity.AccountInfoPO;
-import com.incubator.game.data.entity.GameLogPO;
-import com.incubator.game.data.entity.GlobalInfoPO;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.AccountInfoPO;
+import com.incubator.game.data.po.GameLogPO;
+import com.incubator.game.data.po.GlobalInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 
 import java.sql.Timestamp;
 import java.util.Date;

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/AccountInfoPO.java → incubator-game/src/main/java/com/incubator/game/data/po/AccountInfoPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 import java.util.Date;
 

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/GameLogPO.java → incubator-game/src/main/java/com/incubator/game/data/po/GameLogPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 
 /**

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/GlobalInfoPO.java → incubator-game/src/main/java/com/incubator/game/data/po/GlobalInfoPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 
 /**

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/PlayerInfoPO.java → incubator-game/src/main/java/com/incubator/game/data/po/PlayerInfoPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 /**
  * 数据库表[player_info]对应的实体类

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/RoomPO.java → incubator-game/src/main/java/com/incubator/game/data/po/RoomPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 import com.incubator.game.player.Player;
 import com.incubator.game.util.JDGDUtils;

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/data/entity/StatisticsLogPO.java → incubator-game/src/main/java/com/incubator/game/data/po/StatisticsLogPO.java

@@ -1,4 +1,4 @@
-package com.incubator.game.data.entity;
+package com.incubator.game.data.po;
 
 
 /**

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/handler/LoginGameHandler.java

@@ -5,7 +5,7 @@ import com.incubator.common.net.Connection;
 import com.incubator.core.net.ws.NetHandler;
 import com.incubator.core.net.ws.WSRequest;
 import com.incubator.core.net.ws.WSResponse;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 import com.incubator.game.player.Player;
 import com.incubator.game.room.Room;
 import com.incubator.game.room.RoomService;

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/player/Player.java

@@ -1,7 +1,7 @@
 package com.incubator.game.player;
 
 import com.incubator.game.GGame;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 import com.incubator.game.util.Const.PlayerEventType;
 import com.incubator.game.util.Const.ManagerType;
 

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/player/PlayerPool.java

@@ -1,7 +1,7 @@
 package com.incubator.game.player;
 
 import com.incubator.game.GGame;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 
 import java.util.Queue;
 import java.util.concurrent.ConcurrentLinkedQueue;

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/room/JDGDRoom.java

@@ -1,6 +1,6 @@
 package com.incubator.game.room;
 
-import com.incubator.game.data.entity.RoomPO;
+import com.incubator.game.data.po.RoomPO;
 import com.incubator.game.player.Player;
 import com.incubator.core.room.GRoomInterface;
 import com.incubator.game.util.CardUtils;

+ 2 - 2
incubator-game/src/main/java/com/incubator/game/util/GameDataUtil.java

@@ -3,7 +3,7 @@ package com.incubator.game.util;
 import com.incubator.common.log4j.Log4jUtil;
 import com.incubator.core.util.DataUtil;
 import com.incubator.game.GGame;
-import com.incubator.game.data.config.GlobalConfig;
+import com.incubator.game.data.data.GlobalParamConfig;
 import org.slf4j.Logger;
 
 import java.io.File;
@@ -56,7 +56,7 @@ public final class GameDataUtil {
 				
 		DataUtil.initProperty();
 		//加载全局参数
-		GlobalConfig.init(true);
+		GlobalParamConfig.init(true);
 	}
 	
 	

+ 1 - 1
incubator-game/src/main/java/com/incubator/game/util/PlayerUtil.java

@@ -2,7 +2,7 @@ package com.incubator.game.util;
 
 import com.incubator.common.net.Connection;
 import com.incubator.game.GGame;
-import com.incubator.game.data.entity.PlayerInfoPO;
+import com.incubator.game.data.po.PlayerInfoPO;
 import com.incubator.game.player.GPlayer;
 import com.incubator.game.player.Player;