协议新增

This commit is contained in:
2025-11-26 14:29:09 +08:00
parent 84f07aa55c
commit a4c2bb021b
8 changed files with 1961 additions and 247 deletions

View File

@@ -0,0 +1,97 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Fantasy.Serialize;
using NBF.ConfigTable;
namespace NBF
{
[ProtoContract]
public sealed partial class GoodsConfig : ASerialize, IConfigTable
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public uint[] Shop { get; set; } = Array.Empty<uint>(); // 出现商店
[ProtoMember(3)]
public uint Group { get; set; } // 组
[ProtoMember(4)]
public string[] Items { get; set; } = Array.Empty<string>(); // 物品
[ProtoMember(5)]
public uint Price1 { get; set; } // 银币价格
[ProtoMember(6)]
public uint Price2 { get; set; } // 金币价格
[ProtoMember(7)]
public uint[] Label { get; set; } = Array.Empty<uint>(); // 标签
[ProtoMember(8)]
public uint Number { get; set; } // 可购买数量
[ProtoMember(9)]
public uint Disable { get; set; } // 禁用状态
[ProtoIgnore]
public uint Key => Id;
#region Static
private static ConfigContext<GoodsConfig> Context => ConfigTableHelper.Table<GoodsConfig>();
public static GoodsConfig Get(uint key)
{
return Context.Get(key);
}
public static GoodsConfig Get(Predicate<GoodsConfig> match)
{
return Context.Get(match);
}
public static GoodsConfig Fist()
{
return Context.Fist();
}
public static GoodsConfig Last()
{
return Context.Last();
}
public static GoodsConfig Fist(Predicate<GoodsConfig> match)
{
return Context.Fist(match);
}
public static GoodsConfig Last(Predicate<GoodsConfig> match)
{
return Context.Last(match);
}
public static int Count()
{
return Context.Count();
}
public static int Count(Func<GoodsConfig, bool> predicate)
{
return Context.Count(predicate);
}
public static List<GoodsConfig> GetList()
{
return Context.GetList();
}
public static List<GoodsConfig> GetList(Predicate<GoodsConfig> match)
{
return Context.GetList(match);
}
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
{
ConfigTableHelper.ParseLine<GoodsConfig>(arr);
}
#endregion
}
}

View File

@@ -31,9 +31,7 @@ namespace NBF
[ProtoMember(8)] [ProtoMember(8)]
public uint Max { get; set; } // 最大堆叠数量 public uint Max { get; set; } // 最大堆叠数量
[ProtoMember(9)] [ProtoMember(9)]
public uint AutoUse { get; set; } // 获得自动使用 public uint AutoUse { get; set; } // 获得自动使用
[ProtoMember(10)]
public uint Deal { get; set; } // 交易类型
[ProtoIgnore] [ProtoIgnore]
public uint Key => Id; public uint Key => Id;

View File

@@ -266,6 +266,38 @@ namespace Fantasy
public int Abrasion { get; set; } public int Abrasion { get; set; }
} }
/// <summary> /// <summary>
/// 商店物品信息
/// </summary>
[ProtoContract]
public partial class ShopItemInfo : AMessage
{
public static ShopItemInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<ShopItemInfo>();
}
public override void Dispose()
{
ConfigId = default;
Price = default;
Currency = default;
Sort = default;
Tag = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ShopItemInfo>(this);
#endif
}
[ProtoMember(1)]
public uint ConfigId { get; set; }
[ProtoMember(2)]
public uint Price { get; set; }
[ProtoMember(3)]
public uint Currency { get; set; }
[ProtoMember(4)]
public uint Sort { get; set; }
[ProtoMember(5)]
public uint Tag { get; set; }
}
/// <summary>
/// fish信息 /// fish信息
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]

View File

@@ -392,6 +392,55 @@ namespace Fantasy
/// /////////// ******** 商店 *******///////////// /// /////////// ******** 商店 *******/////////////
/// </summary> /// </summary>
/// <summary> /// <summary>
/// 请求商店商品列表
/// </summary>
[ProtoContract]
public partial class C2Game_GetShopItemsRequest : AMessage, ICustomRouteRequest
{
public static C2Game_GetShopItemsRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2Game_GetShopItemsRequest>();
}
public override void Dispose()
{
Shop = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_GetShopItemsRequest>(this);
#endif
}
[ProtoIgnore]
public Game2C_GetShopItemsResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2Game_GetShopItemsRequest; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public uint Shop { get; set; }
}
/// <summary>
/// 请求商店商品列表响应
/// </summary>
[ProtoContract]
public partial class Game2C_GetShopItemsResponse : AMessage, ICustomRouteResponse
{
public static Game2C_GetShopItemsResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_GetShopItemsResponse>();
}
public override void Dispose()
{
ErrorCode = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_GetShopItemsResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_GetShopItemsResponse; }
[ProtoMember(1)]
public List<ShopItemInfo> Items = new List<ShopItemInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 请求购买 /// 请求购买
/// </summary> /// </summary>
[ProtoContract] [ProtoContract]
@@ -403,6 +452,7 @@ namespace Fantasy
} }
public override void Dispose() public override void Dispose()
{ {
BuyId = default;
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2Game_BuyRequest>(this); GetScene().MessagePoolComponent.Return<C2Game_BuyRequest>(this);
#endif #endif
@@ -412,6 +462,8 @@ namespace Fantasy
public uint OpCode() { return OuterOpcode.C2Game_BuyRequest; } public uint OpCode() { return OuterOpcode.C2Game_BuyRequest; }
[ProtoIgnore] [ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute; public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public uint BuyId { get; set; }
} }
/// <summary> /// <summary>
/// 请求购买响应 /// 请求购买响应
@@ -426,16 +478,36 @@ namespace Fantasy
public override void Dispose() public override void Dispose()
{ {
ErrorCode = default; ErrorCode = default;
Awards.Clear();
#if FANTASY_NET || FANTASY_UNITY #if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_BuyResponse>(this); GetScene().MessagePoolComponent.Return<Game2C_BuyResponse>(this);
#endif #endif
} }
public uint OpCode() { return OuterOpcode.Game2C_BuyResponse; } public uint OpCode() { return OuterOpcode.Game2C_BuyResponse; }
[ProtoMember(1)] [ProtoMember(1)]
public List<AwardInfo> Awards = new List<AwardInfo>();
[ProtoMember(2)]
public uint ErrorCode { get; set; } public uint ErrorCode { get; set; }
} }
/// <summary>
/// 活动奖励推送
/// </summary>
[ProtoContract]
public partial class Game2C_RewardNotify : AMessage, ICustomRouteMessage
{
public static Game2C_RewardNotify Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<Game2C_RewardNotify>();
}
public override void Dispose()
{
Awards.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<Game2C_RewardNotify>(this);
#endif
}
public uint OpCode() { return OuterOpcode.Game2C_RewardNotify; }
[ProtoIgnore]
public int RouteType => Fantasy.RouteType.GameRoute;
[ProtoMember(1)]
public List<AwardInfo> Awards = new List<AwardInfo>();
}
} }

View File

@@ -16,63 +16,66 @@ namespace Fantasy
public const uint Game2C_FishChange = 2147493650; public const uint Game2C_FishChange = 2147493650;
public const uint C2Game_SellFishRequest = 2281711382; public const uint C2Game_SellFishRequest = 2281711382;
public const uint Game2C_SellFishResponse = 2415929110; public const uint Game2C_SellFishResponse = 2415929110;
public const uint C2Game_BuyRequest = 2281711383; public const uint C2Game_GetShopItemsRequest = 2281711383;
public const uint Game2C_BuyResponse = 2415929111; public const uint Game2C_GetShopItemsResponse = 2415929111;
public const uint C2Map_CreateRoomRequest = 2281711384; public const uint C2Game_BuyRequest = 2281711384;
public const uint Map2C_CreateRoomResponse = 2415929112; public const uint Game2C_BuyResponse = 2415929112;
public const uint Game2C_RewardNotify = 2147493651;
public const uint C2Map_CreateRoomRequest = 2281711385;
public const uint Map2C_CreateRoomResponse = 2415929113;
public const uint C2G_ExitRoomRequest = 268445457; public const uint C2G_ExitRoomRequest = 268445457;
public const uint G2C_ExitRoomResponse = 402663185; public const uint G2C_ExitRoomResponse = 402663185;
public const uint C2G_EnterMapRequest = 268445458; public const uint C2G_EnterMapRequest = 268445458;
public const uint G2C_EnterMapResponse = 402663186; public const uint G2C_EnterMapResponse = 402663186;
public const uint Map2C_ChangeMap = 2147493651; public const uint Map2C_ChangeMap = 2147493652;
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 = 2281711385; public const uint C2Game_GetRoleInfoRequest = 2281711386;
public const uint Game2C_GetRoleInfoResponse = 2415929113; public const uint Game2C_GetRoleInfoResponse = 2415929114;
public const uint Map2C_RoleEnterRoomNotify = 2147493652; public const uint Map2C_RoleEnterRoomNotify = 2147493653;
public const uint Map2C_RoleExitRoomNotify = 2147493653; public const uint Map2C_RoleExitRoomNotify = 2147493654;
public const uint C2Map_RolePropertyChange = 2147493654; public const uint C2Map_RolePropertyChange = 2147493655;
public const uint Map2C_RoleStateNotify = 2147493655; public const uint Map2C_RoleStateNotify = 2147493656;
public const uint Map2C_RoleGearChangeNotify = 2147493656; public const uint Map2C_RoleGearChangeNotify = 2147493657;
public const uint Map2C_RolePropertyChangeNotify = 2147493657; public const uint Map2C_RolePropertyChangeNotify = 2147493658;
public const uint C2Map_Move = 2147493658; public const uint C2Map_Move = 2147493659;
public const uint C2Map_Look = 2147493659; public const uint C2Map_Look = 2147493660;
public const uint Map2C_MoveNotify = 2147493660; public const uint Map2C_MoveNotify = 2147493661;
public const uint Map2C_LookeNotify = 2147493661; public const uint Map2C_LookeNotify = 2147493662;
public const uint C2S_GetConversationsRequest = 2281711386; public const uint C2S_GetConversationsRequest = 2281711387;
public const uint S2C_GetConversationsResponse = 2415929114; public const uint S2C_GetConversationsResponse = 2415929115;
public const uint C2S_SendMailRequest = 2281711387; public const uint C2S_SendMailRequest = 2281711388;
public const uint S2C_SendMailResponse = 2415929115; public const uint S2C_SendMailResponse = 2415929116;
public const uint C2S_DeleteMailRequest = 2281711388; public const uint C2S_DeleteMailRequest = 2281711389;
public const uint S2C_DeleteMailResponse = 2415929116; public const uint S2C_DeleteMailResponse = 2415929117;
public const uint S2C_HaveMail = 2147493662; public const uint S2C_HaveMail = 2147493663;
public const uint S2C_MailState = 2147493663; public const uint S2C_MailState = 2147493664;
public const uint C2S_CreateChannelRequest = 2281711389; public const uint C2S_CreateChannelRequest = 2281711390;
public const uint S2C_CreateChannelResponse = 2415929117; public const uint S2C_CreateChannelResponse = 2415929118;
public const uint C2S_JoinChannelRequest = 2281711390; public const uint C2S_JoinChannelRequest = 2281711391;
public const uint S2C_JoinChannelResponse = 2415929118; public const uint S2C_JoinChannelResponse = 2415929119;
public const uint C2S_SendMessageRequest = 2281711391; public const uint C2S_SendMessageRequest = 2281711392;
public const uint S2C_SendMessageResponse = 2415929119; public const uint S2C_SendMessageResponse = 2415929120;
public const uint S2C_Message = 2147493664; public const uint S2C_Message = 2147493665;
public const uint C2S_CreateClubRequest = 2281711392; public const uint C2S_CreateClubRequest = 2281711393;
public const uint S2C_CreateClubResponse = 2415929120; public const uint S2C_CreateClubResponse = 2415929121;
public const uint C2S_GetClubInfoRequest = 2281711393; public const uint C2S_GetClubInfoRequest = 2281711394;
public const uint S2C_GetClubInfoResponse = 2415929121; public const uint S2C_GetClubInfoResponse = 2415929122;
public const uint C2S_GetMemberListRequest = 2281711394; public const uint C2S_GetMemberListRequest = 2281711395;
public const uint S2C_GetMemberListResponse = 2415929122; public const uint S2C_GetMemberListResponse = 2415929123;
public const uint C2S_GetClubListRequest = 2281711395; public const uint C2S_GetClubListRequest = 2281711396;
public const uint S2C_GetClubListResponse = 2415929123; public const uint S2C_GetClubListResponse = 2415929124;
public const uint C2S_JoinClubRequest = 2281711396; public const uint C2S_JoinClubRequest = 2281711397;
public const uint S2C_JoinClubResponse = 2415929124; public const uint S2C_JoinClubResponse = 2415929125;
public const uint C2S_LeaveClubRequest = 2281711397; public const uint C2S_LeaveClubRequest = 2281711398;
public const uint S2C_LeaveClubResponse = 2415929125; public const uint S2C_LeaveClubResponse = 2415929126;
public const uint C2S_DissolveClubRequest = 2281711398; public const uint C2S_DissolveClubRequest = 2281711399;
public const uint S2C_DissolveClubResponse = 2415929126; public const uint S2C_DissolveClubResponse = 2415929127;
public const uint C2S_DisposeJoinRequest = 2281711399; public const uint C2S_DisposeJoinRequest = 2281711400;
public const uint S2C_DisposeJoinResponse = 2415929127; public const uint S2C_DisposeJoinResponse = 2415929128;
public const uint S2C_ClubChange = 2147493665; public const uint S2C_ClubChange = 2147493666;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -105,15 +105,45 @@ message Game2C_SellFishResponse // ICustomRouteResponse
////////////// ******** 商店 *******///////////// ////////////// ******** 商店 *******/////////////
///请求商店商品列表
message C2Game_GetShopItemsRequest // ICustomRouteRequest,Game2C_GetShopItemsResponse,GameRoute
{
uint32 Shop = 1;//请求商店列表
}
///请求商店商品列表响应
message Game2C_GetShopItemsResponse // ICustomRouteResponse
{
repeated ShopItemInfo Items = 1; //列表
}
///请求购买 ///请求购买
message C2Game_BuyRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute message C2Game_BuyRequest // ICustomRouteRequest,Game2C_GetFishsResponse,GameRoute
{ {
uint32 BuyId = 1;//购买商品id
} }
///请求购买响应 ///请求购买响应
message Game2C_BuyResponse // ICustomRouteResponse message Game2C_BuyResponse // ICustomRouteResponse
{ {
repeated AwardInfo Awards = 1; //奖励
}
///活动奖励推送
message Game2C_RewardNotify // ICustomRouteMessage,GameRoute
{
repeated AwardInfo Awards = 1;
}
////////////// ******** GM *******/////////////
///请求执行GM
message C2Game_GMRequest // ICustomRouteRequest,Game2C_GMResponse,GameRoute
{
string Cmd = 1;
string Args = 2;
}
///执行GM返回
message Game2C_GMResponse // ICustomRouteResponse
{
} }

View File

@@ -80,6 +80,15 @@ message ItemInfo
int64 GetTime = 5; //获得时间 int64 GetTime = 5; //获得时间
int32 Abrasion = 6; //耐久度 int32 Abrasion = 6; //耐久度
} }
///商店物品信息
message ShopItemInfo
{
uint32 ConfigId = 1; //商品配置id
uint32 Price = 2; //价格
uint32 Currency = 3; //货币类型
uint32 Sort = 4; //排序
uint32 Tag = 5; //特殊标签
}
///fish信息 ///fish信息
message FishInfo message FishInfo