地图相关协议
This commit is contained in:
9
Assets/Scripts/Fishing2/LoginFinish.cs
Normal file
9
Assets/Scripts/Fishing2/LoginFinish.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录完成
|
||||
/// </summary>
|
||||
public struct LoginFinish
|
||||
{
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Fishing2/LoginFinish.cs.meta
Normal file
3
Assets/Scripts/Fishing2/LoginFinish.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a85bf2f0e79b42caab50178c5b9c89e6
|
||||
timeCreated: 1756132556
|
||||
3
Assets/Scripts/Fishing2/System/Data/Map.meta
Normal file
3
Assets/Scripts/Fishing2/System/Data/Map.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ea88c9233de496b971c64715426805f
|
||||
timeCreated: 1756132197
|
||||
22
Assets/Scripts/Fishing2/System/Data/Map/MapHelper.cs
Normal file
22
Assets/Scripts/Fishing2/System/Data/Map/MapHelper.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using NBC;
|
||||
|
||||
namespace NBF.Fishing2
|
||||
{
|
||||
public static class MapHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 开始进入地图
|
||||
/// </summary>
|
||||
public static async FTask Enter(int mapId, long roomId = 0)
|
||||
{
|
||||
var response = (Map2C_EnterMapResponse)await Net.Call(new C2Map_EnterMapRequest()
|
||||
{
|
||||
MapId = mapId,
|
||||
RoomId = roomId
|
||||
});
|
||||
Log.Info($"创建房间请求返回={response.MapId}");
|
||||
|
||||
await FTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfc04c7d83084b7784cb7cf69dde1be6
|
||||
timeCreated: 1756132207
|
||||
@@ -224,24 +224,52 @@ namespace NBC
|
||||
public QuaternionInfo Rotation { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Map2C_CreateMapResponse : AMessage, ICustomRouteResponse, IProto
|
||||
public partial class C2Map_CreateRoomRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
public static Map2C_CreateMapResponse Create(Scene scene)
|
||||
public static C2Map_CreateRoomRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2C_CreateMapResponse>();
|
||||
return scene.MessagePoolComponent.Rent<C2Map_CreateRoomRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
MapId = default;
|
||||
Password = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2Map_CreateRoomRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Map2C_CreateRoomResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2Map_CreateRoomRequest; }
|
||||
[ProtoIgnore]
|
||||
public int RouteType => Fantasy.RouteType.MapRoute;
|
||||
[ProtoMember(1)]
|
||||
public int MapId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public string Password { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class Map2C_CreateRoomResponse : AMessage, ICustomRouteResponse, IProto
|
||||
{
|
||||
public static Map2C_CreateRoomResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2C_CreateRoomResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Units.Clear();
|
||||
MapId = default;
|
||||
RoomId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2C_CreateMapResponse>(this);
|
||||
GetScene().MessagePoolComponent.Return<Map2C_CreateRoomResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Map2C_CreateMapResponse; }
|
||||
public uint OpCode() { return OuterOpcode.Map2C_CreateRoomResponse; }
|
||||
[ProtoMember(1)]
|
||||
public List<MapUnitInfo> Units = new List<MapUnitInfo>();
|
||||
public int MapId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long RoomId { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
@@ -279,15 +307,18 @@ namespace NBC
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
Units.Clear();
|
||||
Roles.Clear();
|
||||
MapId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2C_EnterMapResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Map2C_EnterMapResponse; }
|
||||
[ProtoMember(1)]
|
||||
public List<MapUnitInfo> Units = new List<MapUnitInfo>();
|
||||
public List<MapUnitInfo> Roles = new List<MapUnitInfo>();
|
||||
[ProtoMember(2)]
|
||||
public long MapId { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
|
||||
@@ -2,8 +2,9 @@ namespace Fantasy
|
||||
{
|
||||
public static partial class OuterOpcode
|
||||
{
|
||||
public const uint Map2C_CreateMapResponse = 2415929105;
|
||||
public const uint C2Map_EnterMapRequest = 2281711377;
|
||||
public const uint C2Map_CreateRoomRequest = 2281711377;
|
||||
public const uint Map2C_CreateRoomResponse = 2415929105;
|
||||
public const uint C2Map_EnterMapRequest = 2281711378;
|
||||
public const uint Map2C_EnterMapResponse = 2415929106;
|
||||
public const uint C2Map_Move = 2147493649;
|
||||
public const uint Map2C_RoleEnterMapNotify = 2147493650;
|
||||
@@ -16,38 +17,38 @@ namespace Fantasy
|
||||
public const uint C2G_LoginRequest = 268445458;
|
||||
public const uint G2C_LoginResponse = 402663186;
|
||||
public const uint G2C_RepeatLogin = 134227729;
|
||||
public const uint C2Game_GetRoleInfoRequest = 2281711378;
|
||||
public const uint C2Game_GetRoleInfoRequest = 2281711379;
|
||||
public const uint Game2C_GetRoleInfoResponse = 2415929107;
|
||||
public const uint C2S_GetConversationsRequest = 2281711379;
|
||||
public const uint C2S_GetConversationsRequest = 2281711380;
|
||||
public const uint S2C_GetConversationsResponse = 2415929108;
|
||||
public const uint C2S_SendMailRequest = 2281711380;
|
||||
public const uint C2S_SendMailRequest = 2281711381;
|
||||
public const uint S2C_SendMailResponse = 2415929109;
|
||||
public const uint C2S_DeleteMailRequest = 2281711381;
|
||||
public const uint C2S_DeleteMailRequest = 2281711382;
|
||||
public const uint S2C_DeleteMailResponse = 2415929110;
|
||||
public const uint S2C_HaveMail = 2147493655;
|
||||
public const uint S2C_MailState = 2147493656;
|
||||
public const uint C2S_CreateChannelRequest = 2281711382;
|
||||
public const uint C2S_CreateChannelRequest = 2281711383;
|
||||
public const uint S2C_CreateChannelResponse = 2415929111;
|
||||
public const uint C2S_JoinChannelRequest = 2281711383;
|
||||
public const uint C2S_JoinChannelRequest = 2281711384;
|
||||
public const uint S2C_JoinChannelResponse = 2415929112;
|
||||
public const uint C2S_SendMessageRequest = 2281711384;
|
||||
public const uint C2S_SendMessageRequest = 2281711385;
|
||||
public const uint S2C_SendMessageResponse = 2415929113;
|
||||
public const uint S2C_Message = 2147493657;
|
||||
public const uint C2S_CreateClubRequest = 2281711385;
|
||||
public const uint C2S_CreateClubRequest = 2281711386;
|
||||
public const uint S2C_CreateClubResponse = 2415929114;
|
||||
public const uint C2S_GetClubInfoRequest = 2281711386;
|
||||
public const uint C2S_GetClubInfoRequest = 2281711387;
|
||||
public const uint S2C_GetClubInfoResponse = 2415929115;
|
||||
public const uint C2S_GetMemberListRequest = 2281711387;
|
||||
public const uint C2S_GetMemberListRequest = 2281711388;
|
||||
public const uint S2C_GetMemberListResponse = 2415929116;
|
||||
public const uint C2S_GetClubListRequest = 2281711388;
|
||||
public const uint C2S_GetClubListRequest = 2281711389;
|
||||
public const uint S2C_GetClubListResponse = 2415929117;
|
||||
public const uint C2S_JoinClubRequest = 2281711389;
|
||||
public const uint C2S_JoinClubRequest = 2281711390;
|
||||
public const uint S2C_JoinClubResponse = 2415929118;
|
||||
public const uint C2S_LeaveClubRequest = 2281711390;
|
||||
public const uint C2S_LeaveClubRequest = 2281711391;
|
||||
public const uint S2C_LeaveClubResponse = 2415929119;
|
||||
public const uint C2S_DissolveClubRequest = 2281711391;
|
||||
public const uint C2S_DissolveClubRequest = 2281711392;
|
||||
public const uint S2C_DissolveClubResponse = 2415929120;
|
||||
public const uint C2S_DisposeJoinRequest = 2281711392;
|
||||
public const uint C2S_DisposeJoinRequest = 2281711393;
|
||||
public const uint S2C_DisposeJoinResponse = 2415929121;
|
||||
public const uint S2C_ClubChange = 2147493658;
|
||||
}
|
||||
|
||||
@@ -7,5 +7,6 @@ namespace Fantasy
|
||||
public const int SocialRoute = 1002; // Social
|
||||
public const int GameRoute = 1003; // Game
|
||||
public const int MapRoute = 1004; // Map
|
||||
public const int RoomRoute = 1005; // Room
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace NBF
|
||||
_session = Net.CreateSession("127.0.0.1:20001");
|
||||
|
||||
_session.Scene.AddComponent<UnitUnityComponent>();
|
||||
|
||||
|
||||
var acc = account;
|
||||
|
||||
// 发送登录的请求给服务器
|
||||
@@ -52,6 +52,7 @@ namespace NBF
|
||||
}
|
||||
|
||||
Log.Debug($"登录到Gate服务器成功!ErrorCode:{loginResponse.ErrorCode}");
|
||||
await _session.Scene.EventComponent.PublishAsync(new ChangePosition());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,13 +20,14 @@ namespace NBF
|
||||
{
|
||||
if (btn == BtnLogin)
|
||||
{
|
||||
var unitGameObject = new GameObject("Unit");
|
||||
var unit = Entity.Create<Unit>(App.Main, true, true);
|
||||
var unitUnity = unit.AddComponent<UnitUnityComponent>();
|
||||
unitUnity.SetGameObject(unitGameObject);
|
||||
// App.Main.add
|
||||
// LoginHelper.Login(InputAccount.text).Coroutine();
|
||||
OnLoginClick().Coroutine();
|
||||
}
|
||||
}
|
||||
|
||||
private async FTask OnLoginClick()
|
||||
{
|
||||
await LoginHelper.Login(InputAccount.text);
|
||||
await MapHelper.Enter(99);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,9 @@ onBoardingDoNotAskAgain = true
|
||||
showPackageIndexes = false
|
||||
showStatusBar = false
|
||||
scopes = {
|
||||
"last_search.66F56946" = ""
|
||||
"OpenInspectorPreview.66F56946" = "0"
|
||||
"currentGroup.66F56946" = null
|
||||
}
|
||||
providers = {
|
||||
asset = {
|
||||
|
||||
Reference in New Issue
Block a user