进入地图相关内容

This commit is contained in:
2025-08-31 23:47:37 +08:00
parent b637e1723d
commit 1c0b272a6f
42 changed files with 242 additions and 64 deletions

View File

@@ -3,6 +3,7 @@ using Assets.Scripts.Hotfix;
using NBC;
using NBC.Network;
using NBF.Fishing2;
using Newtonsoft.Json;
namespace NBF
{
@@ -12,9 +13,15 @@ namespace NBF
public static async FTask Login(string account)
{
var oldRole = App.Main.GetComponent<Role>();
if (oldRole != null)
{
App.Main.RemoveComponent<Role>();
}
_session = Net.CreateSession("127.0.0.1:20001");
_session.Scene.AddComponent<UnitUnityComponent>();
// _session.Scene.AddComponent<UnitUnityComponent>();
var acc = account;
@@ -51,8 +58,19 @@ namespace NBF
return;
}
var role = App.Main.AddComponent<Role>(loginResponse.RoleId);
Log.Debug($"登录到Gate服务器成功ErrorCode:{loginResponse.ErrorCode}");
await _session.Scene.EventComponent.PublishAsync(new ChangePosition());
await role.GetRoleInfo();
Log.Debug(
$"获取角色信息成功roleId={role.Id} Room={role.RoomId} RoleInfo={JsonConvert.SerializeObject(role.Info)}");
var mapId = role.Info.MapId;
if (mapId == 0)
{
Log.Warning("账号没有进入过地图,进入新手引导地图");
mapId = 99;
}
await MapHelper.EnterMap(mapId, role.RoomId);
}
}
}