游戏服相关
This commit is contained in:
67
Assets/Scripts/Generate/NetworkProtocol/OuterCommon.cs
Normal file
67
Assets/Scripts/Generate/NetworkProtocol/OuterCommon.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Fantasy;
|
||||
using NBC;
|
||||
using NBC.Network.Interface;
|
||||
using NBC.Serialize;
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
/// <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; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5a7e198038cdd4e4d927a062fefa83d8
|
||||
@@ -141,45 +141,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; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ namespace Fantasy
|
||||
{
|
||||
public const int GateRoute = 1001; // Gate
|
||||
public const int ChatRoute = 1002; // Chat
|
||||
public const int GameRoute = 1003; // Game
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,11 +193,13 @@ namespace NBF
|
||||
}
|
||||
|
||||
Log.Debug(
|
||||
$"登录到Gate服务器成功!LoginTime:{loginResponse.GameAccountInfo.LoginTime} CreateTime:{loginResponse.GameAccountInfo.CreateTime}");
|
||||
$"登录到Gate服务器成功!ErrorCode:{loginResponse.ErrorCode}");
|
||||
// Log.Debug(
|
||||
// $"登录到Gate服务器成功!LoginTime:{loginResponse.GameAccountInfo.LoginTime} CreateTime:{loginResponse.GameAccountInfo.CreateTime}");
|
||||
|
||||
var getResponse = (G2C_GetAccountInfoResponse)await _session.Call(new C2G_GetAccountInfoRequest());
|
||||
var gameAcc = getResponse.GameAccountInfo;
|
||||
Log.Info($"gameAcc LoginTime:{gameAcc.LoginTime} CreateTime:{gameAcc.CreateTime}");
|
||||
// var getResponse = (G2C_GetAccountInfoResponse)await _session.Call(new C2G_GetAccountInfoRequest());
|
||||
// var gameAcc = getResponse.GameAccountInfo;
|
||||
// Log.Info($"gameAcc LoginTime:{gameAcc.LoginTime} CreateTime:{gameAcc.CreateTime}");
|
||||
// getResponse.GameAccountInfo.LoginTime.ToString()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user