Skip to content

Commit 95910cb

Browse files
committed
[修复]1. 修复启动报错
1 parent dcd1628 commit 95910cb

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
using GameFrameX.Hotfix.Logic.Role.Login;
2-
3-
namespace GameFrameX.Hotfix.Logic.Player.Login;
4-
5-
[MessageMapping(typeof(ReqPlayerLogin))]
6-
internal class ReqPlayerLoginHandler : PlayerComponentHandler<PlayerComponentAgent>
7-
{
8-
/// <summary>
9-
/// 玩家登录初始化
10-
/// 这个地方需要设置ActorID为玩家的ID,否则会报错,该代码只会执行一次。全局唯一。不能移除该代码,也请不要修改该函数ActorID
11-
/// </summary>
12-
/// <returns></returns>
13-
protected override Task InitActor()
14-
{
15-
if (ActorId <= 0 && Message is ReqPlayerLogin reqPlayerLogin)
16-
{
17-
NetWorkChannel.SetData(GlobalConst.ActorIdKey, reqPlayerLogin.Id);
18-
ActorId = reqPlayerLogin.Id;
19-
}
20-
21-
return base.InitActor();
22-
}
23-
24-
protected override async Task ActionAsync()
25-
{
26-
await ComponentAgent.OnPlayerLogin(NetWorkChannel, Message as ReqPlayerLogin);
27-
}
1+
using GameFrameX.Hotfix.Logic.Role.Login;
2+
3+
namespace GameFrameX.Hotfix.Logic.Player.Login;
4+
5+
[MessageMapping(typeof(ReqPlayerLogin))]
6+
internal sealed class ReqPlayerLoginHandler : PlayerComponentHandler<PlayerComponentAgent>
7+
{
8+
/// <summary>
9+
/// 玩家登录初始化
10+
/// 这个地方需要设置ActorID为玩家的ID,否则会报错,该代码只会执行一次。全局唯一。不能移除该代码,也请不要修改该函数ActorID
11+
/// </summary>
12+
/// <returns></returns>
13+
protected override Task InitActor()
14+
{
15+
if (ActorId <= 0 && Message is ReqPlayerLogin reqPlayerLogin)
16+
{
17+
NetWorkChannel.SetData(GlobalConst.ActorIdKey, reqPlayerLogin.Id);
18+
ActorId = reqPlayerLogin.Id;
19+
}
20+
21+
return base.InitActor();
22+
}
23+
24+
protected override async Task ActionAsync()
25+
{
26+
await ComponentAgent.OnPlayerLogin(NetWorkChannel, Message as ReqPlayerLogin);
27+
}
2828
}

0 commit comments

Comments
 (0)