新增角色相关信息

This commit is contained in:
2025-07-28 23:45:46 +08:00
parent be33e12b35
commit 09bbae66d2
68 changed files with 452 additions and 662 deletions

View File

@@ -15,6 +15,53 @@ using Fantasy.Serialize;
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
#pragma warning disable CS8618
namespace NBC
namespace Fantasy
{
/// <summary>
/// 通知游戏服角色进入该游戏服
/// </summary>
[ProtoContract]
public partial class G2Game_EnterRequest : AMessage, IRouteRequest, IProto
{
public static G2Game_EnterRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2Game_EnterRequest>();
}
public override void Dispose()
{
AccountId = default;
GateRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2Game_EnterRequest>(this);
#endif
}
[ProtoIgnore]
public Game2G_EnterResponse ResponseType { get; set; }
public uint OpCode() { return InnerOpcode.G2Game_EnterRequest; }
[ProtoMember(1)]
public long AccountId { get; set; }
[ProtoMember(2)]
public long GateRouteId { get; set; }
}
[ProtoContract]
public partial class Game2G_EnterResponse : AMessage, IRouteResponse, IProto
{
public static Game2G_EnterResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2G_EnterResponse>();
}
public override void Dispose()
{
ErrorCode = default;
RoleRouteId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2G_EnterResponse>(this);
#endif
}
public uint OpCode() { return InnerOpcode.Game2G_EnterResponse; }
[ProtoMember(1)]
public long RoleRouteId { get; set; }
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
}

View File

@@ -2,5 +2,7 @@ namespace Fantasy
{
public static partial class InnerOpcode
{
public const uint G2Game_EnterRequest = 1073751825;
public const uint Game2G_EnterResponse = 1207969553;
}
}

View File

@@ -0,0 +1,75 @@
using ProtoBuf;
using System.Collections.Generic;
using MongoDB.Bson.Serialization.Attributes;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
// ReSharper disable InconsistentNaming
// ReSharper disable RedundantUsingDirective
// ReSharper disable RedundantOverriddenMember
// ReSharper disable PartialTypeWithSinglePart
// ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable MemberCanBePrivate.Global
// ReSharper disable CheckNamespace
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
#pragma warning disable CS8618
namespace Fantasy
{
/// <summary>
/// GameAccount实体类
/// </summary>
[ProtoContract]
public partial class RoleBaseInfo : AMessage, IProto
{
public static RoleBaseInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<RoleBaseInfo>();
}
public override void Dispose()
{
NickName = default;
Head = default;
Country = default;
Level = default;
Exp = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<RoleBaseInfo>(this);
#endif
}
[ProtoMember(1)]
public string NickName { get; set; }
[ProtoMember(2)]
public string Head { get; set; }
[ProtoMember(3)]
public string Country { get; set; }
[ProtoMember(4)]
public int Level { get; set; }
[ProtoMember(5)]
public int Exp { get; set; }
}
/// <summary>
/// 角色信息
/// </summary>
[ProtoContract]
public partial class RoleInfo : AMessage, IProto
{
public static RoleInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<RoleInfo>();
}
public override void Dispose()
{
BaseInfo = default;
RoleId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<RoleInfo>(this);
#endif
}
[ProtoMember(1)]
public RoleBaseInfo BaseInfo { get; set; }
[ProtoMember(2)]
public long RoleId { get; set; }
}
}

View File

@@ -15,7 +15,7 @@ using Fantasy.Serialize;
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
#pragma warning disable CS8618
namespace NBC
namespace Fantasy
{
[ProtoContract]
public partial class C2A_LoginRequest : AMessage, IRequest, IProto
@@ -149,45 +149,47 @@ namespace NBC
[ProtoMember(2)]
public long LoginTime { get; set; }
}
/// <summary>
/// 拿到当前账号的信息
/// </summary>
[ProtoContract]
public partial class C2G_GetAccountInfoRequest : AMessage, IRequest, IProto
public partial class C2Game_GetRoleInfoRequest : AMessage, ICustomRouteRequest, IProto
{
public static C2G_GetAccountInfoRequest Create(Scene scene)
public static C2Game_GetRoleInfoRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_GetAccountInfoRequest>();
return scene.MessagePoolComponent.Rent<C2Game_GetRoleInfoRequest>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_GetAccountInfoRequest>(this);
GetScene().MessagePoolComponent.Return<C2Game_GetRoleInfoRequest>(this);
#endif
}
[ProtoIgnore]
public G2C_GetAccountInfoResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2G_GetAccountInfoRequest; }
public Game2C_GetRoleInfoResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GetRoleInfoRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
}
[ProtoContract]
public partial class G2C_GetAccountInfoResponse : AMessage, IResponse, IProto
public partial class Game2C_GetRoleInfoResponse : AMessage, ICustomRouteResponse, IProto
{
public static G2C_GetAccountInfoResponse Create(Scene scene)
public static Game2C_GetRoleInfoResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_GetAccountInfoResponse>();
return scene.MessagePoolComponent.Rent<Game2C_GetRoleInfoResponse>();
}
public override void Dispose()
{
ErrorCode = default;
GameAccountInfo = default;
Name = default;
RoleId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_GetAccountInfoResponse>(this);
GetScene().MessagePoolComponent.Return<Game2C_GetRoleInfoResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_GetAccountInfoResponse; }
public uint OpCode() { return OuterOpcode.Game2C_GetRoleInfoResponse; }
[ProtoMember(1)]
public GameAccountInfo GameAccountInfo { get; set; }
public string Name { get; set; }
[ProtoMember(2)]
public string RoleId { get; set; }
[ProtoMember(3)]
public uint ErrorCode { get; set; }
}
}

View File

@@ -7,7 +7,7 @@ namespace Fantasy
public const uint C2G_LoginRequest = 268445458;
public const uint G2C_LoginResponse = 402663186;
public const uint G2C_RepeatLogin = 134227729;
public const uint C2G_GetAccountInfoRequest = 268445459;
public const uint G2C_GetAccountInfoResponse = 402663187;
public const uint C2Game_GetRoleInfoRequest = 2281711377;
public const uint Game2C_GetRoleInfoResponse = 2415929105;
}
}

View File

@@ -5,5 +5,6 @@ namespace Fantasy
{
public const int GateRoute = 1001; // Gate
public const int ChatRoute = 1002; // Chat
public const int GameRoute = 1003; // Game
}
}