Skip to content

Commit 0e393db

Browse files
author
Evan Hu
committed
server type
1 parent 7df79a1 commit 0e393db

File tree

5 files changed

+33
-53
lines changed

5 files changed

+33
-53
lines changed

src/main/java/info/xiaomo/gengine/network/mina/config/MinaClientConfig.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class MinaClientConfig extends BaseServerConfig {
3434

3535
// 当前服务器的类型,如当前服务器是gameserver.那么对应ServerType.GameServer = 10
3636
@Element(required = false)
37-
private ServerType type = ServerType.GATE;
37+
private Integer type = ServerType.GATE;
3838

3939
// 其他配置,如配置服务器允许开启的地图
4040
@Element(required = false)
@@ -79,14 +79,14 @@ public void setSoLinger(int soLinger) {
7979
/**
8080
* <p>Getter for the field <code>type</code>.</p>
8181
*/
82-
public ServerType getType() {
82+
public Integer getType() {
8383
return type;
8484
}
8585

8686
/**
8787
* <p>Setter for the field <code>type</code>.</p>
8888
*/
89-
public void setType(ServerType type) {
89+
public void setType(Integer type) {
9090
this.type = type;
9191
}
9292

@@ -150,7 +150,7 @@ public void setMaxConnectCount(int maxConnectCount) {
150150
@Root
151151
public static class MinaClienConnToConfig extends BaseServerConfig {
152152
@Element(required = true)
153-
private ServerType type = ServerType.GATE;
153+
private Integer type = ServerType.GATE;
154154

155155
// 链接到服务器的地址
156156
@Element(required = true)
@@ -160,11 +160,11 @@ public static class MinaClienConnToConfig extends BaseServerConfig {
160160
@Element(required = true)
161161
private int port = 8500;
162162

163-
public ServerType getType() {
163+
public Integer getType() {
164164
return type;
165165
}
166166

167-
public void setType(ServerType type) {
167+
public void setType(Integer type) {
168168
this.type = type;
169169
}
170170

@@ -192,7 +192,7 @@ public void setPort(int port) {
192192
@Override
193193
public int hashCode() {
194194
int hash = 5;
195-
hash = 47 * hash + type.ordinal();
195+
hash = 47 * hash + type;
196196
hash = 47 * hash + id;
197197
return hash;
198198
}
@@ -206,7 +206,7 @@ public boolean equals(Object obj) {
206206
return false;
207207
}
208208
final MinaClienConnToConfig other = (MinaClienConnToConfig) obj;
209-
if (type != other.type) {
209+
if (!type.equals(other.type)) {
210210
return false;
211211
}
212212
if (id != other.id) {

src/main/java/info/xiaomo/gengine/network/mina/config/MinaServerConfig.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class MinaServerConfig extends BaseServerConfig {
5454

5555
// 服务器类型
5656
@Element(required = false)
57-
private ServerType type = ServerType.GATE;
57+
private Integer type = ServerType.GATE;
5858

5959
//http服务器端口
6060
@Element(required = false)
@@ -233,14 +233,14 @@ public void setIp(String ip) {
233233
/**
234234
* <p>Getter for the field <code>type</code>.</p>
235235
*/
236-
public ServerType getType() {
236+
public Integer getType() {
237237
return type;
238238
}
239239

240240
/**
241241
* <p>Setter for the field <code>type</code>.</p>
242242
*/
243-
public void setType(ServerType type) {
243+
public void setType(Integer type) {
244244
this.type = type;
245245
}
246246

src/main/java/info/xiaomo/gengine/network/netty/config/NettyClientConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class NettyClientConfig extends BaseServerConfig {
2424

2525
// 当前服务器的类型,如当前服务器是gameServer.那么对应ServerType.GameServer = 10
2626
@Element(required = false)
27-
private ServerType type = ServerType.GATE;
27+
private Integer type = ServerType.GATE;
2828

2929
// 其他配置,如配置服务器允许开启的地图
3030
@Element(required = false)

src/main/java/info/xiaomo/gengine/network/server/ServerType.java

Lines changed: 17 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,64 +6,44 @@
66
* <p>
77
* 2017-03-30
88
*/
9-
public enum ServerType {
10-
NONE(-1),
9+
public interface ServerType {
10+
int NONE = -1;
11+
1112
/**
1213
* 网关
1314
*/
14-
GATE(1),
15+
int GATE = 1;
1516

1617
/**
1718
* 游戏
1819
*/
19-
GAME(2),
20+
int GAME = 2;
21+
2022
/**
2123
* 集群管理服
2224
*/
23-
CLUSTER(3),
24-
LOG(4),
25+
int CLUSTER = 3;
26+
27+
int LOG = 4;
28+
2529
/**
2630
* 聊天
2731
*/
28-
CHAT(5),
29-
PAY(6),
32+
int CHAT = 5;
33+
34+
int PAY = 6;
35+
3036
/**
3137
* 大厅
3238
*/
33-
HALL(7),
39+
int HALL = 7;
3440

3541
// 游戏100开始
3642

3743
//备用 1000开始
38-
GAME_1(1001),
39-
GAME_2(1002),
40-
GAME_3(1003),
41-
GAME_4(1004),
42-
GAME_5(1005),
43-
GAME_6(1006),
44-
GAME_7(1007),
45-
GAME_8(1008),
46-
47-
48-
;
49-
50-
51-
private final int type;
44+
int GAME_1 = 1001;
5245

53-
ServerType(int type) {
54-
this.type = type;
55-
}
46+
int GAME_2 = 1002;
5647

57-
public static ServerType valueOf(int type) {
58-
for (ServerType t : ServerType.values()) {
59-
if (t.getType() == type) {
60-
return t;
61-
}
62-
}
63-
return NONE;
64-
}
6548

66-
public int getType() {
67-
return type;
68-
}
6949
}

src/main/java/info/xiaomo/gengine/script/ScriptManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ public class ScriptManager {
1818
static {
1919
scriptPool = new ScriptPool();
2020
try {
21-
String property = System.getProperty("user.dir")+"/game-fish";
22-
String path = property + "-scripts" + File.separator + "src" + File.separator + "main" + File.separator // 脚本路径
21+
String property = System.getProperty("user.dir") + "/game-server-fish";
22+
String path = property + "-script" + File.separator + "src" + File.separator + "main" + File.separator // 脚本路径
2323
+ "java" + File.separator;
24-
String outpath = property + File.separator + "target" + File.separator + "scriptsbin" + File.separator; // class类编译路径
24+
String outPath = property + File.separator + "target" + File.separator + "script" + File.separator; // class类编译路径
2525
String jarsDir = property + File.separator + "target" + File.separator; // jar包路径
26-
scriptPool.setSource(path, outpath, jarsDir);
26+
scriptPool.setSource(path, outPath, jarsDir);
2727
} catch (Exception ignored) {
2828
}
2929
}

0 commit comments

Comments
 (0)