Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
129aae93
E
et
项目概览
guo450212436
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
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 搜索 >>
提交
129aae93
编写于
9月 09, 2017
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
让Component的id不进行序列化
上级
26436533
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
119 addition
and
128 deletion
+119
-128
Config/StartConfig/127.0.0.1.txt
Config/StartConfig/127.0.0.1.txt
+8
-8
Config/StartConfig/192.168.12.112.txt
Config/StartConfig/192.168.12.112.txt
+6
-6
Config/StartConfig/192.168.9.182.txt
Config/StartConfig/192.168.9.182.txt
+6
-6
Config/StartConfig/LocalAllServer.txt
Config/StartConfig/LocalAllServer.txt
+1
-1
Server/Model/Entity/EntityDB.cs
Server/Model/Entity/EntityDB.cs
+3
-3
Server/Model/Entity/Http.cs
Server/Model/Entity/Http.cs
+2
-2
Server/Model/Entity/Location.cs
Server/Model/Entity/Location.cs
+1
-1
Server/Model/Server.Model.csproj
Server/Model/Server.Model.csproj
+1
-1
Unity/Assets/Scripts/Base/Object/Component.cs
Unity/Assets/Scripts/Base/Object/Component.cs
+7
-5
Unity/Assets/Scripts/Base/Object/Disposer.cs
Unity/Assets/Scripts/Base/Object/Disposer.cs
+5
-14
Unity/Assets/Scripts/Base/Object/Entity.cs
Unity/Assets/Scripts/Base/Object/Entity.cs
+13
-10
Unity/Assets/Scripts/Base/Object/Object.cs
Unity/Assets/Scripts/Base/Object/Object.cs
+2
-23
Unity/Hotfix/Base/Object/Component.cs
Unity/Hotfix/Base/Object/Component.cs
+16
-11
Unity/Hotfix/Base/Object/ComponentFactory.cs
Unity/Hotfix/Base/Object/ComponentFactory.cs
+4
-4
Unity/Hotfix/Base/Object/Disposer.cs
Unity/Hotfix/Base/Object/Disposer.cs
+6
-8
Unity/Hotfix/Base/Object/Entity.cs
Unity/Hotfix/Base/Object/Entity.cs
+34
-4
Unity/Hotfix/Base/Object/Object.cs
Unity/Hotfix/Base/Object/Object.cs
+2
-19
Unity/Hotfix/Component/UIComponent.cs
Unity/Hotfix/Component/UIComponent.cs
+1
-1
Unity/Hotfix/UI/UILogin/Component/UILoginComponent.cs
Unity/Hotfix/UI/UILogin/Component/UILoginComponent.cs
+1
-1
未找到文件。
Config/StartConfig/127.0.0.1.txt
浏览文件 @
129aae93
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10000, "Host2" : null }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565862653976"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("98565862653977"), "
Host" : "127.0.0.1", "Port" : 10001 }], "AppId" : 2, "AppType" : "Location", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20001 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10002, "Host2" : null }], "AppId" : 3, "AppType" : "Realm", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20002 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10003, "Host2" : null }], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20003 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10004, "Host2" : null }], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20004 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10005, "Host2" : null }], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "127.0.0.1", "Port" : 20005 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403")
, "Host" : "127.0.0.1", "Port" : 10006, "Host2" : null }], "AppId" : 7, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("98565723062317"), "
Host" : "127.0.0.1", "Port" : 20006 }], "AppId" : 8, "AppType" : "Map", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10000, "Host2" : null }], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565862653976"), "components" : [{ "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 10001 }], "AppId" : 2, "AppType" : "Location", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20001 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10002, "Host2" : null }], "AppId" : 3, "AppType" : "Realm", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20002 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10003, "Host2" : null }], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20003 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10004, "Host2" : null }], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20004 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10005, "Host2" : null }], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "127.0.0.1", "Port" : 20005 }, { "_t" : "OuterConfig"
, "Host" : "127.0.0.1", "Port" : 10006, "Host2" : null }], "AppId" : 7, "AppType" : "Gate", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98565723062316"), "components" : [{ "_t" : "InnerConfig", "Host" : "127.0.0.1", "Port" : 20006 }], "AppId" : 8, "AppType" : "Map", "ServerIP" : "*" }
Config/StartConfig/192.168.12.112.txt
浏览文件 @
129aae93
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20000 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10000
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20001 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10001
}], "AppId" : 2, "AppType" : "Realm", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20002 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10002
}], "AppId" : 3, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20003 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10003
}], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20004 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10004
}], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.12.112", "Port" : 20005 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.12.188", "Port" : 10005
}], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20000 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10000, "Host2" : null
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20001 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10001, "Host2" : null
}], "AppId" : 2, "AppType" : "Realm", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20002 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10002, "Host2" : null
}], "AppId" : 3, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20003 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10003, "Host2" : null
}], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20004 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10004, "Host2" : null
}], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.12.112", "Port" : 20005 }, { "_t" : "OuterConfig", "Host" : "192.168.12.188", "Port" : 10005, "Host2" : null
}], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "192.168.12.112" }
Config/StartConfig/192.168.9.182.txt
浏览文件 @
129aae93
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20000 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10000
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20001 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10001
}], "AppId" : 2, "AppType" : "Realm", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20002 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10002
}], "AppId" : 3, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20003 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10003
}], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20004 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10004
}], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
_id" : NumberLong("96832366182402"), "Host" : "192.168.9.182", "Port" : 20005 }, { "_t" : "OuterConfig", "_id" : NumberLong("96832366182403"), "Host" : "192.168.9.182", "Port" : 10005
}], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20000 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10000, "Host2" : null
}], "AppId" : 1, "AppType" : "Manager", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20001 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10001, "Host2" : null
}], "AppId" : 2, "AppType" : "Realm", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20002 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10002, "Host2" : null
}], "AppId" : 3, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20003 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10003, "Host2" : null
}], "AppId" : 4, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20004 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10004, "Host2" : null
}], "AppId" : 5, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
{ "_t" : "StartConfig", "_id" : NumberLong("96832366182401"), "components" : [{ "_t" : "InnerConfig", "
Host" : "192.168.9.182", "Port" : 20005 }, { "_t" : "OuterConfig", "Host" : "192.168.9.182", "Port" : 10005, "Host2" : null
}], "AppId" : 6, "AppType" : "Gate", "ServerIP" : "192.168.9.182" }
Config/StartConfig/LocalAllServer.txt
浏览文件 @
129aae93
{ "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "components" : [{ "_t" : "OuterConfig", "
_id" : NumberLong("98547768819755"), "Host" : "127.0.0.1", "Port" : 10002, "Host2" : null }, { "_t" : "InnerConfig", "_id" : NumberLong("98547768819756"), "Host" : "127.0.0.1", "Port" : 20000 }, { "_t" : "HttpConfig", "_id" : NumberLong("98547768819757"), "Url" : "", "AppId" : 0, "AppKey" : "", "ManagerSystemUrl" : "" }, { "_t" : "DBConfig", "_id" : NumberLong("98547768819758")
, "ConnectionString" : null, "DBName" : null }], "AppId" : 1, "AppType" : "AllServer", "ServerIP" : "*" }
{ "_t" : "StartConfig", "_id" : NumberLong("98547768819754"), "components" : [{ "_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" : "AllServer", "ServerIP" : "*" }
Server/Model/Entity/
DBEntity
.cs
→
Server/Model/Entity/
EntityDB
.cs
浏览文件 @
129aae93
...
...
@@ -6,13 +6,13 @@ namespace Model
[
BsonKnownTypes
(
typeof
(
RechargeRecord
))]
[
BsonKnownTypes
(
typeof
(
Recharge
))]
[
BsonKnownTypes
(
typeof
(
Location
))]
public
class
DBEntity
:
Entity
public
class
EntityDB
:
Entity
{
protected
DBEntity
()
protected
EntityDB
()
{
}
protected
DBEntity
(
long
id
):
base
(
id
)
protected
EntityDB
(
long
id
):
base
(
id
)
{
}
}
...
...
Server/Model/Entity/Http.cs
浏览文件 @
129aae93
namespace
Model
{
// 充值流水
public
sealed
class
RechargeRecord
:
DBEntity
public
sealed
class
RechargeRecord
:
EntityDB
{
// 充值玩家
public
int
PlayerNO
{
get
;
set
;
}
...
...
@@ -18,7 +18,7 @@
}
// 保存玩家充值记录, 每个玩家只有一条
public
sealed
class
Recharge
:
DBEntity
public
sealed
class
Recharge
:
EntityDB
{
public
int
CardNumber
{
get
;
set
;
}
...
...
Server/Model/Entity/Location.cs
浏览文件 @
129aae93
namespace
Model
{
public
class
Location
:
DBEntity
public
class
Location
:
EntityDB
{
public
string
Address
;
...
...
Server/Model/Server.Model.csproj
浏览文件 @
129aae93
...
...
@@ -178,7 +178,7 @@
<Compile
Include=
"Entity\Config\StartConfig.cs"
/>
<Compile
Include=
"Entity\ActorProxy.cs"
/>
<Compile
Include=
"Entity\SceneEntity.cs"
/>
<Compile
Include=
"Entity\
DBEntity
.cs"
/>
<Compile
Include=
"Entity\
EntityDB
.cs"
/>
<Compile
Include=
"Entity\DBTask.cs"
/>
<Compile
Include=
"Entity\DBTaskQueue.cs"
/>
<Compile
Include=
"Entity\Game.cs"
/>
...
...
Unity/Assets/Scripts/Base/Object/Component.cs
浏览文件 @
129aae93
...
...
@@ -2,9 +2,14 @@
namespace
Model
{
[
BsonIgnoreExtraElements
]
[
BsonKnownTypes
(
typeof
(
AConfigComponent
))]
public
abstract
class
Component
:
Disposer
{
[
BsonId
]
[
BsonIgnore
]
public
sealed
override
long
Id
{
get
;
set
;
}
[
BsonIgnore
]
public
Entity
Entity
{
get
;
set
;
}
...
...
@@ -15,12 +20,9 @@ namespace Model
protected
Component
()
{
this
.
Id
=
IdGenerater
.
GenerateId
();
}
protected
Component
(
long
id
):
base
(
id
)
{
}
public
T
GetComponent
<
T
>()
where
T
:
Component
{
return
this
.
Entity
.
GetComponent
<
T
>();
...
...
Unity/Assets/Scripts/Base/Object/Disposer.cs
浏览文件 @
129aae93
using
System
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Model
{
public
abstract
class
Disposer
:
Object
,
IDisposable
{
protected
Disposer
()
:
base
(
IdGenerater
.
GenerateId
())
{
ObjectEvents
.
Instance
.
Add
(
this
);
}
protected
Disposer
(
long
id
)
:
base
(
id
)
[
BsonIgnore
]
public
abstract
long
Id
{
get
;
set
;
}
protected
Disposer
()
{
ObjectEvents
.
Instance
.
Add
(
this
);
}
...
...
@@ -18,13 +17,5 @@ namespace Model
{
this
.
Id
=
0
;
}
public
override
void
BeginInit
()
{
}
public
override
void
EndInit
()
{
}
}
}
\ No newline at end of file
Unity/Assets/Scripts/Base/Object/Entity.cs
浏览文件 @
129aae93
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Model
{
public
class
Entity
:
Disposer
[
BsonIgnoreExtraElements
]
public
class
Entity
:
Disposer
,
ISupportInitialize
{
[
BsonId
]
[
BsonElement
(
Order
=
1
)]
public
sealed
override
long
Id
{
get
;
set
;
}
[
BsonIgnore
]
public
Entity
Parent
{
get
;
set
;
}
public
EntityType
Type
{
get
;
set
;
}
[
BsonElement
]
[
BsonIgnoreIfNull
]
private
HashSet
<
Component
>
components
=
new
HashSet
<
Component
>();
...
...
@@ -21,10 +25,12 @@ namespace Model
protected
Entity
()
{
this
.
Id
=
IdGenerater
.
GenerateId
();
}
protected
Entity
(
long
id
)
:
base
(
id
)
protected
Entity
(
long
id
)
{
this
.
Id
=
id
;
}
public
override
void
Dispose
()
...
...
@@ -186,17 +192,14 @@ namespace Model
return
this
.
componentDict
.
Values
.
ToArray
();
}
public
override
void
BeginInit
()
public
virtual
void
BeginInit
()
{
base
.
BeginInit
();
this
.
components
=
new
HashSet
<
Component
>();
this
.
componentDict
=
new
Dictionary
<
Type
,
Component
>();
}
public
override
void
EndInit
()
public
virtual
void
EndInit
()
{
base
.
EndInit
();
ObjectEvents
.
Instance
.
Add
(
this
);
if
(
this
.
components
!=
null
&&
this
.
components
.
Count
==
0
)
...
...
Unity/Assets/Scripts/Base/Object/Object.cs
浏览文件 @
129aae93
using
System.ComponentModel
;
namespace
Model
namespace
Model
{
public
abstract
class
Object
:
ISupportInitialize
public
abstract
class
Object
{
public
long
Id
{
get
;
set
;
}
protected
Object
()
{
Id
=
IdGenerater
.
GenerateId
();
}
protected
Object
(
long
id
)
{
this
.
Id
=
id
;
}
public
virtual
void
BeginInit
()
{
}
public
virtual
void
EndInit
()
{
}
}
}
\ No newline at end of file
Unity/Hotfix/Base/Object/Component.cs
浏览文件 @
129aae93
namespace
Hotfix
using
Model
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Hotfix
{
public
abstract
class
Component
:
Disposer
public
abstract
class
Component
:
Disposer
{
public
Entity
Owner
{
get
;
set
;
}
[
BsonId
]
[
BsonIgnore
]
public
sealed
override
long
Id
{
get
;
set
;
}
public
T
GetOwner
<
T
>()
where
T
:
Entity
{
return
this
.
Owner
as
T
;
}
[
BsonIgnore
]
public
Entity
Entity
{
get
;
set
;
}
p
rotected
Component
()
p
ublic
T
GetEntity
<
T
>()
where
T
:
Entity
{
return
this
.
Entity
as
T
;
}
protected
Component
(
long
id
):
base
(
id
)
protected
Component
()
{
this
.
Id
=
IdGenerater
.
GenerateId
();
}
public
T
GetComponent
<
T
>()
where
T
:
Component
{
return
this
.
Owner
.
GetComponent
<
T
>();
return
this
.
Entity
.
GetComponent
<
T
>();
}
public
override
void
Dispose
()
...
...
@@ -31,7 +36,7 @@
base
.
Dispose
();
this
.
Owner
.
RemoveComponent
(
this
.
GetType
());
this
.
Entity
?
.
RemoveComponent
(
this
.
GetType
());
}
}
}
\ No newline at end of file
Unity/Hotfix/Base/Object/ComponentFactory.cs
浏览文件 @
129aae93
...
...
@@ -7,7 +7,7 @@ namespace Hotfix
public
static
T
Create
<
T
>(
Entity
entity
)
where
T
:
Component
{
T
disposer
=
(
T
)
Activator
.
CreateInstance
(
typeof
(
T
));
disposer
.
Owner
=
entity
;
disposer
.
Entity
=
entity
;
ObjectEvents
.
Instance
.
Awake
(
disposer
);
return
disposer
;
}
...
...
@@ -15,7 +15,7 @@ namespace Hotfix
public
static
T
Create
<
T
,
A
>(
Entity
entity
,
A
a
)
where
T
:
Component
{
T
disposer
=
(
T
)
Activator
.
CreateInstance
(
typeof
(
T
));
disposer
.
Owner
=
entity
;
disposer
.
Entity
=
entity
;
ObjectEvents
.
Instance
.
Awake
(
disposer
,
a
);
return
disposer
;
}
...
...
@@ -23,7 +23,7 @@ namespace Hotfix
public
static
T
Create
<
T
,
A
,
B
>(
Entity
entity
,
A
a
,
B
b
)
where
T
:
Component
{
T
disposer
=
(
T
)
Activator
.
CreateInstance
(
typeof
(
T
));
disposer
.
Owner
=
entity
;
disposer
.
Entity
=
entity
;
ObjectEvents
.
Instance
.
Awake
(
disposer
,
a
,
b
);
return
disposer
;
}
...
...
@@ -31,7 +31,7 @@ namespace Hotfix
public
static
T
Create
<
T
,
A
,
B
,
C
>(
Entity
entity
,
A
a
,
B
b
,
C
c
)
where
T
:
Component
{
T
disposer
=
(
T
)
Activator
.
CreateInstance
(
typeof
(
T
));
disposer
.
Owner
=
entity
;
disposer
.
Entity
=
entity
;
ObjectEvents
.
Instance
.
Awake
(
disposer
,
a
,
b
,
c
);
return
disposer
;
}
...
...
Unity/Hotfix/Base/Object/Disposer.cs
浏览文件 @
129aae93
using
Mo
del
;
using
Mo
ngoDB.Bson.Serialization.Attributes
;
namespace
Hotfix
{
public
abstract
class
Disposer
:
Object
public
abstract
class
Disposer
:
Object
,
IDisposable2
{
protected
Disposer
():
base
(
IdGenerater
.
GenerateId
())
{
ObjectEvents
.
Instance
.
Add
(
this
);
}
[
BsonIgnore
]
public
abstract
long
Id
{
get
;
set
;
}
protected
Disposer
(
long
id
):
base
(
id
)
protected
Disposer
()
{
ObjectEvents
.
Instance
.
Add
(
this
);
}
public
override
void
Dispose
()
public
virtual
void
Dispose
()
{
this
.
Id
=
0
;
}
...
...
Unity/Hotfix/Base/Object/Entity.cs
浏览文件 @
129aae93
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Linq
;
using
Model
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Hotfix
{
public
class
Entity
:
Disposer
[
BsonIgnoreExtraElements
]
public
class
Entity
:
Disposer
,
ISupportInitialize
{
[
BsonId
]
[
BsonElement
(
Order
=
1
)]
public
sealed
override
long
Id
{
get
;
set
;
}
[
BsonIgnore
]
public
Entity
Parent
{
get
;
set
;
}
public
EntityType
Type
{
get
;
set
;
}
[
BsonElement
]
[
BsonIgnoreIfNull
]
private
HashSet
<
Component
>
components
=
new
HashSet
<
Component
>();
...
...
@@ -22,10 +26,12 @@ namespace Hotfix
protected
Entity
()
{
this
.
Id
=
IdGenerater
.
GenerateId
();
}
protected
Entity
(
long
id
)
:
base
(
id
)
protected
Entity
(
long
id
)
{
this
.
Id
=
id
;
}
public
override
void
Dispose
()
...
...
@@ -186,5 +192,29 @@ namespace Hotfix
{
return
this
.
componentDict
.
Values
.
ToArray
();
}
public
virtual
void
BeginInit
()
{
this
.
components
=
new
HashSet
<
Component
>();
this
.
componentDict
=
new
Dictionary
<
Type
,
Component
>();
}
public
virtual
void
EndInit
()
{
ObjectEvents
.
Instance
.
Add
(
this
);
if
(
this
.
components
!=
null
&&
this
.
components
.
Count
==
0
)
{
this
.
components
=
null
;
}
if
(
this
.
components
!=
null
)
{
foreach
(
Component
component
in
this
.
components
)
{
component
.
Entity
=
this
;
this
.
componentDict
.
Add
(
component
.
GetType
(),
component
);
}
}
}
}
}
\ No newline at end of file
Unity/Hotfix/Base/Object/Object.cs
浏览文件 @
129aae93
using
Model
;
namespace
Hotfix
namespace
Hotfix
{
public
interface
IDisposable2
{
void
Dispose
();
}
public
abstract
class
Object
:
IDisposable2
public
abstract
class
Object
{
public
long
Id
{
get
;
set
;
}
protected
Object
()
{
Id
=
IdGenerater
.
GenerateId
();
}
protected
Object
(
long
id
)
{
this
.
Id
=
id
;
}
public
virtual
void
Dispose
()
{
}
}
}
\ No newline at end of file
Unity/Hotfix/Component/UIComponent.cs
浏览文件 @
129aae93
...
...
@@ -91,7 +91,7 @@ namespace Hotfix
{
try
{
UI
ui
=
UiTypes
[
type
].
Create
(
GetOwner
<
Scene
>(),
type
,
Root
);
UI
ui
=
UiTypes
[
type
].
Create
(
this
.
GetEntity
<
Scene
>(),
type
,
Root
);
uis
.
Add
(
type
,
ui
);
// 设置canvas
...
...
Unity/Hotfix/UI/UILogin/Component/UILoginComponent.cs
浏览文件 @
129aae93
...
...
@@ -21,7 +21,7 @@ namespace Hotfix
public
void
Awake
()
{
ReferenceCollector
rc
=
this
.
Get
Owner
<
UI
>().
GameObject
.
GetComponent
<
ReferenceCollector
>();
ReferenceCollector
rc
=
this
.
Get
Entity
<
UI
>().
GameObject
.
GetComponent
<
ReferenceCollector
>();
loginBtn
=
rc
.
Get
<
GameObject
>(
"LoginBtn"
);
loginBtn
.
GetComponent
<
Button
>().
onClick
.
Add
(
OnLogin
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录