Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
776db5ae
E
et
项目概览
老鱼er
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
et
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
776db5ae
编写于
9月 10, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
统一Websocket,TCP,KCP代码,使用方式完全一样
上级
da3d635d
变更
17
隐藏空白更改
内联
并排
Showing
17 changed file
with
106 addition
and
182 deletion
+106
-182
Config/StartConfig/127.0.0.1.txt
Config/StartConfig/127.0.0.1.txt
+9
-9
Config/StartConfig/Benchmark.txt
Config/StartConfig/Benchmark.txt
+2
-2
Config/StartConfig/BenchmarkWebsocket.txt
Config/StartConfig/BenchmarkWebsocket.txt
+3
-0
Config/StartConfig/LocalAllServer.txt
Config/StartConfig/LocalAllServer.txt
+1
-1
Server/App/Program.cs
Server/App/Program.cs
+19
-15
Server/Hotfix/Module/Benchmark/BenchmarkComponentSystem.cs
Server/Hotfix/Module/Benchmark/BenchmarkComponentSystem.cs
+4
-3
Server/Hotfix/Module/Benchmark/WebSocketBenchmarkComponentSystem.cs
...fix/Module/Benchmark/WebSocketBenchmarkComponentSystem.cs
+7
-7
Server/Hotfix/Module/FrameSync/C2R_LoginHandler.cs
Server/Hotfix/Module/FrameSync/C2R_LoginHandler.cs
+1
-1
Server/Hotfix/Module/Message/NetInnerComponentSystem.cs
Server/Hotfix/Module/Message/NetInnerComponentSystem.cs
+4
-4
Server/Hotfix/Module/Message/NetOuterComponentSystem.cs
Server/Hotfix/Module/Message/NetOuterComponentSystem.cs
+6
-17
Server/Model/Other/Options.cs
Server/Model/Other/Options.cs
+3
-0
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
...Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
+26
-22
Unity/Assets/Scripts/Component/Config/ClientConfig.cs
Unity/Assets/Scripts/Component/Config/ClientConfig.cs
+1
-21
Unity/Assets/Scripts/Component/Config/InnerConfig.cs
Unity/Assets/Scripts/Component/Config/InnerConfig.cs
+4
-16
Unity/Assets/Scripts/Component/Config/OuterConfig.cs
Unity/Assets/Scripts/Component/Config/OuterConfig.cs
+2
-41
Unity/Assets/Scripts/Module/Message/NetworkComponent.cs
Unity/Assets/Scripts/Module/Message/NetworkComponent.cs
+11
-22
Unity/Assets/Scripts/Other/AppType.cs
Unity/Assets/Scripts/Other/AppType.cs
+3
-1
未找到文件。
Config/StartConfig/127.0.0.1.txt
浏览文件 @
776db5ae
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10000, "Host2" : "127.0.0.1
" }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565862653976"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 10001
}], "AppId" : 2, "AppType" : "Location", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20001 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10002, "Host2" : "127.0.0.1
" }], "AppId" : 3, "AppType" : "Realm", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20002 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10003, "Host2" : "127.0.0.1
" }], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20003 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10004, "Host2" : "127.0.0.1
" }], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20004 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10005, "Host2" : "127.0.0.1
" }], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20005 }, { "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10006, "Host2" : "127.0.0.1
" }], "AppId" : 7, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20006
}], "AppId" : 8, "AppType" : "Map", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20007
}], "AppId" : 9, "AppType" : "Map", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20000" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10000", "Address2" : "127.0.0.1:10000
" }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565862653976"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:10001"
}], "AppId" : 2, "AppType" : "Location", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20001" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10002", "Address2" : "127.0.0.1:10002
" }], "AppId" : 3, "AppType" : "Realm", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20002" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10003", "Address2" : "127.0.0.1:10003
" }], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20003" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10004", "Address2" : "127.0.0.1:10004
" }], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20004" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10005", "Address2" : "127.0.0.1:10005
" }], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20005" }, { "_t" : "OuterConfig", "Address" : "127.0.0.1:10006", "Address2" : "127.0.0.1:10006
" }], "AppId" : 7, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20006"
}], "AppId" : 8, "AppType" : "Map", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "C" : [{ "_t" : "InnerConfig", "
Address" : "127.0.0.1:20007"
}], "AppId" : 9, "AppType" : "Map", "ServerIP" : "*" }
Config/StartConfig/Benchmark.txt
浏览文件 @
776db5ae
{ "_t" : "StartConfig", "
_id" : NumberLong("98547768819754"), "C" : [{ "_t" : "OuterConfig", "Host" : "127.0.0.1", "Port" : 10002, "Host2" : null }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "HttpConfig", "Url" : "", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "ConnectionString" : null, "DBName" : null
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "
_id" : NumberLong("98892711264291"), "C" : [{ "_t" : "ClientConfig", "Host" : "127.0.0.1", "Port" : 10002
}], "AppId" : 2, "AppType" : "Benchmark", "ServerIP" : "*" }
{ "_t" : "StartConfig", "
C" : [{ "_t" : "OuterConfig", "Address" : "127.0.0.1:10002", "Address2" : "127.0.0.1:10002" }, { "_t" : "InnerConfig", "Address" : "127.0.0.1:20000"
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "
C" : [{ "_t" : "ClientConfig", "Address" : "127.0.0.1:10002"
}], "AppId" : 2, "AppType" : "Benchmark", "ServerIP" : "*" }
Config/StartConfig/BenchmarkWebsocket.txt
0 → 100644
浏览文件 @
776db5ae
{ "_t" : "StartConfig", "C" : [{ "_t" : "OuterConfig", "Address" : "127.0.0.1:10002", "Address2" : "127.0.0.1:10002" }, { "_t" : "InnerConfig", "Address" : "127.0.0.1:20000" }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "C" : [{ "_t" : "OuterConfig", "Address" : "http://*:8080/", "Address2" : "ws://127.0.0.1:8080" }], "AppId" : 2, "AppType" : "BenchmarkWebsocketServer", "ServerIP" : "*" }
{ "_t" : "StartConfig", "C" : [{ "_t" : "ClientConfig", "Address" : "ws://127.0.0.1:8080" }], "AppId" : 3, "AppType" : "BenchmarkWebsocketClient", "ServerIP" : "*" }
Config/StartConfig/LocalAllServer.txt
浏览文件 @
776db5ae
{ "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "C" : [{ "_t" : "OuterConfig", "
Host" : "127.0.0.1", "Port" : 10002, "Host2" : "127.0.0.1" }, { "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20000
}, { "_t" : "HttpConfig", "Url" : "http://*:8080/", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "C" : [{ "_t" : "OuterConfig", "
Address" : "127.0.0.1:10002", "Address2" : "127.0.0.1:10002" }, { "_t" : "InnerConfig", "Address" : "127.0.0.1:20000"
}, { "_t" : "HttpConfig", "Url" : "http://*:8080/", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }
Server/App/Program.cs
浏览文件 @
776db5ae
...
...
@@ -48,33 +48,32 @@ namespace App
switch
(
startConfig
.
AppType
)
{
case
AppType
.
Manager
:
//Game.Scene.AddComponent<NetInnerComponent, IPEndPoint>(innerConfig.IPEndPoint);
//Game.Scene.AddComponent<NetOuterComponent, IPEndPoint>(outerConfig.IPEndPoint);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
List
<
string
>>(
new
List
<
string
>()
{
"http://*:8080/"
});
Game
.
Scene
.
AddComponent
<
AppManagerComponent
>();
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
,
string
>(
options
.
Protocol
,
outerConfig
.
Address
);
break
;
case
AppType
.
Realm
:
Game
.
Scene
.
AddComponent
<
ActorMessageDispatherComponent
>();
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
IPEndPoint
>(
innerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
IPEndPoint
>(
outerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
,
string
>(
options
.
Protocol
,
outerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
LocationProxyComponent
>();
Game
.
Scene
.
AddComponent
<
RealmGateAddressComponent
>();
break
;
case
AppType
.
Gate
:
Game
.
Scene
.
AddComponent
<
PlayerComponent
>();
Game
.
Scene
.
AddComponent
<
ActorMessageDispatherComponent
>();
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
IPEndPoint
>(
innerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
IPEndPoint
>(
outerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
,
string
>(
options
.
Protocol
,
outerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
LocationProxyComponent
>();
Game
.
Scene
.
AddComponent
<
ActorMessageSenderComponent
>();
Game
.
Scene
.
AddComponent
<
GateSessionKeyComponent
>();
break
;
case
AppType
.
Location
:
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
IPEndPoint
>(
innerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
LocationComponent
>();
break
;
case
AppType
.
Map
:
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
IPEndPoint
>(
innerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
UnitComponent
>();
Game
.
Scene
.
AddComponent
<
LocationProxyComponent
>();
Game
.
Scene
.
AddComponent
<
ActorMessageSenderComponent
>();
...
...
@@ -90,8 +89,8 @@ namespace App
Game
.
Scene
.
AddComponent
<
DBCacheComponent
>();
Game
.
Scene
.
AddComponent
<
LocationComponent
>();
Game
.
Scene
.
AddComponent
<
ActorMessageDispatherComponent
>();
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
IPEndPoint
>(
innerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
IPEndPoint
>(
outerConfig
.
IPEndPoint
);
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
,
string
>(
options
.
Protocol
,
outerConfig
.
Address
);
Game
.
Scene
.
AddComponent
<
LocationProxyComponent
>();
Game
.
Scene
.
AddComponent
<
AppManagerComponent
>();
Game
.
Scene
.
AddComponent
<
RealmGateAddressComponent
>();
...
...
@@ -101,10 +100,15 @@ namespace App
// Game.Scene.AddComponent<HttpComponent>();
break
;
case
AppType
.
Benchmark
:
//Game.Scene.AddComponent<NetOuterComponent>();
//Game.Scene.AddComponent<BenchmarkComponent, IPEndPoint>(clientConfig.IPEndPoint);
Game
.
Scene
.
AddComponent
<
NetOuterComponent
>();
Game
.
Scene
.
AddComponent
<
WebSocketBenchmarkComponent
>();
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
>(
options
.
Protocol
);
Game
.
Scene
.
AddComponent
<
BenchmarkComponent
,
string
>(
clientConfig
.
Address
);
break
;
case
AppType
.
BenchmarkWebsocketServer
:
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
,
string
>(
NetworkProtocol
.
WebSocket
,
outerConfig
.
Address
);
break
;
case
AppType
.
BenchmarkWebsocketClient
:
Game
.
Scene
.
AddComponent
<
NetOuterComponent
,
NetworkProtocol
>(
NetworkProtocol
.
WebSocket
);
Game
.
Scene
.
AddComponent
<
WebSocketBenchmarkComponent
,
string
>(
clientConfig
.
Address
);
break
;
default
:
throw
new
Exception
(
$"命令行参数没有设置正确的AppType:
{
startConfig
.
AppType
}
"
);
...
...
Server/Hotfix/Module/Benchmark/BenchmarkComponentSystem.cs
浏览文件 @
776db5ae
...
...
@@ -6,9 +6,9 @@ using ETModel;
namespace
ETHotfix
{
[
ObjectSystem
]
public
class
BenchmarkComponentSystem
:
AwakeSystem
<
BenchmarkComponent
,
IPEndPoint
>
public
class
BenchmarkComponentSystem
:
AwakeSystem
<
BenchmarkComponent
,
string
>
{
public
override
void
Awake
(
BenchmarkComponent
self
,
IPEndPoint
a
)
public
override
void
Awake
(
BenchmarkComponent
self
,
string
a
)
{
self
.
Awake
(
a
);
}
...
...
@@ -16,10 +16,11 @@ namespace ETHotfix
public
static
class
BenchmarkComponentHelper
{
public
static
void
Awake
(
this
BenchmarkComponent
self
,
IPEndPoint
ipEndPoint
)
public
static
void
Awake
(
this
BenchmarkComponent
self
,
string
address
)
{
try
{
IPEndPoint
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
address
);
NetOuterComponent
networkComponent
=
Game
.
Scene
.
GetComponent
<
NetOuterComponent
>();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
...
...
Server/Hotfix/Module/Benchmark/WebSocketBenchmarkComponentSystem.cs
浏览文件 @
776db5ae
...
...
@@ -5,24 +5,24 @@ using ETModel;
namespace
ETHotfix
{
[
ObjectSystem
]
public
class
WebSocketBenchmarkComponentSystem
:
AwakeSystem
<
WebSocketBenchmarkComponent
>
public
class
WebSocketBenchmarkComponentSystem
:
AwakeSystem
<
WebSocketBenchmarkComponent
,
string
>
{
public
override
void
Awake
(
WebSocketBenchmarkComponent
self
)
public
override
void
Awake
(
WebSocketBenchmarkComponent
self
,
string
address
)
{
self
.
Awake
();
self
.
Awake
(
address
);
}
}
public
static
class
WebSocketBenchmarkComponentHelper
{
public
static
void
Awake
(
this
WebSocketBenchmarkComponent
self
)
public
static
void
Awake
(
this
WebSocketBenchmarkComponent
self
,
string
address
)
{
try
{
NetOuterComponent
networkComponent
=
Game
.
Scene
.
GetComponent
<
NetOuterComponent
>();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
self
.
TestAsync
(
networkComponent
,
i
);
self
.
TestAsync
(
networkComponent
,
i
,
address
);
}
}
catch
(
Exception
e
)
...
...
@@ -31,11 +31,11 @@ namespace ETHotfix
}
}
public
static
async
void
TestAsync
(
this
WebSocketBenchmarkComponent
self
,
NetOuterComponent
networkComponent
,
int
j
)
public
static
async
void
TestAsync
(
this
WebSocketBenchmarkComponent
self
,
NetOuterComponent
networkComponent
,
int
j
,
string
address
)
{
try
{
using
(
Session
session
=
networkComponent
.
Create
(
$"ws://127.0.0.1:8080"
))
using
(
Session
session
=
networkComponent
.
Create
(
address
))
{
int
i
=
0
;
while
(
i
<
100000000
)
...
...
Server/Hotfix/Module/FrameSync/C2R_LoginHandler.cs
浏览文件 @
776db5ae
...
...
@@ -29,7 +29,7 @@ namespace ETHotfix
// 向gate请求一个key,客户端可以拿着这个key连接gate
G2R_GetLoginKey
g2RGetLoginKey
=
(
G2R_GetLoginKey
)
await
gateSession
.
Call
(
new
R2G_GetLoginKey
()
{
Account
=
message
.
Account
});
string
outerAddress
=
config
.
GetComponent
<
OuterConfig
>().
IPEndPoint2
.
ToString
()
;
string
outerAddress
=
config
.
GetComponent
<
OuterConfig
>().
Address2
;
response
.
Address
=
outerAddress
;
response
.
Key
=
g2RGetLoginKey
.
Key
;
...
...
Server/Hotfix/Module/Message/NetInnerComponentSystem.cs
浏览文件 @
776db5ae
...
...
@@ -13,9 +13,9 @@ namespace ETHotfix
}
[
ObjectSystem
]
public
class
NetInnerComponentAwake1System
:
AwakeSystem
<
NetInnerComponent
,
IPEndPoint
>
public
class
NetInnerComponentAwake1System
:
AwakeSystem
<
NetInnerComponent
,
string
>
{
public
override
void
Awake
(
NetInnerComponent
self
,
IPEndPoint
a
)
public
override
void
Awake
(
NetInnerComponent
self
,
string
a
)
{
self
.
Awake
(
a
);
}
...
...
@@ -40,9 +40,9 @@ namespace ETHotfix
self
.
AppType
=
StartConfigComponent
.
Instance
.
StartConfig
.
AppType
;
}
public
static
void
Awake
(
this
NetInnerComponent
self
,
IPEndPoint
ipEndPoint
)
public
static
void
Awake
(
this
NetInnerComponent
self
,
string
address
)
{
self
.
Awake
(
NetworkProtocol
.
TCP
,
ipEndPoint
);
self
.
Awake
(
NetworkProtocol
.
TCP
,
address
);
self
.
MessagePacker
=
new
MongoPacker
();
self
.
MessageDispatcher
=
new
InnerMessageDispatcher
();
self
.
AppType
=
StartConfigComponent
.
Instance
.
StartConfig
.
AppType
;
...
...
Server/Hotfix/Module/Message/NetOuterComponentSystem.cs
浏览文件 @
776db5ae
...
...
@@ -5,38 +5,27 @@ using ETModel;
namespace
ETHotfix
{
[
ObjectSystem
]
public
class
NetOuterComponentAwakeSystem
:
AwakeSystem
<
NetOuterComponent
>
public
class
NetOuterComponentAwakeSystem
:
AwakeSystem
<
NetOuterComponent
,
NetworkProtocol
>
{
public
override
void
Awake
(
NetOuterComponent
self
)
public
override
void
Awake
(
NetOuterComponent
self
,
NetworkProtocol
protocol
)
{
self
.
Awake
(
NetworkProtocol
.
WebSocket
);
self
.
Awake
(
protocol
);
self
.
MessagePacker
=
new
ProtobufPacker
();
self
.
MessageDispatcher
=
new
OuterMessageDispatcher
();
}
}
[
ObjectSystem
]
public
class
NetOuterComponentAwake1System
:
AwakeSystem
<
NetOuterComponent
,
IPEndPoint
>
public
class
NetOuterComponentAwake1System
:
AwakeSystem
<
NetOuterComponent
,
NetworkProtocol
,
string
>
{
public
override
void
Awake
(
NetOuterComponent
self
,
IPEndPoint
ipEndPoint
)
public
override
void
Awake
(
NetOuterComponent
self
,
NetworkProtocol
protocol
,
string
address
)
{
self
.
Awake
(
NetworkProtocol
.
TCP
,
ipEndPoint
);
self
.
Awake
(
protocol
,
address
);
self
.
MessagePacker
=
new
ProtobufPacker
();
self
.
MessageDispatcher
=
new
OuterMessageDispatcher
();
}
}
[
ObjectSystem
]
public
class
NetOuterComponentAwake2System
:
AwakeSystem
<
NetOuterComponent
,
List
<
string
>>
{
public
override
void
Awake
(
NetOuterComponent
self
,
List
<
string
>
prefixs
)
{
self
.
Awake
(
NetworkProtocol
.
WebSocket
,
prefixs
);
self
.
MessagePacker
=
new
ProtobufPacker
();
self
.
MessageDispatcher
=
new
OuterMessageDispatcher
();
}
}
[
ObjectSystem
]
public
class
NetOuterComponentUpdateSystem
:
UpdateSystem
<
NetOuterComponent
>
{
...
...
Server/Model/Other/Options.cs
浏览文件 @
776db5ae
...
...
@@ -15,5 +15,8 @@ namespace ETModel
[
Option
(
"config"
,
Required
=
false
,
Default
=
"../Config/StartConfig/LocalAllServer.txt"
)]
public
string
Config
{
get
;
set
;
}
[
Option
(
"protocol"
,
Required
=
false
,
Default
=
NetworkProtocol
.
TCP
)]
public
NetworkProtocol
Protocol
{
get
;
set
;
}
}
}
\ No newline at end of file
Unity/Assets/Editor/ServerCommandLineEditor/ServerCommandLineEditor.cs
浏览文件 @
776db5ae
...
...
@@ -179,46 +179,40 @@ namespace ETEditor
StartConfig
startConfig
=
this
.
startConfigs
[
i
];
GUILayout
.
BeginHorizontal
();
GUILayout
.
Label
(
$"AppId:"
);
startConfig
.
AppId
=
EditorGUILayout
.
IntField
(
startConfig
.
AppId
);
startConfig
.
AppId
=
EditorGUILayout
.
IntField
(
startConfig
.
AppId
,
GUILayout
.
Width
(
30
)
);
GUILayout
.
Label
(
$"服务器IP:"
);
startConfig
.
ServerIP
=
EditorGUILayout
.
TextField
(
startConfig
.
ServerIP
);
startConfig
.
ServerIP
=
EditorGUILayout
.
TextField
(
startConfig
.
ServerIP
,
GUILayout
.
Width
(
100
)
);
GUILayout
.
Label
(
$"AppType:"
);
startConfig
.
AppType
=
(
AppType
)
EditorGUILayout
.
EnumPopup
(
startConfig
.
AppType
);
InnerConfig
innerConfig
=
startConfig
.
GetComponent
<
InnerConfig
>();
if
(
innerConfig
!=
null
)
{
GUILayout
.
Label
(
$"InnerHost:"
);
innerConfig
.
Host
=
EditorGUILayout
.
TextField
(
innerConfig
.
Host
);
GUILayout
.
Label
(
$"InnerPort:"
);
innerConfig
.
Port
=
EditorGUILayout
.
IntField
(
innerConfig
.
Port
);
GUILayout
.
Label
(
$"Address:"
);
innerConfig
.
Address
=
EditorGUILayout
.
TextField
(
innerConfig
.
Address
,
GUILayout
.
Width
(
120
));
}
OuterConfig
outerConfig
=
startConfig
.
GetComponent
<
OuterConfig
>();
if
(
outerConfig
!=
null
)
{
GUILayout
.
Label
(
$"OuterHost:"
);
outerConfig
.
Host
=
EditorGUILayout
.
TextField
(
outerConfig
.
Host
);
GUILayout
.
Label
(
$"OuterHost2:"
);
outerConfig
.
Host2
=
EditorGUILayout
.
TextField
(
outerConfig
.
Host2
);
GUILayout
.
Label
(
$"OuterPort:"
);
outerConfig
.
Port
=
EditorGUILayout
.
IntField
(
outerConfig
.
Port
);
GUILayout
.
Label
(
$"Address:"
);
outerConfig
.
Address
=
EditorGUILayout
.
TextField
(
outerConfig
.
Address
,
GUILayout
.
Width
(
120
));
GUILayout
.
Label
(
$"Address2:"
);
outerConfig
.
Address2
=
EditorGUILayout
.
TextField
(
outerConfig
.
Address2
,
GUILayout
.
Width
(
120
));
}
ClientConfig
clientConfig
=
startConfig
.
GetComponent
<
ClientConfig
>();
if
(
clientConfig
!=
null
)
{
GUILayout
.
Label
(
$"Host:"
);
clientConfig
.
Host
=
EditorGUILayout
.
TextField
(
clientConfig
.
Host
);
GUILayout
.
Label
(
$"Port:"
);
clientConfig
.
Port
=
EditorGUILayout
.
IntField
(
clientConfig
.
Port
);
GUILayout
.
Label
(
$"Address:"
);
clientConfig
.
Address
=
EditorGUILayout
.
TextField
(
clientConfig
.
Address
,
GUILayout
.
Width
(
120
));
}
HttpConfig
httpConfig
=
startConfig
.
GetComponent
<
HttpConfig
>();
if
(
httpConfig
!=
null
)
{
GUILayout
.
Label
(
$"AppId:"
);
httpConfig
.
AppId
=
EditorGUILayout
.
IntField
(
httpConfig
.
AppId
);
httpConfig
.
AppId
=
EditorGUILayout
.
IntField
(
httpConfig
.
AppId
,
GUILayout
.
Width
(
20
)
);
GUILayout
.
Label
(
$"AppKey:"
);
httpConfig
.
AppKey
=
EditorGUILayout
.
TextField
(
httpConfig
.
AppKey
);
GUILayout
.
Label
(
$"Url:"
);
...
...
@@ -309,11 +303,6 @@ namespace ETEditor
newStartConfig
.
AddComponent
<
InnerConfig
>();
}
if
(
this
.
AppType
.
Is
(
AppType
.
Benchmark
))
{
newStartConfig
.
AddComponent
<
ClientConfig
>();
}
if
(
this
.
AppType
.
Is
(
AppType
.
Http
))
{
newStartConfig
.
AddComponent
<
HttpConfig
>();
...
...
@@ -323,6 +312,21 @@ namespace ETEditor
{
newStartConfig
.
AddComponent
<
DBConfig
>();
}
if
(
this
.
AppType
.
Is
(
AppType
.
Benchmark
))
{
newStartConfig
.
AddComponent
<
ClientConfig
>();
}
if
(
this
.
AppType
.
Is
(
AppType
.
BenchmarkWebsocketServer
))
{
newStartConfig
.
AddComponent
<
OuterConfig
>();
}
if
(
this
.
AppType
.
Is
(
AppType
.
BenchmarkWebsocketClient
))
{
newStartConfig
.
AddComponent
<
ClientConfig
>();
}
this
.
startConfigs
.
Add
(
newStartConfig
);
}
...
...
Unity/Assets/Scripts/Component/Config/ClientConfig.cs
浏览文件 @
776db5ae
...
...
@@ -5,26 +5,6 @@ namespace ETModel
{
public
class
ClientConfig
:
AConfigComponent
{
public
string
Host
=
""
;
public
int
Port
;
[
BsonIgnore
]
private
IPEndPoint
ipEndPoint
;
public
override
void
EndInit
()
{
base
.
EndInit
();
this
.
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
this
.
Host
,
this
.
Port
);
}
[
BsonIgnore
]
public
IPEndPoint
IPEndPoint
{
get
{
return
this
.
ipEndPoint
;
}
}
public
string
Address
{
get
;
set
;
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Component/Config/InnerConfig.cs
浏览文件 @
776db5ae
...
...
@@ -6,26 +6,14 @@ namespace ETModel
[
BsonIgnoreExtraElements
]
public
class
InnerConfig
:
AConfigComponent
{
public
string
Host
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
[
BsonIgnore
]
private
IPEndPoint
ipEndPoint
;
public
IPEndPoint
IPEndPoint
{
get
;
private
set
;
}
public
string
Address
{
get
;
set
;
}
public
override
void
EndInit
()
{
base
.
EndInit
();
this
.
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
this
.
Host
,
this
.
Port
);
}
[
BsonIgnore
]
public
IPEndPoint
IPEndPoint
{
get
{
return
this
.
ipEndPoint
;
}
this
.
IPEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
this
.
Address
);
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Component/Config/OuterConfig.cs
浏览文件 @
776db5ae
...
...
@@ -6,46 +6,7 @@ namespace ETModel
[
BsonIgnoreExtraElements
]
public
class
OuterConfig
:
AConfigComponent
{
public
string
Host
{
get
;
set
;
}
public
int
Port
{
get
;
set
;
}
public
string
Host2
{
get
;
set
;
}
[
BsonIgnore
]
private
IPEndPoint
ipEndPoint
;
[
BsonIgnore
]
private
IPEndPoint
ipEndPoint2
;
public
override
void
EndInit
()
{
base
.
EndInit
();
if
(
this
.
Host2
==
null
)
{
this
.
Host2
=
this
.
Host
;
}
this
.
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
this
.
Host
,
this
.
Port
);
this
.
ipEndPoint2
=
NetworkHelper
.
ToIPEndPoint
(
this
.
Host2
,
this
.
Port
);
}
[
BsonIgnore
]
public
IPEndPoint
IPEndPoint
{
get
{
return
this
.
ipEndPoint
;
}
}
[
BsonIgnore
]
public
IPEndPoint
IPEndPoint2
{
get
{
return
this
.
ipEndPoint2
;
}
}
public
string
Address
{
get
;
set
;
}
public
string
Address2
{
get
;
set
;
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Module/Message/NetworkComponent.cs
浏览文件 @
776db5ae
...
...
@@ -46,38 +46,28 @@ namespace ETModel
}
}
public
void
Awake
(
NetworkProtocol
protocol
,
IPEndPoint
ipEndPoint
)
public
void
Awake
(
NetworkProtocol
protocol
,
string
address
)
{
try
{
IPEndPoint
ipEndPoint
;
switch
(
protocol
)
{
case
NetworkProtocol
.
KCP
:
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
address
);
this
.
Service
=
new
KService
(
ipEndPoint
);
break
;
case
NetworkProtocol
.
TCP
:
ipEndPoint
=
NetworkHelper
.
ToIPEndPoint
(
address
);
this
.
Service
=
new
TService
(
ipEndPoint
);
break
;
default
:
throw
new
ArgumentOutOfRangeException
();
}
this
.
Service
.
AcceptCallback
+=
this
.
OnAccept
;
this
.
Start
();
}
catch
(
Exception
e
)
{
throw
new
Exception
(
$"
{
ipEndPoint
}
"
,
e
);
}
}
#if SERVER
public
void
Awake
(
NetworkProtocol
protocol
,
List
<
string
>
prefixs
)
{
try
{
this
.
Service
=
new
WService
(
prefixs
);
case
NetworkProtocol
.
WebSocket
:
string
[]
prefixs
=
address
.
Split
(
';'
);
this
.
Service
=
new
WService
(
prefixs
);
break
;
#endif
}
this
.
Service
.
AcceptCallback
+=
this
.
OnAccept
;
...
...
@@ -85,10 +75,9 @@ namespace ETModel
}
catch
(
Exception
e
)
{
throw
new
Exception
(
$"
websocket error:
{
prefix
s
}
"
,
e
);
throw
new
Exception
(
$"
NetworkComponent Awake Error
{
addres
s
}
"
,
e
);
}
}
#endif
public
void
Start
()
{
...
...
Unity/Assets/Scripts/Other/AppType.cs
浏览文件 @
776db5ae
...
...
@@ -15,12 +15,14 @@ namespace ETModel
Location
=
1
<<
5
,
Map
=
1
<<
6
,
BenchmarkWebsocketServer
=
1
<<
27
,
BenchmarkWebsocketClient
=
1
<<
28
,
Robot
=
1
<<
29
,
Benchmark
=
1
<<
30
,
Client
=
1
<<
31
,
// 7
AllServer
=
Manager
|
Realm
|
Gate
|
Http
|
DB
|
Location
|
Map
AllServer
=
Manager
|
Realm
|
Gate
|
Http
|
DB
|
Location
|
Map
|
BenchmarkWebsocketServer
}
public
static
class
AppTypeHelper
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录