Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
69a8e2a3
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,发现更多精彩内容 >>
提交
69a8e2a3
编写于
10月 16, 2014
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
配置文件相关类调试OK,配置文件使用mongodb的json格式,既可作为文件存放也可放到mongodb数据库中,格式一致,非常方便使用
上级
53a7803a
变更
31
隐藏空白更改
内联
并排
Showing
31 changed file
with
204 addition
and
251 deletion
+204
-251
CSharp/CSharp.sln
CSharp/CSharp.sln
+0
-15
CSharp/Config/BuffConfig/1.json
CSharp/Config/BuffConfig/1.json
+6
-0
CSharp/Config/GlobalConfig/1.json
CSharp/Config/GlobalConfig/1.json
+2
-1
CSharp/Game/BehaviorTree/BehaviorTree.csproj
CSharp/Game/BehaviorTree/BehaviorTree.csproj
+4
-1
CSharp/Game/BehaviorTree/BehaviorTreeFactory.cs
CSharp/Game/BehaviorTree/BehaviorTreeFactory.cs
+1
-0
CSharp/Game/BehaviorTree/Node.cs
CSharp/Game/BehaviorTree/Node.cs
+1
-0
CSharp/Game/BehaviorTree/Not.cs
CSharp/Game/BehaviorTree/Not.cs
+3
-1
CSharp/Game/BehaviorTree/Selector.cs
CSharp/Game/BehaviorTree/Selector.cs
+3
-1
CSharp/Game/BehaviorTree/Sequence.cs
CSharp/Game/BehaviorTree/Sequence.cs
+3
-1
CSharp/Game/Model/Buff.cs
CSharp/Game/Model/Buff.cs
+14
-1
CSharp/Game/Model/BuffComponent.cs
CSharp/Game/Model/BuffComponent.cs
+19
-25
CSharp/Game/Model/BuffConfig.cs
CSharp/Game/Model/BuffConfig.cs
+24
-0
CSharp/Game/Model/GameObjectManager.cs
CSharp/Game/Model/GameObjectManager.cs
+8
-8
CSharp/Game/Model/GlobalConfig.cs
CSharp/Game/Model/GlobalConfig.cs
+3
-3
CSharp/Game/Model/Model.csproj
CSharp/Game/Model/Model.csproj
+4
-0
CSharp/Game/Model/NodeConfig.cs
CSharp/Game/Model/NodeConfig.cs
+2
-4
CSharp/Game/Model/World.cs
CSharp/Game/Model/World.cs
+2
-3
CSharp/Game/MongoDBTest/MongoDBTest.cs
CSharp/Game/MongoDBTest/MongoDBTest.cs
+2
-2
CSharp/Game/World/Properties/AssemblyInfo.cs
CSharp/Game/World/Properties/AssemblyInfo.cs
+0
-39
CSharp/Game/World/World.csproj
CSharp/Game/World/World.csproj
+0
-63
CSharp/Platform/Common/Base/Component.cs
CSharp/Platform/Common/Base/Component.cs
+4
-1
CSharp/Platform/Common/Base/Entity.cs
CSharp/Platform/Common/Base/Entity.cs
+17
-3
CSharp/Platform/Common/Base/Object.cs
CSharp/Platform/Common/Base/Object.cs
+4
-4
CSharp/Platform/Common/Common.csproj
CSharp/Platform/Common/Common.csproj
+1
-1
CSharp/Platform/Common/Config/ACategory.cs
CSharp/Platform/Common/Config/ACategory.cs
+11
-11
CSharp/Platform/Common/Config/AConfig.cs
CSharp/Platform/Common/Config/AConfig.cs
+19
-0
CSharp/Platform/Common/Config/ConfigManager.cs
CSharp/Platform/Common/Config/ConfigManager.cs
+41
-14
CSharp/Platform/Common/Config/ICategory.cs
CSharp/Platform/Common/Config/ICategory.cs
+3
-2
CSharp/Platform/Common/Config/IConfig.cs
CSharp/Platform/Common/Config/IConfig.cs
+0
-7
CSharp/Platform/ENetTest/ENetTest.csproj
CSharp/Platform/ENetTest/ENetTest.csproj
+3
-1
CSharp/Platform/ENetTest/Properties/AssemblyInfo.cs
CSharp/Platform/ENetTest/Properties/AssemblyInfo.cs
+0
-39
未找到文件。
CSharp/CSharp.sln
浏览文件 @
69a8e2a3
...
...
@@ -32,8 +32,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Game", "Game", "{D0CC1FF4-2
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BehaviorTree", "Game\BehaviorTree\BehaviorTree.csproj", "{C4E7A34A-095C-4983-AB63-FC2D20CD6824}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "World", "Game\World\World.csproj", "{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ENetExe", "Platform\ENetExe\ENetExe.csproj", "{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2814EB55-E1C2-4751-AC14-94116DA9D22B}"
...
...
@@ -140,18 +138,6 @@ Global
{C4E7A34A-095C-4983-AB63-FC2D20CD6824}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{C4E7A34A-095C-4983-AB63-FC2D20CD6824}.Release|Win32.ActiveCfg = Release|Any CPU
{C4E7A34A-095C-4983-AB63-FC2D20CD6824}.Release|x86.ActiveCfg = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|Win32.ActiveCfg = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Debug|x86.ActiveCfg = Debug|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|Any CPU.Build.0 = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|Win32.ActiveCfg = Release|Any CPU
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}.Release|x86.ActiveCfg = Release|Any CPU
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
...
...
@@ -260,7 +246,6 @@ Global
{D0B4CFAC-A368-4742-9863-68776CFA9938} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{901A8E5C-C4C6-4C3C-8E18-068D75119F5D} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{C4E7A34A-095C-4983-AB63-FC2D20CD6824} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0} = {D0CC1FF4-2747-4278-A51F-BE9AA959175B}
{CBA52DC8-1C80-4A79-9AC5-73514EBBD749} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{B42D431A-3A54-4649-942A-C5356D7F9FBC} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
{F176D1FA-63E5-4B89-9A03-D44CCCCC069A} = {ADBF5F67-B480-4A93-9D50-C81856FC61A9}
...
...
CSharp/Config/BuffConfig/1.json
0 → 100644
浏览文件 @
69a8e2a3
{
"_id"
:
1
,
"Type"
:
0
,
"Name"
:
"yun"
,
"Duration"
:
1500
,
}
\ No newline at end of file
CSharp/Config/GlobalConfig/1.json
浏览文件 @
69a8e2a3
{
{
"_id"
:
1
"Type"
:
1
}
\ No newline at end of file
CSharp/Game/BehaviorTree/BehaviorTree.csproj
浏览文件 @
69a8e2a3
...
...
@@ -46,7 +46,6 @@
<ItemGroup>
<Compile
Include=
"BehaviorTree.cs"
/>
<Compile
Include=
"BlackBoard.cs"
/>
<Compile
Include=
"NodeConfig.cs"
/>
<Compile
Include=
"Node.cs"
/>
<Compile
Include=
"BehaviorTreeFactory.cs"
/>
<Compile
Include=
"NodeAttribute.cs"
/>
...
...
@@ -60,6 +59,10 @@
<Project>
{19f8f043-1f99-4550-99df-dea5c7d77e55}
</Project>
<Name>
Common
</Name>
</ProjectReference>
<ProjectReference
Include=
"..\Model\Model.csproj"
>
<Project>
{0FA529D1-D0A9-4A8E-90F5-117CE80F2EDE}
</Project>
<Name>
Model
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None
Include=
"packages.config"
/>
...
...
CSharp/Game/BehaviorTree/BehaviorTreeFactory.cs
浏览文件 @
69a8e2a3
using
System
;
using
System.Collections.Generic
;
using
System.Reflection
;
using
Model
;
namespace
BehaviorTree
{
...
...
CSharp/Game/BehaviorTree/Node.cs
浏览文件 @
69a8e2a3
using
System.Collections.Generic
;
using
Model
;
namespace
BehaviorTree
{
...
...
CSharp/Game/BehaviorTree/Not.cs
浏览文件 @
69a8e2a3
namespace
BehaviorTree
using
Model
;
namespace
BehaviorTree
{
[
Node
(
NodeType
.
Not
)]
public
class
Not
:
Node
...
...
CSharp/Game/BehaviorTree/Selector.cs
浏览文件 @
69a8e2a3
namespace
BehaviorTree
using
Model
;
namespace
BehaviorTree
{
[
Node
(
NodeType
.
Selector
)]
public
class
Selector
:
Node
...
...
CSharp/Game/BehaviorTree/Sequence.cs
浏览文件 @
69a8e2a3
namespace
BehaviorTree
using
Model
;
namespace
BehaviorTree
{
[
Node
(
NodeType
.
Sequence
)]
internal
class
Sequence
:
Node
...
...
CSharp/Game/Model/Buff.cs
浏览文件 @
69a8e2a3
...
...
@@ -4,6 +4,19 @@ namespace Model
{
public
class
Buff
:
Object
{
public
BuffType
Type
{
get
;
set
;
}
private
int
ConfigId
{
get
;
set
;
}
public
Buff
(
int
configId
)
{
this
.
ConfigId
=
configId
;
}
public
BuffConfig
Config
{
get
{
return
World
.
Instance
.
ConfigManager
.
Get
<
BuffConfig
>(
this
.
ConfigId
);
}
}
}
}
\ No newline at end of file
CSharp/Game/Model/BuffComponent.cs
浏览文件 @
69a8e2a3
using
System.Collections.Generic
;
using
System
;
using
System.Collections.Generic
;
using
Common.Base
;
using
MongoDB.Bson
;
using
MongoDB.Bson.Serialization.Attributes
;
...
...
@@ -11,14 +12,14 @@ namespace Model
[
BsonElement
]
private
HashSet
<
Buff
>
Buffs
{
get
;
set
;
}
private
Dictionary
<
ObjectId
,
Buff
>
buff
Gui
dDict
{
get
;
set
;
}
private
Dictionary
<
ObjectId
,
Buff
>
buff
I
dDict
{
get
;
set
;
}
private
MultiMap
<
BuffType
,
Buff
>
buffTypeMMap
{
get
;
set
;
}
public
BuffComponent
()
{
this
.
Buffs
=
new
HashSet
<
Buff
>();
this
.
buff
Gui
dDict
=
new
Dictionary
<
ObjectId
,
Buff
>();
this
.
buff
I
dDict
=
new
Dictionary
<
ObjectId
,
Buff
>();
this
.
buffTypeMMap
=
new
MultiMap
<
BuffType
,
Buff
>();
}
...
...
@@ -26,43 +27,36 @@ namespace Model
{
foreach
(
var
buff
in
this
.
Buffs
)
{
this
.
buff
GuidDict
.
Add
(
buff
.
Gui
d
,
buff
);
this
.
buffTypeMMap
.
Add
(
buff
.
Type
,
buff
);
this
.
buff
IdDict
.
Add
(
buff
.
I
d
,
buff
);
this
.
buffTypeMMap
.
Add
(
buff
.
Config
.
Type
,
buff
);
}
}
public
bool
Add
(
Buff
buff
)
public
void
Add
(
Buff
buff
)
{
if
(
this
.
Buffs
.
Contains
(
buff
))
{
return
false
;
}
if
(
this
.
buffGuidDict
.
ContainsKey
(
buff
.
Guid
))
{
return
false
;
throw
new
ArgumentException
(
string
.
Format
(
"already exist same buff, Id: {0} ConfigId: {1}"
,
buff
.
Id
,
buff
.
Config
.
Id
));
}
if
(
this
.
buff
TypeMMap
.
GetOne
(
buff
.
Type
)
!=
null
)
if
(
this
.
buff
IdDict
.
ContainsKey
(
buff
.
Id
)
)
{
return
false
;
throw
new
ArgumentException
(
string
.
Format
(
"already exist same buff, Id: {0} ConfigId: {1}"
,
buff
.
Id
,
buff
.
Config
.
Id
))
;
}
this
.
Buffs
.
Add
(
buff
);
this
.
buffGuidDict
.
Add
(
buff
.
Guid
,
buff
);
this
.
buffTypeMMap
.
Add
(
buff
.
Type
,
buff
);
return
true
;
this
.
buffIdDict
.
Add
(
buff
.
Id
,
buff
);
this
.
buffTypeMMap
.
Add
(
buff
.
Config
.
Type
,
buff
);
}
public
Buff
GetBy
Guid
(
ObjectId
gu
id
)
public
Buff
GetBy
Id
(
ObjectId
id
)
{
if
(!
this
.
buff
GuidDict
.
ContainsKey
(
gu
id
))
if
(!
this
.
buff
IdDict
.
ContainsKey
(
id
))
{
return
null
;
}
return
this
.
buff
GuidDict
[
gu
id
];
return
this
.
buff
IdDict
[
id
];
}
public
Buff
GetOneByType
(
BuffType
type
)
...
...
@@ -83,15 +77,15 @@ namespace Model
}
this
.
Buffs
.
Remove
(
buff
);
this
.
buff
GuidDict
.
Remove
(
buff
.
Gui
d
);
this
.
buffTypeMMap
.
Remove
(
buff
.
Type
,
buff
);
this
.
buff
IdDict
.
Remove
(
buff
.
I
d
);
this
.
buffTypeMMap
.
Remove
(
buff
.
Config
.
Type
,
buff
);
return
true
;
}
public
bool
RemoveBy
Guid
(
ObjectId
gu
id
)
public
bool
RemoveBy
Id
(
ObjectId
id
)
{
Buff
buff
=
this
.
GetBy
Guid
(
gu
id
);
Buff
buff
=
this
.
GetBy
Id
(
id
);
return
this
.
Remove
(
buff
);
}
...
...
CSharp/Game/Model/BuffConfig.cs
0 → 100644
浏览文件 @
69a8e2a3
using
System.Collections.Generic
;
using
Common.Config
;
namespace
Model
{
public
class
BuffConfig
:
AConfig
{
public
BuffType
Type
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
public
long
Duration
{
get
;
set
;
}
public
int
MaxStack
{
get
;
set
;
}
public
List
<
int
>
Effects
{
get
;
set
;
}
public
BuffConfig
()
{
this
.
Effects
=
new
List
<
int
>();
}
}
[
Config
]
public
class
BuffCategory
:
ACategory
<
BuffConfig
>
{
}
}
CSharp/Game/Model/GameObjectManager.cs
浏览文件 @
69a8e2a3
...
...
@@ -15,18 +15,18 @@ namespace Model
public
void
Add
(
GameObject
gameObject
)
{
this
.
gameObjects
.
Add
(
gameObject
.
Gui
d
,
gameObject
);
this
.
gameObjects
.
Add
(
gameObject
.
I
d
,
gameObject
);
if
(!
this
.
typeGameObjects
.
ContainsKey
(
gameObject
.
Type
))
{
this
.
typeGameObjects
.
Add
(
gameObject
.
Type
,
new
Dictionary
<
ObjectId
,
GameObject
>());
}
this
.
typeGameObjects
[
gameObject
.
Type
].
Add
(
gameObject
.
Gui
d
,
gameObject
);
this
.
typeGameObjects
[
gameObject
.
Type
].
Add
(
gameObject
.
I
d
,
gameObject
);
}
public
GameObject
Get
(
ObjectId
gu
id
)
public
GameObject
Get
(
ObjectId
id
)
{
GameObject
gameObject
=
null
;
this
.
gameObjects
.
TryGetValue
(
gu
id
,
out
gameObject
);
this
.
gameObjects
.
TryGetValue
(
id
,
out
gameObject
);
return
gameObject
;
}
...
...
@@ -46,20 +46,20 @@ namespace Model
{
throw
new
ArgumentNullException
(
"gameObject"
);
}
if
(!
this
.
gameObjects
.
Remove
(
gameObject
.
Gui
d
))
if
(!
this
.
gameObjects
.
Remove
(
gameObject
.
I
d
))
{
return
false
;
}
if
(!
this
.
typeGameObjects
[
gameObject
.
Type
].
Remove
(
gameObject
.
Gui
d
))
if
(!
this
.
typeGameObjects
[
gameObject
.
Type
].
Remove
(
gameObject
.
I
d
))
{
return
false
;
}
return
true
;
}
public
bool
Remove
(
ObjectId
gu
id
)
public
bool
Remove
(
ObjectId
id
)
{
GameObject
gameObject
=
this
.
Get
(
gu
id
);
GameObject
gameObject
=
this
.
Get
(
id
);
if
(
gameObject
==
null
)
{
return
false
;
...
...
CSharp/Game/
World/Config
/GlobalConfig.cs
→
CSharp/Game/
Model
/GlobalConfig.cs
浏览文件 @
69a8e2a3
using
Common.Config
;
namespace
World.Config
namespace
Model
{
public
class
GlobalConfig
:
I
Config
public
class
GlobalConfig
:
A
Config
{
public
int
Id
{
get
;
set
;
}
public
int
Type
{
get
;
set
;
}
}
[
Config
]
...
...
CSharp/Game/Model/Model.csproj
浏览文件 @
69a8e2a3
...
...
@@ -47,9 +47,13 @@
<ItemGroup>
<Compile
Include=
"Buff.cs"
/>
<Compile
Include=
"BuffComponent.cs"
/>
<Compile
Include=
"BuffConfig.cs"
/>
<Compile
Include=
"BuffType.cs"
/>
<Compile
Include=
"GameObject.cs"
/>
<Compile
Include=
"GameObjectManager.cs"
/>
<Compile
Include=
"GlobalConfig.cs"
/>
<Compile
Include=
"NodeConfig.cs"
/>
<Compile
Include=
"World.cs"
/>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"Properties\"
/>
...
...
CSharp/Game/
BehaviorTree
/NodeConfig.cs
→
CSharp/Game/
Model
/NodeConfig.cs
浏览文件 @
69a8e2a3
...
...
@@ -2,12 +2,10 @@
using
Common.Config
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
BehaviorTree
namespace
Model
{
public
class
NodeConfig
:
I
Config
public
class
NodeConfig
:
A
Config
{
public
int
Id
{
get
;
set
;
}
[
BsonIgnoreIfNull
]
public
List
<
string
>
Args
{
get
;
set
;
}
...
...
CSharp/Game/
World
/World.cs
→
CSharp/Game/
Model
/World.cs
浏览文件 @
69a8e2a3
using
Common.Config
;
using
Model
;
namespace
World
namespace
Model
{
public
class
World
{
private
static
readonly
World
instance
=
new
World
();
private
readonly
ConfigManager
configManager
=
new
ConfigManager
()
;
private
readonly
ConfigManager
configManager
=
ConfigManager
.
Instance
;
private
readonly
GameObjectManager
gameObjectManager
=
new
GameObjectManager
();
...
...
CSharp/Game/MongoDBTest/MongoDBTest.cs
浏览文件 @
69a8e2a3
...
...
@@ -21,12 +21,12 @@ namespace MongoDBTest
var
collection
=
database
.
GetCollection
<
GameObject
>(
"GameObjects"
);
GameObject
player1
=
GameObjectFactory
.
CreatePlayer
();
player1
.
GetComponent
<
BuffComponent
>().
Add
(
new
Buff
());
player1
.
GetComponent
<
BuffComponent
>().
Add
(
new
Buff
(
1
));
player1
[
"hp"
]
=
10
;
collection
.
Insert
(
player1
);
var
query
=
Query
<
GameObject
>.
EQ
(
e
=>
e
.
Guid
,
player1
.
Gui
d
);
var
query
=
Query
<
GameObject
>.
EQ
(
e
=>
e
.
Id
,
player1
.
I
d
);
GameObject
player2
=
collection
.
FindOne
(
query
);
Console
.
WriteLine
(
MongoHelper
.
ToJson
(
player2
));
...
...
CSharp/Game/World/Properties/AssemblyInfo.cs
已删除
100644 → 0
浏览文件 @
53a7803a
using
System.Reflection
;
using
System.Runtime.InteropServices
;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[
assembly
:
AssemblyTitle
(
"Component"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"Component"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © 2013"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[
assembly
:
ComVisible
(
false
)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[
assembly
:
Guid
(
"55cc5b17-d8c8-4c34-922c-47afac13d174"
)]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
\ No newline at end of file
CSharp/Game/World/World.csproj
已删除
100644 → 0
浏览文件 @
53a7803a
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"12.0"
DefaultTargets=
"Build"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Import
Project=
"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition=
"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
/>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProjectGuid>
{CBEDBE33-A883-4BFA-AE0A-8B3573F09BD0}
</ProjectGuid>
<OutputType>
Library
</OutputType>
<AppDesignerFolder>
Properties
</AppDesignerFolder>
<RootNamespace>
World
</RootNamespace>
<AssemblyName>
World
</AssemblyName>
<TargetFrameworkVersion>
v4.5.1
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<SolutionDir
Condition=
"$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'"
>
..\..\
</SolutionDir>
<RestorePackages>
true
</RestorePackages>
<TargetFrameworkProfile
/>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
..\..\Bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
..\..\Bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"Config\GlobalConfig.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
<Compile
Include=
"World.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\..\Platform\Common\Common.csproj"
>
<Project>
{19f8f043-1f99-4550-99df-dea5c7d77e55}
</Project>
<Name>
Common
</Name>
</ProjectReference>
<ProjectReference
Include=
"..\Model\Model.csproj"
>
<Project>
{0fa529d1-d0a9-4a8e-90f5-117ce80f2ede}
</Project>
<Name>
Model
</Name>
</ProjectReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
<Import
Project=
"$(SolutionDir)\.nuget\NuGet.targets"
Condition=
"Exists('$(SolutionDir)\.nuget\NuGet.targets')"
/>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
\ No newline at end of file
CSharp/Platform/Common/Base/Component.cs
浏览文件 @
69a8e2a3
...
...
@@ -3,6 +3,9 @@ using MongoDB.Bson.Serialization.Attributes;
namespace
Common.Base
{
/// <summary>
/// Component的Id与Owner Entity Id一样
/// </summary>
public
abstract
class
Component
:
Object
,
ISupportInitialize
{
private
Entity
owner
;
...
...
@@ -17,7 +20,7 @@ namespace Common.Base
set
{
this
.
owner
=
value
;
this
.
Guid
=
this
.
owner
.
Gui
d
;
this
.
Id
=
this
.
owner
.
I
d
;
}
}
...
...
CSharp/Platform/Common/Base/Entity.cs
浏览文件 @
69a8e2a3
...
...
@@ -21,6 +21,12 @@ namespace Common.Base
public
void
AddComponent
<
T
>()
where
T
:
Component
,
new
()
{
if
(
this
.
ComponentDict
.
ContainsKey
(
typeof
(
T
)))
{
throw
new
Exception
(
string
.
Format
(
"AddComponent, component already exist, id: {0}, component: {1}"
,
this
.
Id
,
typeof
(
T
).
Name
));
}
T
t
=
new
T
{
Owner
=
this
};
this
.
Components
.
Add
(
t
);
this
.
ComponentDict
.
Add
(
typeof
(
T
),
t
);
...
...
@@ -29,7 +35,13 @@ namespace Common.Base
public
void
RemoveComponent
<
T
>()
where
T
:
Component
{
Component
t
;
this
.
ComponentDict
.
TryGetValue
(
typeof
(
T
),
out
t
);
if
(!
this
.
ComponentDict
.
TryGetValue
(
typeof
(
T
),
out
t
))
{
throw
new
Exception
(
string
.
Format
(
"RemoveComponent, component not exist, id: {0}, component: {1}"
,
this
.
Id
,
typeof
(
T
).
Name
));
}
this
.
Components
.
Remove
(
t
);
this
.
ComponentDict
.
Remove
(
typeof
(
T
));
}
...
...
@@ -39,7 +51,9 @@ namespace Common.Base
Component
t
;
if
(!
this
.
ComponentDict
.
TryGetValue
(
typeof
(
T
),
out
t
))
{
return
null
;
throw
new
Exception
(
string
.
Format
(
"GetComponent, component not exist, id: {0}, component: {1}"
,
this
.
Id
,
typeof
(
T
).
Name
));
}
return
(
T
)
t
;
}
...
...
@@ -57,8 +71,8 @@ namespace Common.Base
{
foreach
(
Component
component
in
this
.
Components
)
{
this
.
ComponentDict
.
Add
(
component
.
GetType
(),
component
);
component
.
Owner
=
this
;
this
.
ComponentDict
.
Add
(
component
.
GetType
(),
component
);
}
}
}
...
...
CSharp/Platform/Common/Base/Object.cs
浏览文件 @
69a8e2a3
...
...
@@ -7,7 +7,7 @@ namespace Common.Base
public
abstract
class
Object
{
[
BsonId
]
public
ObjectId
Gui
d
{
get
;
protected
set
;
}
public
ObjectId
I
d
{
get
;
protected
set
;
}
[
BsonElement
]
[
BsonIgnoreIfNull
]
...
...
@@ -15,12 +15,12 @@ namespace Common.Base
protected
Object
()
{
this
.
Gui
d
=
ObjectId
.
GenerateNewId
();
this
.
I
d
=
ObjectId
.
GenerateNewId
();
}
protected
Object
(
ObjectId
gu
id
)
protected
Object
(
ObjectId
id
)
{
this
.
Guid
=
gu
id
;
this
.
Id
=
id
;
}
public
object
this
[
string
key
]
...
...
CSharp/Platform/Common/Common.csproj
浏览文件 @
69a8e2a3
...
...
@@ -70,7 +70,7 @@
<Compile
Include=
"Config\ConfigAttribute.cs"
/>
<Compile
Include=
"Config\ACategory.cs"
/>
<Compile
Include=
"Config\ConfigManager.cs"
/>
<Compile
Include=
"Config\
I
Config.cs"
/>
<Compile
Include=
"Config\
A
Config.cs"
/>
<Compile
Include=
"Helper\BigIntegerHelper.cs"
/>
<Compile
Include=
"Helper\ByteHelper.cs"
/>
<Compile
Include=
"Helper\EnumHelper.cs"
/>
...
...
CSharp/Platform/Common/Config/ACategory.cs
浏览文件 @
69a8e2a3
...
...
@@ -6,13 +6,13 @@ using Common.Helper;
namespace
Common.Config
{
public
abstract
class
ACategory
<
T
>:
ICategory
where
T
:
I
Config
public
abstract
class
ACategory
<
T
>:
ICategory
where
T
:
A
Config
{
protected
readonly
Dictionary
<
int
,
T
>
dict
=
new
Dictionary
<
int
,
T
>();
public
void
BeginInit
()
public
v
irtual
v
oid
BeginInit
()
{
string
path
=
Path
.
Combine
(
@".
/Config/"
,
this
.
Name
);
string
path
=
Path
.
Combine
(
@".
./../Config/"
,
typeof
(
T
)
.
Name
);
if
(!
Directory
.
Exists
(
path
))
{
...
...
@@ -26,23 +26,23 @@ namespace Common.Config
}
}
public
void
EndInit
()
{
}
public
T
this
[
int
type
]
public
Type
ConfigType
{
get
{
return
t
his
.
dict
[
type
]
;
return
t
ypeof
(
T
)
;
}
}
public
string
Name
public
virtual
void
EndInit
()
{
}
public
T
this
[
int
type
]
{
get
{
return
t
ypeof
(
T
).
Name
;
return
t
his
.
dict
[
type
]
;
}
}
...
...
CSharp/Platform/Common/Config/AConfig.cs
0 → 100644
浏览文件 @
69a8e2a3
using
System.ComponentModel
;
using
MongoDB.Bson.Serialization.Attributes
;
namespace
Common.Config
{
public
abstract
class
AConfig
:
ISupportInitialize
{
[
BsonId
]
public
int
Id
{
get
;
set
;
}
public
virtual
void
BeginInit
()
{
}
public
virtual
void
EndInit
()
{
}
}
}
\ No newline at end of file
CSharp/Platform/Common/Config/ConfigManager.cs
浏览文件 @
69a8e2a3
using
System
;
using
System.Collections.Generic
;
using
System.Reflection
;
using
Common.Logger
;
namespace
Common.Config
{
public
class
ConfigManager
{
public
Dictionary
<
string
,
object
>
allConfig
;
private
static
ConfigManager
instance
=
new
ConfigManager
();
public
static
ConfigManager
Instance
{
get
{
return
instance
;
}
}
public
Dictionary
<
Type
,
ICategory
>
allConfig
;
private
ConfigManager
()
{
}
public
void
Load
(
Assembly
assembly
)
{
var
localAllConfig
=
new
Dictionary
<
string
,
object
>();
var
localAllConfig
=
new
Dictionary
<
Type
,
ICategory
>();
Type
[]
types
=
assembly
.
GetTypes
();
foreach
(
var
type
in
types
)
foreach
(
Type
type
in
types
)
{
object
[]
attrs
=
type
.
GetCustomAttributes
(
typeof
(
ConfigAttribute
),
false
);
Log
.
Debug
(
type
.
Name
);
if
(
attrs
.
Length
==
0
)
{
continue
;
...
...
@@ -25,34 +41,45 @@ namespace Common.Config
ICategory
iCategory
=
obj
as
ICategory
;
if
(
iCategory
==
null
)
{
throw
new
Exception
(
string
.
Format
(
"class: {0} not inherit from ACategory"
,
type
.
Name
));
throw
new
Exception
(
string
.
Format
(
"class: {0} not inherit from ACategory"
,
type
.
Name
));
}
iCategory
.
BeginInit
();
iCategory
.
EndInit
();
localAllConfig
[
type
.
Name
]
=
obj
;
localAllConfig
[
iCategory
.
ConfigType
]
=
iCategory
;
}
this
.
allConfig
=
localAllConfig
;
}
public
T
Get
<
T
>(
int
type
)
where
T
:
I
Config
public
T
Get
<
T
>(
int
id
)
where
T
:
A
Config
{
var
configCategory
=
(
ACategory
<
T
>)
this
.
allConfig
[
typeof
(
T
).
Name
];
return
configCategory
[
type
];
Type
type
=
typeof
(
T
);
ICategory
configCategory
;
if
(!
this
.
allConfig
.
TryGetValue
(
type
,
out
configCategory
))
{
throw
new
KeyNotFoundException
(
string
.
Format
(
"ConfigManager not found key: {0}"
,
type
.
FullName
));
}
return
((
ACategory
<
T
>)
configCategory
)[
id
];
}
public
T
[]
GetAll
<
T
>()
where
T
:
I
Config
public
T
[]
GetAll
<
T
>()
where
T
:
A
Config
{
var
configCategory
=
(
ACategory
<
T
>)
this
.
allConfig
[
typeof
(
T
).
Name
];
return
configCategory
.
GetAll
();
Type
type
=
typeof
(
T
);
ICategory
configCategory
;
if
(!
this
.
allConfig
.
TryGetValue
(
type
,
out
configCategory
))
{
throw
new
KeyNotFoundException
(
string
.
Format
(
"ConfigManager not found key: {0}"
,
type
.
FullName
));
}
return
((
ACategory
<
T
>)
configCategory
).
GetAll
();
}
public
T
GetCategory
<
T
>()
where
T
:
class
,
ICategory
,
new
()
{
T
t
=
new
T
();
object
category
;
bool
ret
=
this
.
allConfig
.
TryGetValue
(
t
.
Name
,
out
category
);
Type
type
=
t
.
ConfigType
;
ICategory
category
;
bool
ret
=
this
.
allConfig
.
TryGetValue
(
type
,
out
category
);
return
ret
?
(
T
)
category
:
null
;
}
}
...
...
CSharp/Platform/Common/Config/ICategory.cs
浏览文件 @
69a8e2a3
using
System.ComponentModel
;
using
System
;
using
System.ComponentModel
;
namespace
Common.Config
{
public
interface
ICategory
:
ISupportInitialize
{
string
Nam
e
{
get
;
}
Type
ConfigTyp
e
{
get
;
}
}
}
\ No newline at end of file
CSharp/Platform/Common/Config/IConfig.cs
已删除
100644 → 0
浏览文件 @
53a7803a
namespace
Common.Config
{
public
interface
IConfig
{
int
Id
{
get
;
}
}
}
\ No newline at end of file
CSharp/Platform/ENetTest/ENetTest.csproj
浏览文件 @
69a8e2a3
...
...
@@ -55,7 +55,6 @@
</Choose>
<ItemGroup>
<Compile
Include=
"ENetClientServerTest.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
/>
</ItemGroup>
<ItemGroup>
<ProjectReference
Include=
"..\Common\Common.csproj"
>
...
...
@@ -67,6 +66,9 @@
<Name>
ENet
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder
Include=
"Properties\"
/>
</ItemGroup>
<Choose>
<When
Condition=
"'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'"
>
<ItemGroup>
...
...
CSharp/Platform/ENetTest/Properties/AssemblyInfo.cs
已删除
100644 → 0
浏览文件 @
53a7803a
using
System.Reflection
;
using
System.Runtime.InteropServices
;
// 有关程序集的常规信息通过以下特性集
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[
assembly
:
AssemblyTitle
(
"ENetCSTest"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
"Microsoft"
)]
[
assembly
:
AssemblyProduct
(
"ENetCSTest"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © Microsoft 2012"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// 将 ComVisible 设置为 false 会使此程序集中的类型
// 对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型,
// 请将该类型上的 ComVisible 特性设置为 true。
[
assembly
:
ComVisible
(
false
)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[
assembly
:
Guid
(
"b52f4804-3f6e-4268-810a-08fe8ca12bd0"
)]
// 程序集的版本信息由以下四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录