Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
4d424dfa
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,发现更多精彩内容 >>
提交
4d424dfa
编写于
10月 23, 2017
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修复server编译的问题
上级
6787974e
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
138 addition
and
2 deletion
+138
-2
Server/Model/Component/EventComponent.cs
Server/Model/Component/EventComponent.cs
+138
-0
Server/Model/Server.Model.csproj
Server/Model/Server.Model.csproj
+0
-2
未找到文件。
Server/Model/Component/EventComponent.cs
0 → 100644
浏览文件 @
4d424dfa
using
System
;
using
System.Collections.Generic
;
namespace
Model
{
[
ObjectEvent
]
public
class
EventComponentEvent
:
ObjectEvent
<
EventComponent
>,
IAwake
,
ILoad
{
public
void
Awake
()
{
this
.
Get
().
Awake
();
}
public
void
Load
()
{
this
.
Get
().
Load
();
}
}
public
class
EventComponent
:
Component
{
private
Dictionary
<
EventIdType
,
List
<
object
>>
allEvents
;
public
void
Awake
()
{
this
.
Load
();
}
public
void
Load
()
{
this
.
allEvents
=
new
Dictionary
<
EventIdType
,
List
<
object
>>();
Type
[]
types
=
DllHelper
.
GetMonoTypes
();
foreach
(
Type
type
in
types
)
{
object
[]
attrs
=
type
.
GetCustomAttributes
(
typeof
(
EventAttribute
),
false
);
foreach
(
object
attr
in
attrs
)
{
EventAttribute
aEventAttribute
=
(
EventAttribute
)
attr
;
object
obj
=
Activator
.
CreateInstance
(
type
);
if
(!
this
.
allEvents
.
ContainsKey
((
EventIdType
)
aEventAttribute
.
Type
))
{
this
.
allEvents
.
Add
((
EventIdType
)
aEventAttribute
.
Type
,
new
List
<
object
>());
}
this
.
allEvents
[(
EventIdType
)
aEventAttribute
.
Type
].
Add
(
obj
);
}
}
}
public
void
Run
(
EventIdType
type
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
IEvent
iEvent
=
(
IEvent
)
obj
;
iEvent
.
Run
();
}
catch
(
Exception
e
)
{
Log
.
Error
(
e
.
ToString
());
}
}
}
public
void
Run
<
A
>(
EventIdType
type
,
A
a
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
IEvent
<
A
>
iEvent
=
(
IEvent
<
A
>)
obj
;
iEvent
.
Run
(
a
);
}
catch
(
Exception
err
)
{
Log
.
Error
(
err
.
ToString
());
}
}
}
public
void
Run
<
A
,
B
>(
EventIdType
type
,
A
a
,
B
b
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
IEvent
<
A
,
B
>
iEvent
=
(
IEvent
<
A
,
B
>)
obj
;
iEvent
.
Run
(
a
,
b
);
}
catch
(
Exception
err
)
{
Log
.
Error
(
err
.
ToString
());
}
}
}
public
void
Run
<
A
,
B
,
C
>(
EventIdType
type
,
A
a
,
B
b
,
C
c
)
{
List
<
object
>
iEvents
;
if
(!
this
.
allEvents
.
TryGetValue
(
type
,
out
iEvents
))
{
return
;
}
foreach
(
object
obj
in
iEvents
)
{
try
{
IEvent
<
A
,
B
,
C
>
iEvent
=
(
IEvent
<
A
,
B
,
C
>)
obj
;
iEvent
.
Run
(
a
,
b
,
c
);
}
catch
(
Exception
err
)
{
Log
.
Error
(
err
.
ToString
());
}
}
}
}
}
\ No newline at end of file
Server/Model/Server.Model.csproj
浏览文件 @
4d424dfa
...
...
@@ -39,7 +39,6 @@
<Compile Include="..\..\Unity\Assets\Scripts\Base\Object\ObjectEventAttribute.cs" Link="Base\Object\ObjectEventAttribute.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Base\Object\ObjectPool.cs" Link="Base\Object\ObjectPool.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Component\ConfigComponent.cs" Link="Component\ConfigComponent.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Component\EventComponent.cs" Link="Component\EventComponent.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Component\NetworkComponent.cs" Link="Component\NetworkComponent.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Component\TimerComponent.cs" Link="Component\TimerComponent.cs" />
<Compile Include="..\..\Unity\Assets\Scripts\Entity\Message\Opcode.cs" Link="Entity\Message\Opcode.cs" />
...
...
@@ -64,5 +63,4 @@
<ProjectReference Include="..\ThirdParty\MongodbDriver\DotNetCoreDriver\MongoDB.Driver.Core\MongoDB.Driver.Core.csproj" />
<ProjectReference Include="..\ThirdParty\MongodbDriver\DotNetCoreDriver\MongoDB.Driver\MongoDB.Driver.csproj" />
</ItemGroup>
</Project>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录