进入和离开地图和房间协议合并

This commit is contained in:
2025-09-09 00:17:50 +08:00
parent ebb1a467c4
commit a2c5b61ba8
16 changed files with 228 additions and 287 deletions

View File

@@ -55,16 +55,18 @@ message Club2Chat_CreateChannel // IRouteMessage
/// 请求进入房间 /// 请求进入房间
message G2Map_EnterRoomRequest // IRouteRequest,Map2G_EnterRoomResponse message G2Map_EnterMapRequest // IRouteRequest,Map2G_EnterMapResponse
{ {
string RoomCode = 1; //房间代码 string RoomCode = 1; //房间代码
int64 AccountId = 2; //账号id int64 AccountId = 2; //账号id
int32 MapId =3; //地图id
} }
/// 请求进入房间响应 /// 请求进入房间响应
message Map2G_EnterRoomResponse // IRouteResponse message Map2G_EnterMapResponse // IRouteResponse
{ {
string RoomCode = 1; //房间代码 string RoomCode = 1; //房间代码
int32 MapId = 2; //地图id
repeated MapUnitInfo Units = 2; //房间玩家列表 repeated MapUnitInfo Units = 2; //房间玩家列表
} }

View File

@@ -14,41 +14,47 @@ message Map2C_CreateRoomResponse // ICustomRouteResponse
repeated MapUnitInfo Units = 2; //房间玩家列表 repeated MapUnitInfo Units = 2; //房间玩家列表
} }
/// 请求网关进入房间
message C2G_EnterRoomRequest // IRequest,G2C_EnterRoomResponse
{
string RoomCode = 1; //房间代码
}
/// 请求网关进入房间响应
message G2C_EnterRoomResponse // IResponse
{
string RoomCode = 1; //房间代码
repeated MapUnitInfo Units = 2; //房间玩家列表
}
/// 请求网关离开房间(离开房间,但是不离开地图)
/// 请求网关离开房间
message C2G_ExitRoomRequest // IRequest,G2C_ExitRoomResponse message C2G_ExitRoomRequest // IRequest,G2C_ExitRoomResponse
{ {
string RoomCode = 1; //房间代码 string RoomCode = 1; //房间代码
} }
/// 请求网关进入离开响应 /// 请求网关进入离开响应
message G2C_ExitRoomResponse // IResponse message G2C_ExitRoomResponse // IResponse
{ {
string RoomCode = 1; //房间代码 string RoomCode = 1; //房间代码
} }
/// 请求网关进入地图
message C2Map_EnterMapRequest // ICustomRouteRequest,Map2C_EnterMapResponse,MapRoute message C2G_EnterMapRequest // IRequest,G2C_EnterMapResponse
{ {
int32 MapId = 1;//地图id string RoomCode = 1; //房间代码
string RoomId = 2;//房间id如果联机则有 int32 MapId = 2; //地图id
} }
message Map2C_EnterMapResponse // ICustomRouteResponse /// 请求网关进入房间响应
message G2C_EnterMapResponse // IResponse
{ {
int32 MapId = 1; //地图id
string RoomCode = 2; //房间代码
repeated MapUnitInfo Units = 3; //房间玩家列表
}
// // 请求进入地图
// message C2Map_EnterMapRequest // ICustomRouteRequest,Map2C_EnterMapResponse,MapRoute
// {
// int32 MapId = 1;//地图id
// string RoomCode = 2;//房间id如果是进入房间
// }
// message Map2C_EnterMapResponse // ICustomRouteResponse
// {
} // }
/// 通知客户端切换地图 /// 通知客户端切换地图
@@ -57,11 +63,3 @@ message Map2C_ChangeMap // ICustomRouteMessage,MapRoute
int32 MapId = 1; //地图id int32 MapId = 1; //地图id
int32 Node = 2; //站位节点 int32 Node = 2; //站位节点
} }
// ///新邮件推送
// message S2C_HaveMail // ICustomRouteMessage,SocialRoute
// {
// MailInfo Mail = 1;
// string Key = 2;
// }

View File

@@ -2,7 +2,7 @@ syntax = "proto3";
package Fantasy.Network.Message; package Fantasy.Network.Message;
//************** 进入 离开 **********************
///用户进入地图 ///用户进入地图
message Map2C_RoleEnterRoomNotify // ICustomRouteMessage,MapRoute message Map2C_RoleEnterRoomNotify // ICustomRouteMessage,MapRoute
{ {
@@ -15,6 +15,8 @@ message Map2C_RoleExitRoomNotify // ICustomRouteMessage,MapRoute
int64 Id = 1;//离开人员 int64 Id = 1;//离开人员
} }
//************** 参数变化 **********************
///玩家状态变化同步 ///玩家状态变化同步
message Map2C_RoleStateNotify // ICustomRouteMessage,MapRoute message Map2C_RoleStateNotify // ICustomRouteMessage,MapRoute
{ {
@@ -22,21 +24,21 @@ message Map2C_RoleStateNotify // ICustomRouteMessage,MapRoute
UnitStateInfo State = 2; UnitStateInfo State = 2;
} }
///玩家钓组状态变化
message Map2C_RoleGearStateNotify // ICustomRouteMessage,MapRoute
{
int64 Id = 1;
UnitFishingInfo State = 2;
}
///玩家钓组变化 ///玩家钓组变化
message Map2C_RoleGearChangeNotify // ICustomRouteMessage,MapRoute message Map2C_RoleGearChangeNotify // ICustomRouteMessage,MapRoute
{ {
int64 Id = 1; int64 Id = 1;
GearInfo Gears = 2; //钓组数据 repeated GearInfo Gears = 2; //钓组数据
} }
//************** 移动 旋转 ********************** //玩家属性值变化
message Map2C_RolePropertyChangeNotify // ICustomRouteMessage,MapRoute
{
repeated KeyValueInt32 Propertys = 1; //变化的属性信息
}
//************** 移动 旋转 **********************
// 角色移动 // 角色移动
message C2Map_Move // ICustomRouteMessage,MapRoute message C2Map_Move // ICustomRouteMessage,MapRoute
{ {

View File

@@ -46,8 +46,7 @@ message MapUnitInfo
Vector3Info Position = 3; //当前位置 Vector3Info Position = 3; //当前位置
Vector3Info Rotation = 4; //角色方向 Vector3Info Rotation = 4; //角色方向
UnitStateInfo State = 5; //状态信息 UnitStateInfo State = 5; //状态信息
GearInfo Gears = 7; //钓组数据 repeated GearInfo Gears = 7; //钓组数据
UnitFishingInfo FishingInfo = 8; //钓鱼状态信息 repeated KeyValueInt32 Propertys = 8; //属性信息
repeated KeyValueInt32 KV = 9; //属性信息
} }

View File

@@ -385,27 +385,4 @@ namespace Fantasy
[ProtoMember(3)] [ProtoMember(3)]
public int Exp { get; set; } public int Exp { get; set; }
} }
/// <summary>
/// 玩家当前使用钓组信息
/// </summary>
[ProtoContract]
public partial class GearInfo : AMessage, IProto
{
public static GearInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<GearInfo>();
}
public override void Dispose()
{
Rod = default;
Rigs.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<GearInfo>(this);
#endif
}
[ProtoMember(1)]
public long Rod { get; set; }
[ProtoMember(2)]
public List<long> Rigs = new List<long>();
}
} }

View File

@@ -204,53 +204,59 @@ namespace Fantasy
/// 请求进入房间 /// 请求进入房间
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]
public partial class G2Map_EnterRoomRequest : AMessage, IRouteRequest, IProto public partial class G2Map_EnterMapRequest : AMessage, IRouteRequest, IProto
{ {
public static G2Map_EnterRoomRequest Create(Scene scene) public static G2Map_EnterMapRequest Create(Scene scene)
{ {
return scene.MessagePoolComponent.Rent<G2Map_EnterRoomRequest>(); return scene.MessagePoolComponent.Rent<G2Map_EnterMapRequest>();
} }
public override void Dispose() public override void Dispose()
{ {
RoomCode = default; RoomCode = default;
AccountId = default; AccountId = default;
MapId = default;
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2Map_EnterRoomRequest>(this); GetScene().MessagePoolComponent.Return<G2Map_EnterMapRequest>(this);
#endif #endif
} }
[ProtoIgnore] [ProtoIgnore]
public Map2G_EnterRoomResponse ResponseType { get; set; } public Map2G_EnterMapResponse ResponseType { get; set; }
public uint OpCode() { return InnerOpcode.G2Map_EnterRoomRequest; } public uint OpCode() { return InnerOpcode.G2Map_EnterMapRequest; }
[ProtoMember(1)] [ProtoMember(1)]
public string RoomCode { get; set; } public string RoomCode { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public long AccountId { get; set; } public long AccountId { get; set; }
[ProtoMember(3)]
public int MapId { get; set; }
} }
/// <summary> /// <summary>
/// 请求进入房间响应 /// 请求进入房间响应
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]
public partial class Map2G_EnterRoomResponse : AMessage, IRouteResponse, IProto public partial class Map2G_EnterMapResponse : AMessage, IRouteResponse, IProto
{ {
public static Map2G_EnterRoomResponse Create(Scene scene) public static Map2G_EnterMapResponse Create(Scene scene)
{ {
return scene.MessagePoolComponent.Rent<Map2G_EnterRoomResponse>(); return scene.MessagePoolComponent.Rent<Map2G_EnterMapResponse>();
} }
public override void Dispose() public override void Dispose()
{ {
ErrorCode = default; ErrorCode = default;
RoomCode = default; RoomCode = default;
MapId = default;
Units.Clear(); Units.Clear();
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2G_EnterRoomResponse>(this); GetScene().MessagePoolComponent.Return<Map2G_EnterMapResponse>(this);
#endif #endif
} }
public uint OpCode() { return InnerOpcode.Map2G_EnterRoomResponse; } public uint OpCode() { return InnerOpcode.Map2G_EnterMapResponse; }
[ProtoMember(1)] [ProtoMember(1)]
public string RoomCode { get; set; } public string RoomCode { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public List<MapUnitInfo> Units = new List<MapUnitInfo>(); public int MapId { get; set; }
[ProtoMember(3)] [ProtoMember(3)]
public List<MapUnitInfo> Units = new List<MapUnitInfo>();
[ProtoMember(4)]
public uint ErrorCode { get; set; } public uint ErrorCode { get; set; }
} }
/// <summary> /// <summary>

View File

@@ -10,8 +10,8 @@ namespace Fantasy
public const uint G2S_GetPlayerBasicInfoResponse = 1207969555; public const uint G2S_GetPlayerBasicInfoResponse = 1207969555;
public const uint S2G_ChatMessage = 939534097; public const uint S2G_ChatMessage = 939534097;
public const uint Club2Chat_CreateChannel = 939534098; public const uint Club2Chat_CreateChannel = 939534098;
public const uint G2Map_EnterRoomRequest = 1073751828; public const uint G2Map_EnterMapRequest = 1073751828;
public const uint Map2G_EnterRoomResponse = 1207969556; public const uint Map2G_EnterMapResponse = 1207969556;
public const uint G2Map_ExitRoomRequest = 1073751829; public const uint G2Map_ExitRoomRequest = 1073751829;
public const uint Map2G_ExiRoomResponse = 1207969557; public const uint Map2G_ExiRoomResponse = 1207969557;
} }

View File

@@ -70,56 +70,6 @@ namespace Fantasy
public uint ErrorCode { get; set; } public uint ErrorCode { get; set; }
} }
/// <summary> /// <summary>
/// 请求网关进入房间
/// </summary>
[ProtoContract]
public partial class C2G_EnterRoomRequest : AMessage, IRequest, IProto
{
public static C2G_EnterRoomRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_EnterRoomRequest>();
}
public override void Dispose()
{
RoomCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_EnterRoomRequest>(this);
#endif
}
[ProtoIgnore]
public G2C_EnterRoomResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2G_EnterRoomRequest; }
[ProtoMember(1)]
public string RoomCode { get; set; }
}
/// <summary>
/// 请求网关进入房间响应
/// </summary>
[ProtoContract]
public partial class G2C_EnterRoomResponse : AMessage, IResponse, IProto
{
public static G2C_EnterRoomResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_EnterRoomResponse>();
}
public override void Dispose()
{
ErrorCode = default;
RoomCode = default;
Units.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_EnterRoomResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_EnterRoomResponse; }
[ProtoMember(1)]
public string RoomCode { get; set; }
[ProtoMember(2)]
public List<MapUnitInfo> Units = new List<MapUnitInfo>();
[ProtoMember(3)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 请求网关离开房间 /// 请求网关离开房间
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]
@@ -166,47 +116,60 @@ namespace Fantasy
[ProtoMember(2)] [ProtoMember(2)]
public uint ErrorCode { get; set; } public uint ErrorCode { get; set; }
} }
/// <summary>
/// 请求网关进入地图
/// </summary>
[ProtoContract] [ProtoContract]
public partial class C2Map_EnterMapRequest : AMessage, ICustomRouteRequest, IProto public partial class C2G_EnterMapRequest : AMessage, IRequest, IProto
{ {
public static C2Map_EnterMapRequest Create(Scene scene) public static C2G_EnterMapRequest Create(Scene scene)
{ {
return scene.MessagePoolComponent.Rent<C2Map_EnterMapRequest>(); return scene.MessagePoolComponent.Rent<C2G_EnterMapRequest>();
} }
public override void Dispose() public override void Dispose()
{ {
RoomCode = default;
MapId = default; MapId = default;
RoomId = default;
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Map_EnterMapRequest>(this); GetScene().MessagePoolComponent.Return<C2G_EnterMapRequest>(this);
#endif #endif
} }
[ProtoIgnore] [ProtoIgnore]
public Map2C_EnterMapResponse ResponseType { get; set; } public G2C_EnterMapResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Map_EnterMapRequest; } public uint OpCode() { return OuterOpcode.C2G_EnterMapRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
[ProtoMember(1)] [ProtoMember(1)]
public int MapId { get; set; } public string RoomCode { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public string RoomId { get; set; } public int MapId { get; set; }
} }
/// <summary>
/// 请求网关进入房间响应
/// </summary>
[ProtoContract] [ProtoContract]
public partial class Map2C_EnterMapResponse : AMessage, ICustomRouteResponse, IProto public partial class G2C_EnterMapResponse : AMessage, IResponse, IProto
{ {
public static Map2C_EnterMapResponse Create(Scene scene) public static G2C_EnterMapResponse Create(Scene scene)
{ {
return scene.MessagePoolComponent.Rent<Map2C_EnterMapResponse>(); return scene.MessagePoolComponent.Rent<G2C_EnterMapResponse>();
} }
public override void Dispose() public override void Dispose()
{ {
ErrorCode = default; ErrorCode = default;
MapId = default;
RoomCode = default;
Units.Clear();
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2C_EnterMapResponse>(this); GetScene().MessagePoolComponent.Return<G2C_EnterMapResponse>(this);
#endif #endif
} }
public uint OpCode() { return OuterOpcode.Map2C_EnterMapResponse; } public uint OpCode() { return OuterOpcode.G2C_EnterMapResponse; }
[ProtoMember(1)] [ProtoMember(1)]
public int MapId { get; set; }
[ProtoMember(2)]
public string RoomCode { get; set; }
[ProtoMember(3)]
public List<MapUnitInfo> Units = new List<MapUnitInfo>();
[ProtoMember(4)]
public uint ErrorCode { get; set; } public uint ErrorCode { get; set; }
} }
/// <summary> /// <summary>

View File

@@ -86,31 +86,43 @@ namespace Fantasy
[ProtoMember(4)] [ProtoMember(4)]
public float w { get; set; } public float w { get; set; }
} }
/// <summary>
/// 玩家当前使用钓组信息
/// </summary>
[ProtoContract] [ProtoContract]
public partial class UnitFishingInfo : AMessage, IProto public partial class GearInfo : AMessage, IProto
{ {
public static UnitFishingInfo Create(Scene scene) public static GearInfo Create(Scene scene)
{ {
return scene.MessagePoolComponent.Rent<UnitFishingInfo>(); return scene.MessagePoolComponent.Rent<GearInfo>();
} }
public override void Dispose() public override void Dispose()
{ {
Rod = default;
Rigs.Clear();
LineLength = default; LineLength = default;
ReelSpeed = default; ReelSpeed = default;
OpenLight = default; State = default;
RodSetting = default; Position = default;
Rotation = default;
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<UnitFishingInfo>(this); GetScene().MessagePoolComponent.Return<GearInfo>(this);
#endif #endif
} }
[ProtoMember(1)] [ProtoMember(1)]
public float LineLength { get; set; } public long Rod { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public float ReelSpeed { get; set; } public List<long> Rigs = new List<long>();
[ProtoMember(3)] [ProtoMember(3)]
public bool OpenLight { get; set; } public float LineLength { get; set; }
[ProtoMember(4)] [ProtoMember(4)]
public int RodSetting { get; set; } public float ReelSpeed { get; set; }
[ProtoMember(5)]
public int State { get; set; }
[ProtoMember(6)]
public Vector3Info Position { get; set; }
[ProtoMember(7)]
public Vector3Info Rotation { get; set; }
} }
[ProtoContract] [ProtoContract]
public partial class UnitStateInfo : AMessage, IProto public partial class UnitStateInfo : AMessage, IProto
@@ -146,9 +158,8 @@ namespace Fantasy
Position = default; Position = default;
Rotation = default; Rotation = default;
State = default; State = default;
Gears = default; Gears.Clear();
FishingInfo = default; Propertys.Clear();
KV.Clear();
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<MapUnitInfo>(this); GetScene().MessagePoolComponent.Return<MapUnitInfo>(this);
#endif #endif
@@ -164,10 +175,8 @@ namespace Fantasy
[ProtoMember(5)] [ProtoMember(5)]
public UnitStateInfo State { get; set; } public UnitStateInfo State { get; set; }
[ProtoMember(6)] [ProtoMember(6)]
public GearInfo Gears { get; set; } public List<GearInfo> Gears = new List<GearInfo>();
[ProtoMember(7)] [ProtoMember(7)]
public UnitFishingInfo FishingInfo { get; set; } public List<KeyValueInt32> Propertys = new List<KeyValueInt32>();
[ProtoMember(8)]
public List<KeyValueInt32> KV = new List<KeyValueInt32>();
} }
} }

View File

@@ -4,60 +4,58 @@ namespace Fantasy
{ {
public const uint C2Map_CreateRoomRequest = 2281711377; public const uint C2Map_CreateRoomRequest = 2281711377;
public const uint Map2C_CreateRoomResponse = 2415929105; public const uint Map2C_CreateRoomResponse = 2415929105;
public const uint C2G_EnterRoomRequest = 268445457; public const uint C2G_ExitRoomRequest = 268445457;
public const uint G2C_EnterRoomResponse = 402663185; public const uint G2C_ExitRoomResponse = 402663185;
public const uint C2G_ExitRoomRequest = 268445458; public const uint C2G_EnterMapRequest = 268445458;
public const uint G2C_ExitRoomResponse = 402663186; public const uint G2C_EnterMapResponse = 402663186;
public const uint C2Map_EnterMapRequest = 2281711378;
public const uint Map2C_EnterMapResponse = 2415929106;
public const uint Map2C_ChangeMap = 2147493649; public const uint Map2C_ChangeMap = 2147493649;
public const uint C2A_LoginRequest = 268445459; public const uint C2A_LoginRequest = 268445459;
public const uint A2C_LoginResponse = 402663187; public const uint A2C_LoginResponse = 402663187;
public const uint C2G_LoginRequest = 268445460; public const uint C2G_LoginRequest = 268445460;
public const uint G2C_LoginResponse = 402663188; public const uint G2C_LoginResponse = 402663188;
public const uint G2C_RepeatLogin = 134227729; public const uint G2C_RepeatLogin = 134227729;
public const uint C2Game_GetRoleInfoRequest = 2281711379; public const uint C2Game_GetRoleInfoRequest = 2281711378;
public const uint Game2C_GetRoleInfoResponse = 2415929107; public const uint Game2C_GetRoleInfoResponse = 2415929106;
public const uint Map2C_RoleEnterRoomNotify = 2147493650; public const uint Map2C_RoleEnterRoomNotify = 2147493650;
public const uint Map2C_RoleExitRoomNotify = 2147493651; public const uint Map2C_RoleExitRoomNotify = 2147493651;
public const uint Map2C_RoleStateNotify = 2147493652; public const uint Map2C_RoleStateNotify = 2147493652;
public const uint Map2C_RoleGearStateNotify = 2147493653; public const uint Map2C_RoleGearChangeNotify = 2147493653;
public const uint Map2C_RoleGearChangeNotify = 2147493654; public const uint Map2C_RolePropertyChangeNotify = 2147493654;
public const uint C2Map_Move = 2147493655; public const uint C2Map_Move = 2147493655;
public const uint C2Map_Look = 2147493656; public const uint C2Map_Look = 2147493656;
public const uint Map2C_MoveNotify = 2147493657; public const uint Map2C_MoveNotify = 2147493657;
public const uint Map2C_LookeNotify = 2147493658; public const uint Map2C_LookeNotify = 2147493658;
public const uint C2S_GetConversationsRequest = 2281711380; public const uint C2S_GetConversationsRequest = 2281711379;
public const uint S2C_GetConversationsResponse = 2415929108; public const uint S2C_GetConversationsResponse = 2415929107;
public const uint C2S_SendMailRequest = 2281711381; public const uint C2S_SendMailRequest = 2281711380;
public const uint S2C_SendMailResponse = 2415929109; public const uint S2C_SendMailResponse = 2415929108;
public const uint C2S_DeleteMailRequest = 2281711382; public const uint C2S_DeleteMailRequest = 2281711381;
public const uint S2C_DeleteMailResponse = 2415929110; public const uint S2C_DeleteMailResponse = 2415929109;
public const uint S2C_HaveMail = 2147493659; public const uint S2C_HaveMail = 2147493659;
public const uint S2C_MailState = 2147493660; public const uint S2C_MailState = 2147493660;
public const uint C2S_CreateChannelRequest = 2281711383; public const uint C2S_CreateChannelRequest = 2281711382;
public const uint S2C_CreateChannelResponse = 2415929111; public const uint S2C_CreateChannelResponse = 2415929110;
public const uint C2S_JoinChannelRequest = 2281711384; public const uint C2S_JoinChannelRequest = 2281711383;
public const uint S2C_JoinChannelResponse = 2415929112; public const uint S2C_JoinChannelResponse = 2415929111;
public const uint C2S_SendMessageRequest = 2281711385; public const uint C2S_SendMessageRequest = 2281711384;
public const uint S2C_SendMessageResponse = 2415929113; public const uint S2C_SendMessageResponse = 2415929112;
public const uint S2C_Message = 2147493661; public const uint S2C_Message = 2147493661;
public const uint C2S_CreateClubRequest = 2281711386; public const uint C2S_CreateClubRequest = 2281711385;
public const uint S2C_CreateClubResponse = 2415929114; public const uint S2C_CreateClubResponse = 2415929113;
public const uint C2S_GetClubInfoRequest = 2281711387; public const uint C2S_GetClubInfoRequest = 2281711386;
public const uint S2C_GetClubInfoResponse = 2415929115; public const uint S2C_GetClubInfoResponse = 2415929114;
public const uint C2S_GetMemberListRequest = 2281711388; public const uint C2S_GetMemberListRequest = 2281711387;
public const uint S2C_GetMemberListResponse = 2415929116; public const uint S2C_GetMemberListResponse = 2415929115;
public const uint C2S_GetClubListRequest = 2281711389; public const uint C2S_GetClubListRequest = 2281711388;
public const uint S2C_GetClubListResponse = 2415929117; public const uint S2C_GetClubListResponse = 2415929116;
public const uint C2S_JoinClubRequest = 2281711390; public const uint C2S_JoinClubRequest = 2281711389;
public const uint S2C_JoinClubResponse = 2415929118; public const uint S2C_JoinClubResponse = 2415929117;
public const uint C2S_LeaveClubRequest = 2281711391; public const uint C2S_LeaveClubRequest = 2281711390;
public const uint S2C_LeaveClubResponse = 2415929119; public const uint S2C_LeaveClubResponse = 2415929118;
public const uint C2S_DissolveClubRequest = 2281711392; public const uint C2S_DissolveClubRequest = 2281711391;
public const uint S2C_DissolveClubResponse = 2415929120; public const uint S2C_DissolveClubResponse = 2415929119;
public const uint C2S_DisposeJoinRequest = 2281711393; public const uint C2S_DisposeJoinRequest = 2281711392;
public const uint S2C_DisposeJoinResponse = 2415929121; public const uint S2C_DisposeJoinResponse = 2415929120;
public const uint S2C_ClubChange = 2147493662; public const uint S2C_ClubChange = 2147493662;
} }
} }

View File

@@ -90,32 +90,6 @@ namespace Fantasy
public UnitStateInfo State { get; set; } public UnitStateInfo State { get; set; }
} }
/// <summary> /// <summary>
/// 玩家钓组状态变化
/// </summary>
[ProtoContract]
public partial class Map2C_RoleGearStateNotify : AMessage, ICustomRouteMessage, IProto
{
public static Map2C_RoleGearStateNotify Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Map2C_RoleGearStateNotify>();
}
public override void Dispose()
{
Id = default;
State = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2C_RoleGearStateNotify>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Map2C_RoleGearStateNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public UnitFishingInfo State { get; set; }
}
/// <summary>
/// 玩家钓组变化 /// 玩家钓组变化
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]
@@ -128,7 +102,7 @@ namespace Fantasy
public override void Dispose() public override void Dispose()
{ {
Id = default; Id = default;
Gears = default; Gears.Clear();
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2C_RoleGearChangeNotify>(this); GetScene().MessagePoolComponent.Return<Map2C_RoleGearChangeNotify>(this);
#endif #endif
@@ -139,7 +113,27 @@ namespace Fantasy
[ProtoMember(1)] [ProtoMember(1)]
public long Id { get; set; } public long Id { get; set; }
[ProtoMember(2)] [ProtoMember(2)]
public GearInfo Gears { get; set; } public List<GearInfo> Gears = new List<GearInfo>();
}
[ProtoContract]
public partial class Map2C_RolePropertyChangeNotify : AMessage, ICustomRouteMessage, IProto
{
public static Map2C_RolePropertyChangeNotify Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Map2C_RolePropertyChangeNotify>();
}
public override void Dispose()
{
Propertys.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Map2C_RolePropertyChangeNotify>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Map2C_RolePropertyChangeNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.MapRoute;
[ProtoMember(1)]
public List<KeyValueInt32> Propertys = new List<KeyValueInt32>();
} }
[ProtoContract] [ProtoContract]
public partial class C2Map_Move : AMessage, ICustomRouteMessage, IProto public partial class C2Map_Move : AMessage, ICustomRouteMessage, IProto

View File

@@ -7,9 +7,9 @@ using NB.Map;
namespace NB.Gate; namespace NB.Gate;
public class C2G_EnterRoomRequestHandler : MessageRPC<C2G_EnterRoomRequest, G2C_EnterRoomResponse> public class C2G_EnterMapRequestHandler : MessageRPC<C2G_EnterMapRequest, G2C_EnterMapResponse>
{ {
protected override async FTask Run(Session session, C2G_EnterRoomRequest request, G2C_EnterRoomResponse response, protected override async FTask Run(Session session, C2G_EnterMapRequest request, G2C_EnterMapResponse response,
Action reply) Action reply)
{ {
if (string.IsNullOrEmpty(request.RoomCode)) if (string.IsNullOrEmpty(request.RoomCode))
@@ -40,18 +40,23 @@ public class C2G_EnterRoomRequestHandler : MessageRPC<C2G_EnterRoomRequest, G2C_
return; return;
} }
if (gateUnit.RoomCode == request.RoomCode)
{
response.ErrorCode = ErrorCode.MapRoomEnterRepeated;
return;
}
RoomHelper.ParseCode(request.RoomCode, out var serviceId, out var roomId); uint serviceId = 0;
if (serviceId < 1 || roomId < 1) int roomId = 0;
if (!string.IsNullOrEmpty(request.RoomCode))
{ {
response.ErrorCode = ErrorCode.MapRoomIdError; RoomHelper.ParseCode(request.RoomCode, out serviceId, out roomId);
return; if (serviceId < 1 || roomId < 1)
{
response.ErrorCode = ErrorCode.MapRoomIdError;
return;
}
}
if (serviceId == 0)
{
var mapScenes = SceneConfigData.Instance.GetSceneBySceneType(SceneType.Map);
serviceId = mapScenes.First().Id;
} }
var sceneConfig = SceneConfigData.Instance.Get(serviceId); var sceneConfig = SceneConfigData.Instance.Get(serviceId);
@@ -63,7 +68,6 @@ public class C2G_EnterRoomRequestHandler : MessageRPC<C2G_EnterRoomRequest, G2C_
//先判断是否需要更换地图服务器 //先判断是否需要更换地图服务器
var oldServerRouteId = gateUnit.GetAddress(sceneConfig.SceneType); var oldServerRouteId = gateUnit.GetAddress(sceneConfig.SceneType);
Log.Info($"进入房间信息mapRouteId={oldServerRouteId}-{sceneConfig.RouteId} serviceId={serviceId}");
if (oldServerRouteId != sceneConfig.RouteId) if (oldServerRouteId != sceneConfig.RouteId)
{ {
//先退出旧的服务 //先退出旧的服务
@@ -84,11 +88,12 @@ public class C2G_EnterRoomRequestHandler : MessageRPC<C2G_EnterRoomRequest, G2C_
} }
//执行进入房间操作 //执行进入房间操作
var roomResponse = (Map2G_EnterRoomResponse)await session.Scene.NetworkMessagingComponent.CallInnerRoute( var roomResponse = (Map2G_EnterMapResponse)await session.Scene.NetworkMessagingComponent.CallInnerRoute(
sceneConfig.RouteId, new G2Map_EnterRoomRequest() sceneConfig.RouteId, new G2Map_EnterMapRequest()
{ {
AccountId = gateUnit.Id, AccountId = gateUnit.Id,
RoomCode = request.RoomCode, RoomCode = request.RoomCode,
MapId = request.MapId
}); });
if (roomResponse.ErrorCode != 0) if (roomResponse.ErrorCode != 0)
{ {
@@ -100,6 +105,7 @@ public class C2G_EnterRoomRequestHandler : MessageRPC<C2G_EnterRoomRequest, G2C_
response.Units = roomResponse.Units; response.Units = roomResponse.Units;
response.RoomCode = request.RoomCode; response.RoomCode = request.RoomCode;
request.MapId = request.MapId;
response.ErrorCode = ErrorCode.Successful; response.ErrorCode = ErrorCode.Successful;
} }
} }

View File

@@ -1,21 +0,0 @@
using Fantasy;
using Fantasy.Async;
using Fantasy.Network.Interface;
namespace NB.Map;
public class C2Map_EnterMapRequestHandler : RouteRPC<MapUnit, C2Map_EnterMapRequest, Map2C_EnterMapResponse>
{
protected override async FTask Run(MapUnit entity, C2Map_EnterMapRequest request, Map2C_EnterMapResponse response,
Action reply)
{
var roomManageComponent = entity.Scene.GetComponent<RoomManageComponent>();
if (roomManageComponent == null)
{
response.ErrorCode = ErrorCode.ErrServer;
return;
}
response.ErrorCode = await entity.EnterMap(request.MapId);
}
}

View File

@@ -4,9 +4,12 @@ using Fantasy.Network.Interface;
namespace NB.Map.Inner; namespace NB.Map.Inner;
public class G2Map_EnterRoomRequestHandler : RouteRPC<Scene, G2Map_EnterRoomRequest, Map2G_EnterRoomResponse> /// <summary>
/// 请求进入地图
/// </summary>
public class G2Map_EnterMapRequestHandler : RouteRPC<Scene, G2Map_EnterMapRequest, Map2G_EnterMapResponse>
{ {
protected override async FTask Run(Scene entity, G2Map_EnterRoomRequest request, Map2G_EnterRoomResponse response, protected override async FTask Run(Scene entity, G2Map_EnterMapRequest request, Map2G_EnterMapResponse response,
Action reply) Action reply)
{ {
var roomManageComponent = entity.GetComponent<RoomManageComponent>(); var roomManageComponent = entity.GetComponent<RoomManageComponent>();
@@ -31,32 +34,32 @@ public class G2Map_EnterRoomRequestHandler : RouteRPC<Scene, G2Map_EnterRoomRequ
} }
//进入地图
response.ErrorCode = await mapUnit.EnterMap(request.MapId);
if (response.ErrorCode != 0)
{
return;
}
// 如果没有房间代码,则只是进入地图,直接返回,不执行后续逻辑
if (string.IsNullOrEmpty(request.RoomCode))
{
response.Units = [mapUnit.ToMapUnitInfo()];
return;
}
RoomHelper.ParseCode(request.RoomCode, out var serviceId, out var roomId); RoomHelper.ParseCode(request.RoomCode, out var serviceId, out var roomId);
if (serviceId < 1 || roomId < 1) if (serviceId < 1 || roomId < 1)
{ {
response.ErrorCode = ErrorCode.MapRoomIdError;
return; return;
} }
var room = roomManageComponent.Get(roomId); var room = roomManageComponent.Get(roomId);
if (room == null) if (room == null)
{ {
response.ErrorCode = ErrorCode.MapRoomIdError;
return; return;
} }
if (mapUnit.MapId != room.Map)
{
//切换地图
response.ErrorCode = await mapUnit.EnterMap(mapUnit.MapId);
if (response.ErrorCode != 0)
{
return;
}
}
response.ErrorCode = await room.Enter(mapUnit); response.ErrorCode = await room.Enter(mapUnit);
response.RoomCode = room.Code; response.RoomCode = room.Code;
if (response.ErrorCode == ErrorCode.Successful) if (response.ErrorCode == ErrorCode.Successful)
@@ -64,6 +67,5 @@ public class G2Map_EnterRoomRequestHandler : RouteRPC<Scene, G2Map_EnterRoomRequ
mapUnit.RoomId = room.Id; mapUnit.RoomId = room.Id;
response.Units = room.ToMapUnitInfo(); response.Units = room.ToMapUnitInfo();
} }
} }
} }

View File

@@ -28,12 +28,18 @@ public static class MapUnitSystem
return ErrorCode.MapIdError; return ErrorCode.MapIdError;
} }
// 同步客户端 if (map.Units.TryAdd(self.Id, self))
self.Scene.NetworkMessagingComponent.SendInnerRoute(self.GateRouteId, new Map2C_ChangeMap()
{ {
Node = 1, // 同步客户端
MapId = mapId // self.Scene.NetworkMessagingComponent.SendInnerRoute(self.GateRouteId, new Map2C_ChangeMap()
}); // {
// Node = 1,
// MapId = mapId
// });
}
self.MapId = mapId;
await FTask.CompletedTask; await FTask.CompletedTask;

View File

@@ -3,7 +3,7 @@
"profiles": { "profiles": {
"Main": { "Main": {
"commandName": "Project", "commandName": "Project",
"workingDirectory": "$(OutputPath)", // "workingDirectory": "$(OutputPath)",
"environmentVariables": {}, "environmentVariables": {},
"commandLineArgs": "--m Develop" "commandLineArgs": "--m Develop"
} }