提交进入地图和创建房间相关逻辑和协议
This commit is contained in:
@@ -5,9 +5,9 @@ namespace NB.Gate;
|
||||
|
||||
public class GateUnit : Entity
|
||||
{
|
||||
public bool Kick;
|
||||
public long AccountID;
|
||||
public int Region;
|
||||
public string RoomCode = string.Empty;
|
||||
public Dictionary<int,long> SceneRoutes = new Dictionary<int, long>();
|
||||
public EntityReference<Session> Session;
|
||||
}
|
||||
@@ -253,4 +253,75 @@ namespace Fantasy
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求离开房间
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2Map_ExitRoomRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2Map_ExitRoomRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2Map_ExitRoomRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
RoomCode = default;
|
||||
AccountId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2Map_ExitRoomRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public Map2G_ExiRoomResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2Map_ExitRoomRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string RoomCode { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long AccountId { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求离开房间响应
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Map2G_ExiRoomResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static Map2G_ExiRoomResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2G_ExiRoomResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2G_ExiRoomResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.Map2G_ExiRoomResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 通知网关切换地图
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class Map2G_ChangeMapMessage : AMessage, IRouteMessage, IProto
|
||||
{
|
||||
public static Map2G_ChangeMapMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<Map2G_ChangeMapMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
MapId = default;
|
||||
Node = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2G_ChangeMapMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.Map2G_ChangeMapMessage; }
|
||||
[ProtoMember(1)]
|
||||
public int MapId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int Node { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,8 @@ namespace Fantasy
|
||||
public const uint Club2Chat_CreateChannel = 939534098;
|
||||
public const uint G2Map_EnterRoomRequest = 1073751828;
|
||||
public const uint Map2G_EnterRoomResponse = 1207969556;
|
||||
public const uint G2Map_ExitRoomRequest = 1073751829;
|
||||
public const uint Map2G_ExiRoomResponse = 1207969557;
|
||||
public const uint Map2G_ChangeMapMessage = 939534099;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,53 @@ namespace Fantasy
|
||||
[ProtoMember(3)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求网关离开房间
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class C2G_ExitRoomRequest : AMessage, IRequest, IProto
|
||||
{
|
||||
public static C2G_ExitRoomRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<C2G_ExitRoomRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
RoomCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<C2G_ExitRoomRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2C_ExitRoomResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return OuterOpcode.C2G_ExitRoomRequest; }
|
||||
[ProtoMember(1)]
|
||||
public string RoomCode { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 请求网关进入离开响应
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2C_ExitRoomResponse : AMessage, IResponse, IProto
|
||||
{
|
||||
public static G2C_ExitRoomResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_ExitRoomResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
RoomCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_ExitRoomResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_ExitRoomResponse; }
|
||||
[ProtoMember(1)]
|
||||
public string RoomCode { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2Map_EnterMapRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
@@ -154,15 +201,12 @@ namespace Fantasy
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
MapId = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<Map2C_EnterMapResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.Map2C_EnterMapResponse; }
|
||||
[ProtoMember(1)]
|
||||
public int MapId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,30 @@ namespace Fantasy
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_RepeatLogin; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 通知客户端切换地图
|
||||
/// </summary>
|
||||
[ProtoContract]
|
||||
public partial class G2C_ChangeMap : AMessage, IMessage, IProto
|
||||
{
|
||||
public static G2C_ChangeMap Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2C_ChangeMap>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
MapId = default;
|
||||
Node = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2C_ChangeMap>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return OuterOpcode.G2C_ChangeMap; }
|
||||
[ProtoMember(1)]
|
||||
public int MapId { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public int Node { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class C2Game_GetRoleInfoRequest : AMessage, ICustomRouteRequest, IProto
|
||||
{
|
||||
|
||||
@@ -6,13 +6,16 @@ namespace Fantasy
|
||||
public const uint Map2C_CreateRoomResponse = 2415929105;
|
||||
public const uint C2G_EnterRoomRequest = 268445457;
|
||||
public const uint G2C_EnterRoomResponse = 402663185;
|
||||
public const uint C2G_ExitRoomRequest = 268445458;
|
||||
public const uint G2C_ExitRoomResponse = 402663186;
|
||||
public const uint C2Map_EnterMapRequest = 2281711378;
|
||||
public const uint Map2C_EnterMapResponse = 2415929106;
|
||||
public const uint C2A_LoginRequest = 268445458;
|
||||
public const uint A2C_LoginResponse = 402663186;
|
||||
public const uint C2G_LoginRequest = 268445459;
|
||||
public const uint G2C_LoginResponse = 402663187;
|
||||
public const uint C2A_LoginRequest = 268445459;
|
||||
public const uint A2C_LoginResponse = 402663187;
|
||||
public const uint C2G_LoginRequest = 268445460;
|
||||
public const uint G2C_LoginResponse = 402663188;
|
||||
public const uint G2C_RepeatLogin = 134227729;
|
||||
public const uint G2C_ChangeMap = 134227730;
|
||||
public const uint C2Game_GetRoleInfoRequest = 2281711379;
|
||||
public const uint Game2C_GetRoleInfoResponse = 2415929107;
|
||||
public const uint C2Map_EnterRoomRequest = 2281711380;
|
||||
|
||||
@@ -4,4 +4,13 @@ namespace NB.Map;
|
||||
|
||||
public class Map : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 地图配置id
|
||||
/// </summary>
|
||||
public int MapId;
|
||||
|
||||
/// <summary>
|
||||
/// 地图玩家
|
||||
/// </summary>
|
||||
public Dictionary<long, MapUnit> Units = new Dictionary<long, MapUnit>();
|
||||
}
|
||||
@@ -23,10 +23,5 @@ public class MapUnit : Entity
|
||||
/// </summary>
|
||||
public int MapId;
|
||||
|
||||
/// <summary>
|
||||
/// 当前所在房间id
|
||||
/// </summary>
|
||||
public int RoomId;
|
||||
|
||||
public long GateRouteId;
|
||||
}
|
||||
@@ -69,4 +69,19 @@ public class ErrorCode
|
||||
/// 已在房间,不能加入另一个
|
||||
/// </summary>
|
||||
public const uint MapRoomHave = 13004;
|
||||
|
||||
/// <summary>
|
||||
/// 加入服务失败
|
||||
/// </summary>
|
||||
public const uint MapRoomEnterError = 13005;
|
||||
|
||||
/// <summary>
|
||||
/// 重复加入失败
|
||||
/// </summary>
|
||||
public const uint MapRoomEnterRepeated = 13006;
|
||||
|
||||
/// <summary>
|
||||
/// 地图id错误
|
||||
/// </summary>
|
||||
public const uint MapIdError = 13007;
|
||||
}
|
||||
Reference in New Issue
Block a user