Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
guo450212436
et
提交
b2d76405
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,发现更多精彩内容 >>
提交
b2d76405
编写于
5月 08, 2018
作者:
T
tanghai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
简化了actor代码
上级
ad822d06
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
35 addition
and
38 deletion
+35
-38
Server/Hotfix/Module/Actor/ActorMessageSenderSystem.cs
Server/Hotfix/Module/Actor/ActorMessageSenderSystem.cs
+13
-5
Server/Hotfix/Module/FrameSync/C2G_LoginGateHandler.cs
Server/Hotfix/Module/FrameSync/C2G_LoginGateHandler.cs
+1
-1
Server/Hotfix/Module/Message/HotfixOpcode.cs
Server/Hotfix/Module/Message/HotfixOpcode.cs
+1
-1
Server/Hotfix/Module/Message/InnerOpcode.cs
Server/Hotfix/Module/Message/InnerOpcode.cs
+1
-1
Server/Hotfix/Module/Message/MessageDispatherComponentSystem.cs
.../Hotfix/Module/Message/MessageDispatherComponentSystem.cs
+2
-1
Server/Hotfix/Module/Message/OuterOpcode.cs
Server/Hotfix/Module/Message/OuterOpcode.cs
+1
-1
Server/Model/Module/Actor/ActorTask.cs
Server/Model/Module/Actor/ActorTask.cs
+8
-20
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
+7
-7
Unity/Hotfix/Module/Message/HotfixOpcode.cs
Unity/Hotfix/Module/Message/HotfixOpcode.cs
+1
-1
未找到文件。
Server/Hotfix/Module/Actor/ActorMessageSenderSystem.cs
浏览文件 @
b2d76405
...
...
@@ -60,7 +60,7 @@ namespace ETHotfix
while
(
self
.
WaitingTasks
.
Count
>
0
)
{
ActorTask
actorTask
=
self
.
WaitingTasks
.
Dequeue
();
actorTask
.
RunFail
(
self
.
Error
);
actorTask
.
Tcs
?.
SetException
(
new
RpcException
(
self
.
Error
,
""
)
);
}
self
.
LastSendTime
=
0
;
...
...
@@ -139,7 +139,11 @@ namespace ETHotfix
private
static
async
Task
RunTask
(
this
ActorMessageSender
self
,
ActorTask
task
)
{
IResponse
response
=
await
task
.
Run
();
Session
session
=
Game
.
Scene
.
GetComponent
<
NetInnerComponent
>().
Get
(
self
.
Address
);
task
.
ActorMessage
.
ActorId
=
self
.
ActorId
;
IResponse
response
=
await
session
.
Call
(
task
.
ActorMessage
);
// 发送成功
switch
(
response
.
Error
)
...
...
@@ -149,6 +153,9 @@ namespace ETHotfix
self
.
FailTimes
=
0
;
self
.
WaitingTasks
.
Dequeue
();
task
.
Tcs
?.
SetResult
(
response
);
return
;
case
ErrorCode
.
ERR_NotFoundActor
:
// 如果没找到Actor,重试
...
...
@@ -182,13 +189,14 @@ namespace ETHotfix
public
static
void
Send
(
this
ActorMessageSender
self
,
IActorMessage
message
)
{
ActorTask
task
=
new
ActorTask
{
message
=
message
,
MessageSender
=
self
}
;
ActorTask
task
=
new
ActorTask
(
message
)
;
self
.
Add
(
task
);
}
public
static
Task
<
IResponse
>
Call
(
this
ActorMessageSender
self
,
IActorRequest
request
)
{
ActorTask
task
=
new
ActorTask
{
message
=
request
,
MessageSender
=
self
,
Tcs
=
new
TaskCompletionSource
<
IResponse
>()
};
TaskCompletionSource
<
IResponse
>
tcs
=
new
TaskCompletionSource
<
IResponse
>();
ActorTask
task
=
new
ActorTask
(
request
,
tcs
);
self
.
Add
(
task
);
return
task
.
Tcs
.
Task
;
}
...
...
@@ -198,7 +206,7 @@ namespace ETHotfix
string
s
=
""
;
foreach
(
ActorTask
task
in
tasks
)
{
s
+=
$"
{
task
.
m
essage
.
GetType
().
Name
}
"
;
s
+=
$"
{
task
.
ActorM
essage
.
GetType
().
Name
}
"
;
}
return
s
;
...
...
Server/Hotfix/Module/FrameSync/C2G_LoginGateHandler.cs
浏览文件 @
b2d76405
...
...
@@ -6,7 +6,7 @@ namespace ETHotfix
[
MessageHandler
(
AppType
.
Gate
)]
public
class
C2G_LoginGateHandler
:
AMRpcHandler
<
C2G_LoginGate
,
G2C_LoginGate
>
{
protected
override
async
void
Run
(
Session
session
,
C2G_LoginGate
message
,
Action
<
G2C_LoginGate
>
reply
)
protected
override
void
Run
(
Session
session
,
C2G_LoginGate
message
,
Action
<
G2C_LoginGate
>
reply
)
{
G2C_LoginGate
response
=
new
G2C_LoginGate
();
try
...
...
Server/Hotfix/Module/Message/HotfixOpcode.cs
浏览文件 @
b2d76405
namespace
ET
Model
namespace
ET
Hotfix
{
public
static
partial
class
HotfixOpcode
{
...
...
Server/Hotfix/Module/Message/InnerOpcode.cs
浏览文件 @
b2d76405
namespace
ET
Model
namespace
ET
Hotfix
{
public
static
partial
class
InnerOpcode
{
...
...
Server/Hotfix/Module/Message/MessageDispatherComponentSystem.cs
浏览文件 @
b2d76405
using
System
;
using
System.Collections.Generic
;
using
ETModel
;
namespace
ET
Model
namespace
ET
Hotfix
{
[
ObjectSystem
]
public
class
MessageDispatherComponentAwakeSystem
:
AwakeSystem
<
MessageDispatherComponent
>
...
...
Server/Hotfix/Module/Message/OuterOpcode.cs
浏览文件 @
b2d76405
namespace
ET
Model
namespace
ET
Hotfix
{
public
static
partial
class
OuterOpcode
{
...
...
Server/Model/Module/Actor/ActorTask.cs
浏览文件 @
b2d76405
...
...
@@ -4,32 +4,20 @@ namespace ETModel
{
public
struct
ActorTask
{
public
ActorMessageSender
MessageSender
;
public
IActorMessage
message
;
public
IActorMessage
ActorMessage
;
public
TaskCompletionSource
<
IResponse
>
Tcs
;
public
async
Task
<
IResponse
>
Run
(
)
public
ActorTask
(
IActorMessage
actorMessage
)
{
Session
session
=
Game
.
Scene
.
GetComponent
<
NetInnerComponent
>().
Get
(
this
.
MessageSender
.
Address
);
this
.
message
.
ActorId
=
this
.
MessageSender
.
ActorId
;
IResponse
response
=
await
session
.
Call
(
message
);
if
(
response
.
Error
!=
ErrorCode
.
ERR_NotFoundActor
)
{
if
(
this
.
Tcs
!=
null
)
{
this
.
Tcs
?.
SetResult
(
response
);
}
}
return
response
;
this
.
ActorMessage
=
actorMessage
;
this
.
Tcs
=
null
;
}
public
void
RunFail
(
int
error
)
public
ActorTask
(
IActorMessage
actorMessage
,
TaskCompletionSource
<
IResponse
>
tcs
)
{
this
.
Tcs
?.
SetException
(
new
RpcException
(
error
,
""
));
this
.
ActorMessage
=
actorMessage
;
this
.
Tcs
=
tcs
;
}
}
}
\ No newline at end of file
Unity/Assets/Editor/Proto2CsEditor/Proto2CSEditor.cs
浏览文件 @
b2d76405
...
...
@@ -36,22 +36,22 @@ namespace ETEditor
{
msgOpcode
.
Clear
();
Proto2CS
(
"ETModel"
,
"OuterMessage.proto"
,
clientMessagePath
,
"OuterOpcode"
,
100
,
HeadFlag
.
Proto
);
GenerateOpcode
(
"OuterOpcode"
,
clientMessagePath
);
GenerateOpcode
(
"
ETModel"
,
"
OuterOpcode"
,
clientMessagePath
);
Proto2CS
(
"ETHotfix"
,
"OuterMessage.proto"
,
serverMessagePath
,
"OuterOpcode"
,
100
,
HeadFlag
.
Proto
|
HeadFlag
.
Bson
,
false
);
GenerateOpcode
(
"OuterOpcode"
,
serverMessagePath
);
GenerateOpcode
(
"
ETHotfix"
,
"
OuterOpcode"
,
serverMessagePath
);
msgOpcode
.
Clear
();
Proto2CS
(
"ETHotfix"
,
"HotfixMessage.proto"
,
hotfixMessagePath
,
"HotfixOpcode"
,
10000
,
HeadFlag
.
None
);
GenerateOpcode
(
"HotfixOpcode"
,
hotfixMessagePath
);
GenerateOpcode
(
"
ETHotfix"
,
"
HotfixOpcode"
,
hotfixMessagePath
);
msgOpcode
.
Clear
();
Proto2CS
(
"ETHotfix"
,
"HotfixMessage.proto"
,
serverMessagePath
,
"HotfixOpcode"
,
10000
,
HeadFlag
.
Bson
,
false
);
GenerateOpcode
(
"HotfixOpcode"
,
serverMessagePath
);
GenerateOpcode
(
"
ETHotfix"
,
"
HotfixOpcode"
,
serverMessagePath
);
msgOpcode
.
Clear
();
Proto2CS
(
"ETHotfix"
,
"InnerMessage.proto"
,
serverMessagePath
,
"InnerOpcode"
,
1000
,
HeadFlag
.
Bson
,
false
);
GenerateOpcode
(
"InnerOpcode"
,
serverMessagePath
);
GenerateOpcode
(
"
ETHotfix"
,
"
InnerOpcode"
,
serverMessagePath
);
AssetDatabase
.
Refresh
();
}
...
...
@@ -229,10 +229,10 @@ namespace ETEditor
}
}
private
static
void
GenerateOpcode
(
string
outputFileName
,
string
outputPath
)
private
static
void
GenerateOpcode
(
string
ns
,
string
outputFileName
,
string
outputPath
)
{
StringBuilder
sb
=
new
StringBuilder
();
sb
.
AppendLine
(
"namespace ETModel
"
);
sb
.
AppendLine
(
$"namespace
{
ns
}
"
);
sb
.
AppendLine
(
"{"
);
sb
.
AppendLine
(
$"\tpublic static partial class
{
outputFileName
}
"
);
sb
.
AppendLine
(
"\t{"
);
...
...
Unity/Hotfix/Module/Message/HotfixOpcode.cs
浏览文件 @
b2d76405
namespace
ET
Model
namespace
ET
Hotfix
{
public
static
partial
class
HotfixOpcode
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录