Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
278f2769
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 搜索 >>
提交
278f2769
编写于
10月 24, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
之前以为mongo驱动反序列化会在另外的线程,测试发现还是会在主线程,所以InstanceId可以在Component构造函数中设置
上级
d0a53bbd
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
22 addition
and
40 deletion
+22
-40
Config/StartConfig/LocalAllServer.txt
Config/StartConfig/LocalAllServer.txt
+1
-1
Server/App/Program.cs
Server/App/Program.cs
+3
-3
Server/Model/Entity/Scene.cs
Server/Model/Entity/Scene.cs
+0
-2
Server/Model/Module/DB/DBComponent.cs
Server/Model/Module/DB/DBComponent.cs
+4
-4
Server/Model/Module/Demo/Unit.cs
Server/Model/Module/Demo/Unit.cs
+5
-0
Unity/Assets/Hotfix/Base/Object/Component.cs
Unity/Assets/Hotfix/Base/Object/Component.cs
+1
-1
Unity/Assets/Model/Base/Object/Component.cs
Unity/Assets/Model/Base/Object/Component.cs
+2
-2
Unity/Assets/Model/Entity/Scene.cs
Unity/Assets/Model/Entity/Scene.cs
+0
-2
Unity/Assets/Model/Module/AssetsBundle/ResourcesComponent.cs
Unity/Assets/Model/Module/AssetsBundle/ResourcesComponent.cs
+0
-2
Unity/Assets/Model/Module/Message/Network/KCP/KChannel.cs
Unity/Assets/Model/Module/Message/Network/KCP/KChannel.cs
+0
-2
Unity/Assets/Model/Module/Message/Network/KCP/KService.cs
Unity/Assets/Model/Module/Message/Network/KCP/KService.cs
+0
-4
Unity/Assets/Model/Module/Message/Network/TCP/TChannel.cs
Unity/Assets/Model/Module/Message/Network/TCP/TChannel.cs
+0
-2
Unity/Assets/Model/Module/Message/Network/TCP/TService.cs
Unity/Assets/Model/Module/Message/Network/TCP/TService.cs
+0
-2
Unity/Assets/Model/Module/Message/Network/WebSocket/WChannel.cs
...Assets/Model/Module/Message/Network/WebSocket/WChannel.cs
+0
-4
Unity/Assets/Model/Module/Message/Network/WebSocket/WService.cs
...Assets/Model/Module/Message/Network/WebSocket/WService.cs
+0
-3
Unity/Unity.sln
Unity/Unity.sln
+6
-6
未找到文件。
Config/StartConfig/LocalAllServer.txt
浏览文件 @
278f2769
{ "_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" : "*" }
{ "_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" :
"mongodb://172.16.100.40:27017/", "DBName" : "ET"
}], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }
Server/App/Program.cs
浏览文件 @
278f2769
...
...
@@ -85,9 +85,9 @@ namespace App
Game
.
Scene
.
AddComponent
<
ActorLocationSenderComponent
>();
Game
.
Scene
.
AddComponent
<
PlayerComponent
>();
Game
.
Scene
.
AddComponent
<
UnitComponent
>();
Game
.
Scene
.
AddComponent
<
DBComponent
>();
Game
.
Scene
.
AddComponent
<
DBProxyComponent
>();
Game
.
Scene
.
AddComponent
<
DBCacheComponent
>();
//
Game.Scene.AddComponent<DBComponent>();
//
Game.Scene.AddComponent<DBProxyComponent>();
//
Game.Scene.AddComponent<DBCacheComponent>();
Game
.
Scene
.
AddComponent
<
LocationComponent
>();
Game
.
Scene
.
AddComponent
<
ActorMessageDispatherComponent
>();
Game
.
Scene
.
AddComponent
<
NetInnerComponent
,
string
>(
innerConfig
.
Address
);
...
...
Server/Model/Entity/Scene.cs
浏览文件 @
278f2769
...
...
@@ -6,12 +6,10 @@
public
Scene
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
Scene
(
long
id
):
base
(
id
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
override
void
Dispose
()
...
...
Server/Model/Module/DB/DBComponent.cs
浏览文件 @
278f2769
...
...
@@ -21,10 +21,10 @@ namespace ETModel
public
void
Awake
()
{
//
DBConfig config = Game.Scene.GetComponent<StartConfigComponent>().StartConfig.GetComponent<DBConfig>();
//
string connectionString = config.ConnectionString;
//
mongoClient = new MongoClient(connectionString);
//
this.database = this.mongoClient.GetDatabase(config.DBName);
DBConfig
config
=
Game
.
Scene
.
GetComponent
<
StartConfigComponent
>().
StartConfig
.
GetComponent
<
DBConfig
>();
string
connectionString
=
config
.
ConnectionString
;
mongoClient
=
new
MongoClient
(
connectionString
);
this
.
database
=
this
.
mongoClient
.
GetDatabase
(
config
.
DBName
);
}
public
IMongoCollection
<
ComponentWithId
>
GetCollection
(
string
name
)
...
...
Server/Model/
Entity
/Unit.cs
→
Server/Model/
Module/Demo
/Unit.cs
浏览文件 @
278f2769
...
...
@@ -30,6 +30,11 @@ namespace ETModel
this
.
UnitType
=
unitType
;
}
public
override
void
EndDeSerialize
()
{
Game
.
EventSystem
.
Add
(
this
);
}
public
override
void
Dispose
()
{
if
(
this
.
IsDisposed
)
...
...
Unity/Assets/Hotfix/Base/Object/Component.cs
浏览文件 @
278f2769
...
...
@@ -6,7 +6,6 @@ namespace ETHotfix
[
BsonIgnoreExtraElements
]
public
abstract
class
Component
:
Object
,
IDisposable
,
IComponentSerialize
{
// 只有Game.EventSystem.Add方法中会设置该值,如果new出来的对象不想加入Game.EventSystem中,则需要自己在构造函数中设置
[
BsonIgnore
]
public
long
InstanceId
{
get
;
protected
set
;
}
...
...
@@ -62,6 +61,7 @@ namespace ETHotfix
protected
Component
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
virtual
void
Dispose
()
...
...
Unity/Assets/Model/Base/Object/Component.cs
浏览文件 @
278f2769
...
...
@@ -6,9 +6,8 @@ namespace ETModel
[
BsonIgnoreExtraElements
]
public
abstract
class
Component
:
Object
,
IDisposable
,
IComponentSerialize
{
// 只有Game.EventSystem.Add方法中会设置该值,如果new出来的对象不想加入Game.EventSystem中,则需要自己在构造函数中设置
[
BsonIgnore
]
public
long
InstanceId
{
get
;
pr
otected
set
;
}
public
long
InstanceId
{
get
;
pr
ivate
set
;
}
[
BsonIgnore
]
private
bool
isFromPool
;
...
...
@@ -62,6 +61,7 @@ namespace ETModel
protected
Component
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
virtual
void
Dispose
()
...
...
Unity/Assets/Model/Entity/Scene.cs
浏览文件 @
278f2769
...
...
@@ -19,12 +19,10 @@
public
Scene
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
Scene
(
long
id
):
base
(
id
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
override
void
Dispose
()
...
...
Unity/Assets/Model/Module/AssetsBundle/ResourcesComponent.cs
浏览文件 @
278f2769
...
...
@@ -33,8 +33,6 @@ namespace ETModel
public
ABInfo
(
string
name
,
AssetBundle
ab
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
Name
=
name
;
this
.
AssetBundle
=
ab
;
this
.
RefCount
=
1
;
...
...
Unity/Assets/Model/Module/Message/Network/KCP/KChannel.cs
浏览文件 @
278f2769
...
...
@@ -42,7 +42,6 @@ namespace ETModel
// accept
public
KChannel
(
uint
localConn
,
uint
remoteConn
,
Socket
socket
,
IPEndPoint
remoteEndPoint
,
KService
kService
)
:
base
(
kService
,
ChannelType
.
Accept
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
memoryStream
=
this
.
GetService
().
MemoryStreamManager
.
GetStream
(
"message"
,
ushort
.
MaxValue
);
this
.
LocalConn
=
localConn
;
...
...
@@ -69,7 +68,6 @@ namespace ETModel
// connect
public
KChannel
(
uint
localConn
,
Socket
socket
,
IPEndPoint
remoteEndPoint
,
KService
kService
)
:
base
(
kService
,
ChannelType
.
Connect
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
memoryStream
=
this
.
GetService
().
MemoryStreamManager
.
GetStream
(
"message"
,
ushort
.
MaxValue
);
this
.
LocalConn
=
localConn
;
...
...
Unity/Assets/Model/Module/Message/Network/KCP/KService.cs
浏览文件 @
278f2769
...
...
@@ -59,8 +59,6 @@ namespace ETModel
public
KService
(
IPEndPoint
ipEndPoint
,
Action
<
AChannel
>
acceptCallback
)
{
this
.
InstanceId
=
ETModel
.
IdGenerater
.
GenerateId
();
this
.
AcceptCallback
+=
acceptCallback
;
this
.
StartTime
=
TimeHelper
.
ClientNow
();
...
...
@@ -82,8 +80,6 @@ namespace ETModel
public
KService
()
{
this
.
InstanceId
=
ETModel
.
IdGenerater
.
GenerateId
();
this
.
StartTime
=
TimeHelper
.
ClientNow
();
this
.
TimeNow
=
(
uint
)(
TimeHelper
.
ClientNow
()
-
this
.
StartTime
);
this
.
socket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Dgram
,
ProtocolType
.
Udp
);
...
...
Unity/Assets/Model/Module/Message/Network/TCP/TChannel.cs
浏览文件 @
278f2769
...
...
@@ -34,7 +34,6 @@ namespace ETModel
public
TChannel
(
IPEndPoint
ipEndPoint
,
TService
service
):
base
(
service
,
ChannelType
.
Connect
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
memoryStream
=
this
.
GetService
().
MemoryStreamManager
.
GetStream
(
"message"
,
ushort
.
MaxValue
);
this
.
socket
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
...
...
@@ -51,7 +50,6 @@ namespace ETModel
public
TChannel
(
Socket
socket
,
TService
service
):
base
(
service
,
ChannelType
.
Accept
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
memoryStream
=
this
.
GetService
().
MemoryStreamManager
.
GetStream
(
"message"
,
ushort
.
MaxValue
);
this
.
socket
=
socket
;
...
...
Unity/Assets/Model/Module/Message/Network/TCP/TService.cs
浏览文件 @
278f2769
...
...
@@ -24,7 +24,6 @@ namespace ETModel
/// </summary>
public
TService
(
IPEndPoint
ipEndPoint
,
Action
<
AChannel
>
acceptCallback
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
AcceptCallback
+=
acceptCallback
;
this
.
acceptor
=
new
Socket
(
AddressFamily
.
InterNetwork
,
SocketType
.
Stream
,
ProtocolType
.
Tcp
);
...
...
@@ -39,7 +38,6 @@ namespace ETModel
public
TService
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
override
void
Dispose
()
...
...
Unity/Assets/Model/Module/Message/Network/WebSocket/WChannel.cs
浏览文件 @
278f2769
...
...
@@ -26,8 +26,6 @@ namespace ETModel
public
WChannel
(
HttpListenerWebSocketContext
webSocketContext
,
AService
service
):
base
(
service
,
ChannelType
.
Accept
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
WebSocketContext
=
webSocketContext
;
this
.
webSocket
=
webSocketContext
.
WebSocket
;
...
...
@@ -40,8 +38,6 @@ namespace ETModel
public
WChannel
(
WebSocket
webSocket
,
AService
service
):
base
(
service
,
ChannelType
.
Connect
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
webSocket
=
webSocket
;
this
.
memoryStream
=
this
.
GetService
().
MemoryStreamManager
.
GetStream
(
"message"
,
ushort
.
MaxValue
);
...
...
Unity/Assets/Model/Module/Message/Network/WebSocket/WService.cs
浏览文件 @
278f2769
...
...
@@ -16,8 +16,6 @@ namespace ETModel
public
WService
(
IEnumerable
<
string
>
prefixs
,
Action
<
AChannel
>
acceptCallback
)
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
this
.
AcceptCallback
+=
acceptCallback
;
this
.
httpListener
=
new
HttpListener
();
...
...
@@ -27,7 +25,6 @@ namespace ETModel
public
WService
()
{
this
.
InstanceId
=
IdGenerater
.
GenerateId
();
}
public
override
AChannel
GetChannel
(
long
id
)
...
...
Unity/Unity.sln
浏览文件 @
278f2769
...
...
@@ -4,10 +4,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Model", "Unity.Model.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.ThirdParty", "Unity.ThirdParty.csproj", "{E15BADD2-3A26-309A-AB0F-DC5B08044350}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Editor", "Unity.Editor.csproj", "{CD311104-1830-B119-81B6-5DBEE2467FFB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unity.Hotfix", "Unity.Hotfix.csproj", "{1066F652-6A89-D1C4-9881-1A19DF7AB80E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
...
...
@@ -22,14 +22,14 @@ Global
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E15BADD2-3A26-309A-AB0F-DC5B08044350}.Release|Any CPU.Build.0 = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.Build.0 = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CD311104-1830-B119-81B6-5DBEE2467FFB}.Release|Any CPU.Build.0 = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1066F652-6A89-D1C4-9881-1A19DF7AB80E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录