Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老鱼er
et
提交
d5973987
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,发现更多精彩内容 >>
提交
d5973987
编写于
3月 26, 2015
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
事件分发增加了servertype配置,事件分发可以配置在不同的server中是否生效
上级
87bb8e01
变更
24
隐藏空白更改
内联
并排
Showing
24 changed file
with
936 addition
and
781 deletion
+936
-781
CSharp/CSharp.sln.DotSettings
CSharp/CSharp.sln.DotSettings
+859
-714
CSharp/Game/Controller/Controller.csproj
CSharp/Game/Controller/Controller.csproj
+3
-2
CSharp/Game/Controller/Event/AfterAddBuff.cs
CSharp/Game/Controller/Event/AfterAddBuff.cs
+1
-2
CSharp/Game/Controller/Event/BuffTimeoutAction.cs
CSharp/Game/Controller/Event/BuffTimeoutAction.cs
+2
-3
CSharp/Game/Controller/Event/MessageAction.cs
CSharp/Game/Controller/Event/MessageAction.cs
+1
-2
CSharp/Game/Controller/Message/CMsgLoginEvent.cs
CSharp/Game/Controller/Message/CMsgLoginEvent.cs
+1
-2
CSharp/Game/Model/AEventAttribute.cs
CSharp/Game/Model/AEventAttribute.cs
+31
-0
CSharp/Game/Model/Buff.cs
CSharp/Game/Model/Buff.cs
+2
-3
CSharp/Game/Model/Component/ActorComponent.cs
CSharp/Game/Model/Component/ActorComponent.cs
+0
-1
CSharp/Game/Model/Component/BuffComponent.cs
CSharp/Game/Model/Component/BuffComponent.cs
+0
-1
CSharp/Game/Model/Component/ConfigComponent.cs
CSharp/Game/Model/Component/ConfigComponent.cs
+1
-1
CSharp/Game/Model/Component/EventComponent.cs
CSharp/Game/Model/Component/EventComponent.cs
+15
-12
CSharp/Game/Model/Component/NetworkComponent.cs
CSharp/Game/Model/Component/NetworkComponent.cs
+2
-4
CSharp/Game/Model/Component/TimerComponent.cs
CSharp/Game/Model/Component/TimerComponent.cs
+4
-5
CSharp/Game/Model/ConfigAttribute.cs
CSharp/Game/Model/ConfigAttribute.cs
+1
-1
CSharp/Game/Model/Env.cs
CSharp/Game/Model/Env.cs
+1
-1
CSharp/Game/Model/EventAttribute.cs
CSharp/Game/Model/EventAttribute.cs
+1
-10
CSharp/Game/Model/EventType.cs
CSharp/Game/Model/EventType.cs
+2
-6
CSharp/Game/Model/IEventAsync.cs
CSharp/Game/Model/IEventAsync.cs
+1
-1
CSharp/Game/Model/IEventSync.cs
CSharp/Game/Model/IEventSync.cs
+1
-1
CSharp/Game/Model/MessageAttribute.cs
CSharp/Game/Model/MessageAttribute.cs
+3
-4
CSharp/Game/Model/Model.csproj
CSharp/Game/Model/Model.csproj
+4
-0
CSharp/Platform/Common/Common.csproj
CSharp/Platform/Common/Common.csproj
+0
-4
CSharp/Test/ModelTest/MongoDBTest.cs
CSharp/Test/ModelTest/MongoDBTest.cs
+0
-1
未找到文件。
CSharp/CSharp.sln.DotSettings
浏览文件 @
d5973987
因为 它太大了无法显示 source diff 。你可以改为
查看blob
。
CSharp/Game/Controller/Controller.csproj
浏览文件 @
d5973987
...
...
@@ -37,8 +37,8 @@
<Reference
Include=
"System.Core"
/>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"
Action
\BuffTimeoutAction.cs"
/>
<Compile
Include=
"
Action
\MessageAction.cs"
/>
<Compile
Include=
"
Event
\BuffTimeoutAction.cs"
/>
<Compile
Include=
"
Event
\MessageAction.cs"
/>
<Compile
Include=
"BehaviorTreeNode\Not.cs"
/>
<Compile
Include=
"BehaviorTreeNode\Selector.cs"
/>
<Compile
Include=
"BehaviorTreeNode\Sequence.cs"
/>
...
...
@@ -64,6 +64,7 @@
<Name>
Model
</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup
/>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.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.
...
...
CSharp/Game/Controller/Event/AfterAddBuff.cs
浏览文件 @
d5973987
using
Common.Event
;
using
Model
;
using
Model
;
namespace
Controller
{
...
...
CSharp/Game/Controller/
Action
/BuffTimeoutAction.cs
→
CSharp/Game/Controller/
Event
/BuffTimeoutAction.cs
浏览文件 @
d5973987
using
Common.Event
;
using
Model
;
using
Model
;
using
MongoDB.Bson
;
namespace
Controller
{
[
Action
(
Action
Type
.
BuffTimeoutAction
)]
[
Event
(
Event
Type
.
BuffTimeoutAction
)]
public
class
BuffTimeoutAction
:
IEventSync
{
public
void
Run
(
Env
env
)
...
...
CSharp/Game/Controller/
Action
/MessageAction.cs
→
CSharp/Game/Controller/
Event
/MessageAction.cs
浏览文件 @
d5973987
using
System
;
using
System.Threading.Tasks
;
using
Common.Event
;
using
Common.Network
;
using
Model
;
namespace
Controller
{
[
Action
(
Action
Type
.
MessageAction
)]
[
Event
(
Event
Type
.
MessageAction
)]
public
class
MessageAction
:
IEventAsync
{
public
async
Task
RunAsync
(
Env
env
)
...
...
CSharp/Game/Controller/Message/CMsgLoginEvent.cs
浏览文件 @
d5973987
using
Common.Event
;
using
Common.Helper
;
using
Common.Helper
;
using
Model
;
using
Common.Network
;
...
...
CSharp/
Platform/Common/Event
/AEventAttribute.cs
→
CSharp/
Game/Model
/AEventAttribute.cs
浏览文件 @
d5973987
using
System
;
namespace
Common.Event
namespace
Model
{
[
AttributeUsage
(
AttributeTargets
.
Class
)]
public
abstract
class
AEventAttribute
:
Attribute
{
public
int
Type
{
get
;
private
set
;
}
protected
AEventAttribute
(
int
type
)
private
int
ServerType
{
get
;
set
;
}
protected
AEventAttribute
(
int
type
,
params
ServerType
[]
serverTypes
)
{
this
.
Type
=
type
;
foreach
(
ServerType
serverType
in
serverTypes
)
{
this
.
ServerType
|=
(
int
)
serverType
;
}
}
public
bool
Contains
(
ServerType
serverType
)
{
if
((
this
.
ServerType
&
(
int
)
serverType
)
==
0
)
{
return
false
;
}
return
true
;
}
}
}
\ No newline at end of file
CSharp/Game/Model/Buff.cs
浏览文件 @
d5973987
using
System
;
using
Common.Base
;
using
Common.Event
;
using
Common.Helper
;
using
MongoDB.Bson
;
using
MongoDB.Bson.Serialization.Attributes
;
...
...
@@ -63,7 +62,7 @@ namespace Model
env
[
EnvKey
.
OwnerId
]
=
this
.
OwnerId
;
env
[
EnvKey
.
BuffId
]
=
this
.
Id
;
this
.
TimerId
=
World
.
Instance
.
GetComponent
<
TimerComponent
>()
.
Add
(
this
.
Expiration
,
Action
Type
.
BuffTimeoutAction
,
env
);
.
Add
(
this
.
Expiration
,
Event
Type
.
BuffTimeoutAction
,
env
);
}
}
...
...
@@ -101,7 +100,7 @@ namespace Model
env
[
EnvKey
.
OwnerId
]
=
this
.
OwnerId
;
env
[
EnvKey
.
BuffId
]
=
this
.
Id
;
this
.
TimerId
=
World
.
Instance
.
GetComponent
<
TimerComponent
>()
.
Add
(
this
.
Expiration
,
Action
Type
.
BuffTimeoutAction
,
env
);
.
Add
(
this
.
Expiration
,
Event
Type
.
BuffTimeoutAction
,
env
);
}
}
...
...
CSharp/Game/Model/Component/ActorComponent.cs
浏览文件 @
d5973987
...
...
@@ -2,7 +2,6 @@
using
System.Collections.Generic
;
using
System.Threading.Tasks
;
using
Common.Base
;
using
Common.Event
;
using
Common.Logger
;
namespace
Model
...
...
CSharp/Game/Model/Component/BuffComponent.cs
浏览文件 @
d5973987
using
System
;
using
System.Collections.Generic
;
using
Common.Base
;
using
Common.Event
;
using
MongoDB.Bson
;
using
MongoDB.Bson.Serialization.Attributes
;
...
...
CSharp/Game/Model/Component/ConfigComponent.cs
浏览文件 @
d5973987
...
...
@@ -24,7 +24,7 @@ namespace Model
continue
;
}
ConfigAttribute
configAttribute
=
(
ConfigAttribute
)
attrs
[
0
];
if
(!
configAttribute
.
Contain
(
serverType
))
if
(!
configAttribute
.
Contain
s
(
serverType
))
{
continue
;
}
...
...
CSharp/Game/Model/Component/EventComponent.cs
浏览文件 @
d5973987
...
...
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using
System.Reflection
;
using
System.Threading.Tasks
;
using
Common.Base
;
using
Common.Event
;
namespace
Model
{
...
...
@@ -11,7 +10,6 @@ namespace Model
where
AttributeType
:
AEventAttribute
{
private
Dictionary
<
int
,
List
<
IEventSync
>>
eventSyncs
;
private
Dictionary
<
int
,
List
<
IEventAsync
>>
eventAsyncs
;
public
void
Load
(
Assembly
assembly
)
...
...
@@ -19,6 +17,8 @@ namespace Model
this
.
eventSyncs
=
new
Dictionary
<
int
,
List
<
IEventSync
>>();
this
.
eventAsyncs
=
new
Dictionary
<
int
,
List
<
IEventAsync
>>();
ServerType
serverType
=
World
.
Instance
.
Options
.
ServerType
;
Type
[]
types
=
assembly
.
GetTypes
();
foreach
(
Type
t
in
types
)
{
...
...
@@ -27,17 +27,22 @@ namespace Model
{
continue
;
}
AEventAttribute
aEventAttribute
=
(
AEventAttribute
)
attrs
[
0
];
if
(!
aEventAttribute
.
Contains
(
serverType
))
{
continue
;
}
object
obj
=
Activator
.
CreateInstance
(
t
);
IEventSync
iEventSync
=
obj
as
IEventSync
;
if
(
iEventSync
!=
null
)
{
AEventAttribute
iEventAttribute
=
(
AEventAttribute
)
attrs
[
0
];
if
(!
this
.
eventSyncs
.
ContainsKey
(
iEventAttribute
.
Type
))
if
(!
this
.
eventSyncs
.
ContainsKey
(
aEventAttribute
.
Type
))
{
this
.
eventSyncs
.
Add
(
i
EventAttribute
.
Type
,
new
List
<
IEventSync
>());
this
.
eventSyncs
.
Add
(
a
EventAttribute
.
Type
,
new
List
<
IEventSync
>());
}
this
.
eventSyncs
[
i
EventAttribute
.
Type
].
Add
(
iEventSync
);
this
.
eventSyncs
[
a
EventAttribute
.
Type
].
Add
(
iEventSync
);
continue
;
}
...
...
@@ -45,13 +50,11 @@ namespace Model
// ReSharper disable once InvertIf
if
(
iEventAsync
!=
null
)
{
AEventAttribute
iEventAttribute
=
(
AEventAttribute
)
attrs
[
0
];
if
(!
this
.
eventAsyncs
.
ContainsKey
(
iEventAttribute
.
Type
))
if
(!
this
.
eventAsyncs
.
ContainsKey
(
aEventAttribute
.
Type
))
{
this
.
eventAsyncs
.
Add
(
i
EventAttribute
.
Type
,
new
List
<
IEventAsync
>());
this
.
eventAsyncs
.
Add
(
a
EventAttribute
.
Type
,
new
List
<
IEventAsync
>());
}
this
.
eventAsyncs
[
i
EventAttribute
.
Type
].
Add
(
iEventAsync
);
this
.
eventAsyncs
[
a
EventAttribute
.
Type
].
Add
(
iEventAsync
);
continue
;
}
...
...
CSharp/Game/Model/Component/NetworkComponent.cs
浏览文件 @
d5973987
using
System
;
using
System.Reflection
;
using
Common.Base
;
using
Common.Event
;
using
Common.Network
;
using
TNet
;
using
UNet
;
...
...
@@ -64,8 +62,8 @@ namespace Model
env
[
EnvKey
.
Channel
]
=
channel
;
env
[
EnvKey
.
Message
]
=
message
;
#pragma warning disable 4014
World
.
Instance
.
GetComponent
<
EventComponent
<
Action
Attribute
>>()
.
RunAsync
(
Action
Type
.
MessageAction
,
env
);
World
.
Instance
.
GetComponent
<
EventComponent
<
Event
Attribute
>>()
.
RunAsync
(
Event
Type
.
MessageAction
,
env
);
#pragma warning restore 4014
}
}
...
...
CSharp/Game/Model/Component/TimerComponent.cs
浏览文件 @
d5973987
using
System.Collections.Generic
;
using
Common.Base
;
using
Common.Event
;
using
Common.Helper
;
using
MongoDB.Bson
;
...
...
@@ -58,12 +57,12 @@ namespace Model
{
break
;
}
timeoutTimer
.
Enqueue
(
time
);
t
his
.
t
imeoutTimer
.
Enqueue
(
time
);
}
while
(
timeoutTimer
.
Count
>
0
)
while
(
t
his
.
t
imeoutTimer
.
Count
>
0
)
{
long
key
=
timeoutTimer
.
Dequeue
();
long
key
=
t
his
.
t
imeoutTimer
.
Dequeue
();
List
<
ObjectId
>
timeOutId
=
this
.
timeId
[
key
];
foreach
(
ObjectId
id
in
timeOutId
)
{
...
...
@@ -73,7 +72,7 @@ namespace Model
continue
;
}
this
.
Remove
(
id
);
World
.
Instance
.
GetComponent
<
EventComponent
<
Action
Attribute
>>()
World
.
Instance
.
GetComponent
<
EventComponent
<
Event
Attribute
>>()
.
Run
(
timer
.
CallbackId
,
timer
.
Env
);
}
}
...
...
CSharp/Game/Model/ConfigAttribute.cs
浏览文件 @
d5973987
...
...
@@ -15,7 +15,7 @@ namespace Model
}
}
public
bool
Contain
(
ServerType
serverType
)
public
bool
Contain
s
(
ServerType
serverType
)
{
if
((
this
.
ServerType
&
(
int
)
serverType
)
==
0
)
{
...
...
CSharp/
Platform/Common/Event
/Env.cs
→
CSharp/
Game/Model
/Env.cs
浏览文件 @
d5973987
using
Common.Base
;
namespace
Common.Event
namespace
Model
{
public
class
Env
:
Object
{
...
...
CSharp/Game/Model/EventAttribute.cs
浏览文件 @
d5973987
using
Common.Event
;
namespace
Model
namespace
Model
{
public
class
EventAttribute
:
AEventAttribute
{
...
...
@@ -8,11 +6,4 @@ namespace Model
{
}
}
public
class
ActionAttribute
:
AEventAttribute
{
public
ActionAttribute
(
int
type
):
base
(
type
)
{
}
}
}
\ No newline at end of file
CSharp/Game/Model/EventType.cs
浏览文件 @
d5973987
...
...
@@ -6,11 +6,7 @@
public
const
int
AfterAddBuff
=
1
;
public
const
int
BeforeRemoveBuff
=
2
;
public
const
int
AfterRemoveBuff
=
3
;
}
public
static
class
ActionType
{
public
const
int
BuffTimeoutAction
=
0
;
public
const
int
MessageAction
=
1
;
public
const
int
BuffTimeoutAction
=
4
;
public
const
int
MessageAction
=
5
;
}
}
\ No newline at end of file
CSharp/
Platform/Common/Event
/IEventAsync.cs
→
CSharp/
Game/Model
/IEventAsync.cs
浏览文件 @
d5973987
using
System.Threading.Tasks
;
namespace
Common.Event
namespace
Model
{
public
interface
IEventAsync
{
...
...
CSharp/
Platform/Common/Event
/IEventSync.cs
→
CSharp/
Game/Model
/IEventSync.cs
浏览文件 @
d5973987
namespace
Common.Event
namespace
Model
{
public
interface
IEventSync
{
...
...
CSharp/Game/Model/MessageAttribute.cs
浏览文件 @
d5973987
using
Common.Event
;
namespace
Model
namespace
Model
{
/// <summary>
/// 搭配EventComponent用来分发消息
/// </summary>
public
class
MessageAttribute
:
AEventAttribute
{
public
MessageAttribute
(
int
type
):
base
(
type
)
public
MessageAttribute
(
int
type
,
params
ServerType
[]
serverTypes
)
:
base
(
type
,
serverTypes
)
{
}
}
...
...
CSharp/Game/Model/Model.csproj
浏览文件 @
d5973987
...
...
@@ -45,6 +45,7 @@
<ItemGroup>
<Compile
Include=
"ACategory.cs"
/>
<Compile
Include=
"AConfig.cs"
/>
<Compile
Include=
"AEventAttribute.cs"
/>
<Compile
Include=
"BehaviorTree\BehaviorTree.cs"
/>
<Compile
Include=
"BehaviorTree\BehaviorTreeFactory.cs"
/>
<Compile
Include=
"BehaviorTree\BlackBoard.cs"
/>
...
...
@@ -68,6 +69,7 @@
<Compile
Include=
"Config\NodeConfig.cs"
/>
<Compile
Include=
"Config\ServerInfoConfig.cs"
/>
<Compile
Include=
"Config\UnitConfig.cs"
/>
<Compile
Include=
"Env.cs"
/>
<Compile
Include=
"EnvKey.cs"
/>
<Compile
Include=
"EventAttribute.cs"
/>
<Compile
Include=
"EventType.cs"
/>
...
...
@@ -75,6 +77,8 @@
<Compile
Include=
"IAssemblyLoader.cs"
/>
<Compile
Include=
"ICategory.cs"
/>
<Compile
Include=
"IConfigLoader.cs"
/>
<Compile
Include=
"IEventAsync.cs"
/>
<Compile
Include=
"IEventSync.cs"
/>
<Compile
Include=
"IFactory.cs"
/>
<Compile
Include=
"IStart.cs"
/>
<Compile
Include=
"IUpdate.cs"
/>
...
...
CSharp/Platform/Common/Common.csproj
浏览文件 @
d5973987
...
...
@@ -54,10 +54,6 @@
<Compile
Include=
"Base\Object.cs"
/>
<Compile
Include=
"Base\QueueDictionary.cs"
/>
<Compile
Include=
"Base\TimerManager.cs"
/>
<Compile
Include=
"Event\AEventAttribute.cs"
/>
<Compile
Include=
"Event\Env.cs"
/>
<Compile
Include=
"Event\IEventAsync.cs"
/>
<Compile
Include=
"Event\IEventSync.cs"
/>
<Compile
Include=
"Helper\BigIntegerHelper.cs"
/>
<Compile
Include=
"Helper\ByteHelper.cs"
/>
<Compile
Include=
"Helper\EnumHelper.cs"
/>
...
...
CSharp/Test/ModelTest/MongoDBTest.cs
浏览文件 @
d5973987
...
...
@@ -23,7 +23,6 @@ namespace MongoDBTest
// 加载配置
world
.
AddComponent
<
ConfigComponent
>();
world
.
AddComponent
<
EventComponent
<
ActionAttribute
>>();
world
.
AddComponent
<
EventComponent
<
EventAttribute
>>();
world
.
AddComponent
<
TimerComponent
>();
world
.
AddComponent
<
UnitComponent
>();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录