Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
miantiaochanchan
et
提交
c9e5a9b2
E
et
项目概览
miantiaochanchan
/
et
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
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 搜索 >>
提交
c9e5a9b2
编写于
3月 24, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
以后再也不需要手动添加BsonKnowType标签啦!
上级
d904f249
变更
14
隐藏空白更改
内联
并排
Showing
14 changed file
with
39 addition
and
115 deletion
+39
-115
Server/App/Program.cs
Server/App/Program.cs
+1
-2
Server/Model/Base/Helper/MongoHelper.cs
Server/Model/Base/Helper/MongoHelper.cs
+15
-1
Server/Model/Base/Object/ComponentAttribute.cs
Server/Model/Base/Object/ComponentAttribute.cs
+0
-12
Server/Model/Base/Object/ComponentWithIdAttribute.cs
Server/Model/Base/Object/ComponentWithIdAttribute.cs
+0
-9
Server/Model/Base/Object/EntityAttribute.cs
Server/Model/Base/Object/EntityAttribute.cs
+0
-11
Unity/Assets/Editor/Helper/MongoHelper.cs
Unity/Assets/Editor/Helper/MongoHelper.cs
+15
-1
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs
+0
-10
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs.meta
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs.meta
+0
-12
Unity/Assets/Scripts/Base/Object/ComponentWithIdAttribute.cs
Unity/Assets/Scripts/Base/Object/ComponentWithIdAttribute.cs
+0
-9
Unity/Assets/Scripts/Base/Object/ComponentWithIdAttribute.cs.meta
...sets/Scripts/Base/Object/ComponentWithIdAttribute.cs.meta
+0
-12
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs
+0
-8
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs.meta
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs.meta
+0
-12
Unity/Assets/Scripts/Module/Config/AConfigComponent.cs
Unity/Assets/Scripts/Module/Config/AConfigComponent.cs
+1
-9
Unity/Unity.csproj
Unity/Unity.csproj
+7
-7
未找到文件。
Server/App/Program.cs
浏览文件 @
c9e5a9b2
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
using
System.Net
;
using
System.Net
;
using
System.Threading
;
using
System.Threading
;
using
ETModel
;
using
ETModel
;
using
MongoDB.Bson.Serialization
;
using
NLog
;
using
NLog
;
namespace
App
namespace
App
...
@@ -13,8 +14,6 @@ namespace App
...
@@ -13,8 +14,6 @@ namespace App
// 异步方法全部会回掉到主线程
// 异步方法全部会回掉到主线程
OneThreadSynchronizationContext
contex
=
new
OneThreadSynchronizationContext
();
OneThreadSynchronizationContext
contex
=
new
OneThreadSynchronizationContext
();
SynchronizationContext
.
SetSynchronizationContext
(
contex
);
SynchronizationContext
.
SetSynchronizationContext
(
contex
);
MongoHelper
.
Init
();
try
try
{
{
...
...
Server/Model/Base/Helper/MongoHelper.cs
浏览文件 @
c9e5a9b2
using
System
;
using
System
;
using
System.IO
;
using
System.IO
;
using
System.Reflection
;
using
MongoDB.Bson
;
using
MongoDB.Bson
;
using
MongoDB.Bson.IO
;
using
MongoDB.Bson.IO
;
using
MongoDB.Bson.Serialization
;
using
MongoDB.Bson.Serialization
;
...
@@ -9,8 +10,21 @@ namespace ETModel
...
@@ -9,8 +10,21 @@ namespace ETModel
{
{
public
static
class
MongoHelper
public
static
class
MongoHelper
{
{
public
static
void
Init
()
static
MongoHelper
()
{
{
Type
bsonClassMap
=
typeof
(
BsonClassMap
);
MethodInfo
methodInfo
=
bsonClassMap
.
GetMethod
(
"RegisterClassMap"
,
new
Type
[]
{
});
Type
[]
types
=
typeof
(
Game
).
Assembly
.
GetTypes
();
foreach
(
Type
type
in
types
)
{
if
(!
type
.
IsSubclassOf
(
typeof
(
Component
)))
{
continue
;
}
methodInfo
.
MakeGenericMethod
(
type
).
Invoke
(
null
,
null
);
}
BsonSerializer
.
RegisterSerializer
(
new
EnumSerializer
<
NumericType
>(
BsonType
.
String
));
BsonSerializer
.
RegisterSerializer
(
new
EnumSerializer
<
NumericType
>(
BsonType
.
String
));
}
}
...
...
Server/Model/Base/Object/ComponentAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
[
BsonKnownTypes
(
typeof
(
AConfigComponent
))]
[
BsonKnownTypes
(
typeof
(
UnitGateComponent
))]
[
BsonKnownTypes
(
typeof
(
NumericComponent
))]
[
BsonKnownTypes
(
typeof
(
ComponentWithId
))]
public
partial
class
Component
{
}
}
\ No newline at end of file
Server/Model/Base/Object/ComponentWithIdAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
[
BsonKnownTypes
(
typeof
(
Entity
))]
public
partial
class
ComponentWithId
{
}
}
\ No newline at end of file
Server/Model/Base/Object/EntityAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
[
BsonKnownTypes
(
typeof
(
Location
))]
[
BsonKnownTypes
(
typeof
(
Recharge
))]
[
BsonKnownTypes
(
typeof
(
RechargeRecord
))]
public
partial
class
Entity
{
}
}
Unity/Assets/Editor/Helper/MongoHelper.cs
浏览文件 @
c9e5a9b2
...
@@ -5,13 +5,27 @@ using MongoDB.Bson.IO;
...
@@ -5,13 +5,27 @@ using MongoDB.Bson.IO;
using
MongoDB.Bson.Serialization
;
using
MongoDB.Bson.Serialization
;
using
MongoDB.Bson.Serialization.Serializers
;
using
MongoDB.Bson.Serialization.Serializers
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Reflection
;
namespace
ETModel
namespace
ETModel
{
{
public
static
class
MongoHelper
public
static
class
MongoHelper
{
{
public
static
void
Init
()
static
MongoHelper
()
{
{
Type
bsonClassMap
=
typeof
(
BsonClassMap
);
MethodInfo
methodInfo
=
bsonClassMap
.
GetMethod
(
"RegisterClassMap"
,
new
Type
[]
{
});
Type
[]
types
=
typeof
(
Game
).
Assembly
.
GetTypes
();
foreach
(
Type
type
in
types
)
{
if
(!
type
.
IsSubclassOf
(
typeof
(
Component
)))
{
continue
;
}
methodInfo
.
MakeGenericMethod
(
type
).
Invoke
(
null
,
null
);
}
BsonSerializer
.
RegisterSerializer
(
new
EnumSerializer
<
NumericType
>(
BsonType
.
String
));
BsonSerializer
.
RegisterSerializer
(
new
EnumSerializer
<
NumericType
>(
BsonType
.
String
));
}
}
...
...
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
[
BsonKnownTypes
(
typeof
(
AConfigComponent
))]
[
BsonKnownTypes
(
typeof
(
ComponentWithId
))]
public
partial
class
Component
{
}
}
\ No newline at end of file
Unity/Assets/Scripts/Base/Object/ComponentAttribute.cs.meta
已删除
100644 → 0
浏览文件 @
d904f249
fileFormatVersion: 2
guid: 7f862da8d48947748af29b67dcda2dd2
timeCreated: 1512358818
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Scripts/Base/Object/ComponentWithIdAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
[
BsonKnownTypes
(
typeof
(
Entity
))]
public
partial
class
ComponentWithId
{
}
}
\ No newline at end of file
Unity/Assets/Scripts/Base/Object/ComponentWithIdAttribute.cs.meta
已删除
100644 → 0
浏览文件 @
d904f249
fileFormatVersion: 2
guid: 580a3c3b48fdd5b438d5e185e407db41
timeCreated: 1521513816
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs
已删除
100644 → 0
浏览文件 @
d904f249
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
{
public
partial
class
Entity
{
}
}
Unity/Assets/Scripts/Base/Object/EntityAttribute.cs.meta
已删除
100644 → 0
浏览文件 @
d904f249
fileFormatVersion: 2
guid: cc5bfaad42962324d8fa891fea5efba7
timeCreated: 1512358818
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Unity/Assets/Scripts/Module/Config/AConfigComponent.cs
浏览文件 @
c9e5a9b2
using
MongoDB.Bson.Serialization.Attributes
;
namespace
ETModel
namespace
ETModel
{
{
/// <summary>
/// <summary>
/// 每个Config的基类
/// 每个Config的基类
/// </summary>
/// </summary>
[
BsonKnownTypes
(
typeof
(
ClientConfig
))]
[
BsonKnownTypes
(
typeof
(
InnerConfig
))]
[
BsonKnownTypes
(
typeof
(
OuterConfig
))]
[
BsonKnownTypes
(
typeof
(
HttpConfig
))]
[
BsonKnownTypes
(
typeof
(
DBConfig
))]
[
BsonKnownTypes
(
typeof
(
RunServerConfig
))]
public
abstract
class
AConfigComponent
:
Component
,
ISerializeToEntity
public
abstract
class
AConfigComponent
:
Component
,
ISerializeToEntity
{
{
}
}
...
...
Unity/Unity.csproj
浏览文件 @
c9e5a9b2
...
@@ -12,12 +12,15 @@
...
@@ -12,12 +12,15 @@
<ProjectTypeGuids>
{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<ProjectTypeGuids>
{E097FAD1-6243-4DAD-9C02-E9B9EFC3FFC1};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<TargetFrameworkIdentifier>
.NETFramework
</TargetFrameworkIdentifier>
<TargetFrameworkIdentifier>
.NETFramework
</TargetFrameworkIdentifier>
<TargetFrameworkVersion>
v4.6
</TargetFrameworkVersion>
<TargetFrameworkVersion>
v4.6
</TargetFrameworkVersion>
<TargetFrameworkProfile></TargetFrameworkProfile>
<TargetFrameworkProfile>
<CompilerResponseFile></CompilerResponseFile>
</TargetFrameworkProfile>
<CompilerResponseFile>
</CompilerResponseFile>
<UnityProjectType>
Game:1
</UnityProjectType>
<UnityProjectType>
Game:1
</UnityProjectType>
<UnityBuildTarget>
Android:13
</UnityBuildTarget>
<UnityBuildTarget>
Android:13
</UnityBuildTarget>
<UnityVersion>
2017.1.3p2
</UnityVersion>
<UnityVersion>
2017.1.3p2
</UnityVersion>
<RootNamespace></RootNamespace>
<RootNamespace>
</RootNamespace>
<LangVersion>
6
</LangVersion>
<LangVersion>
6
</LangVersion>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup>
<PropertyGroup>
...
@@ -146,12 +149,9 @@
...
@@ -146,12 +149,9 @@
<Compile
Include=
"Assets\Scripts\Base\Math\VRect.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Math\VRect.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\MultiMap.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\MultiMap.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\Component.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\Component.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentAttribute.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentFactory.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentFactory.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentWithId.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentWithId.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\ComponentWithIdAttribute.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\Entity.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\Entity.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EntityAttribute.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EntityEventAttribute.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EntityEventAttribute.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EntityType.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EntityType.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EventProxy.cs"
/>
<Compile
Include=
"Assets\Scripts\Base\Object\EventProxy.cs"
/>
...
@@ -774,4 +774,4 @@
...
@@ -774,4 +774,4 @@
</ItemGroup>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Target
Name=
"GenerateTargetFrameworkMonikerAttribute"
/>
<Target
Name=
"GenerateTargetFrameworkMonikerAttribute"
/>
</Project>
</Project>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录