修改钓组相关协议

This commit is contained in:
2025-09-01 23:57:34 +08:00
parent 7cdad80c7a
commit 61d20b5729
16 changed files with 240 additions and 146 deletions

View File

@@ -19,14 +19,19 @@ public sealed class ItemContainer : Entity
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<long, Item> Items = new Dictionary<long, Item>();
/// <summary>
/// 钓组信息
/// </summary>
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
public Dictionary<long, List<long>> FishingRig = new Dictionary<long, List<long>>();
/// <summary>
/// 按物品id分组
/// </summary>
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByConfigId = new OneToManyListPool<uint, Item>();
/// <summary>
/// 容器内按物品类型分组
/// </summary>
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByType = new OneToManyListPool<uint, Item>();
// /// <summary>
// /// 按物品id分组
// /// </summary>
// [BsonIgnore] public readonly OneToManyList<int, Item> ItemsByConfigId = new OneToManyListPool<int, Item>();
//
// /// <summary>
// /// 容器内按物品类型分组
// /// </summary>
// [BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByType = new OneToManyListPool<uint, Item>();
}

View File

@@ -49,32 +49,32 @@ public sealed class Player : Entity
/// <summary>
/// 角色vip信息
/// </summary>
[BsonElement("vInfo")] public PlayerVip? Vip;
[BsonElement("vInfo")] public PlayerVip Vip;
/// <summary>
/// 钱包
/// </summary>
[BsonElement("wallet")] public PlayerWallet? Wallet;
[BsonElement("wallet")] public PlayerWallet Wallet;
/// <summary>
/// 背包
/// </summary>
[BsonElement("bag")] public ItemContainer? ItemContainer;
[BsonElement("bag")] public ItemContainer ItemContainer;
/// <summary>
/// 鱼护
/// </summary>
[BsonElement("fish")] public FishContainer? FishContainer;
[BsonElement("fish")] public FishContainer FishContainer;
/// <summary>
/// 技能
/// </summary>
[BsonElement("skill")] public SkillContainer? SkillContainer;
[BsonElement("skill")] public SkillContainer SkillContainer;
/// <summary>
/// 成就
/// </summary>
[BsonElement("achievement")] public AchievementContainer? AchievementContainer;
[BsonElement("achievement")] public AchievementContainer AchievementContainer;
/// <summary>
/// 是否是vip

View File

@@ -155,6 +155,7 @@ namespace Fantasy
Currency.Clear();
Slots.Clear();
Skills.Clear();
Gears.Clear();
MapId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<RoleInfo>(this);
@@ -177,6 +178,8 @@ namespace Fantasy
[ProtoMember(8)]
public List<SkillInfo> Skills = new List<SkillInfo>();
[ProtoMember(9)]
public List<GearInfo> Gears = new List<GearInfo>();
[ProtoMember(10)]
public int MapId { get; set; }
}
/// <summary>
@@ -382,4 +385,27 @@ namespace Fantasy
[ProtoMember(3)]
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

@@ -17,70 +17,6 @@ using Fantasy.Serialize;
namespace Fantasy
{
[ProtoContract]
public partial class UnitGearItemInfo : AMessage, IProto
{
public static UnitGearItemInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<UnitGearItemInfo>();
}
public override void Dispose()
{
Id = default;
ConfigId = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<UnitGearItemInfo>(this);
#endif
}
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public int ConfigId { get; set; }
}
[ProtoContract]
public partial class UnitGearInfo : AMessage, IProto
{
public static UnitGearInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<UnitGearInfo>();
}
public override void Dispose()
{
Rod = default;
Reel = default;
Bobber = default;
Hook = default;
Bait = default;
Lure = default;
Weight = default;
Line = default;
Leader = default;
Feeder = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<UnitGearInfo>(this);
#endif
}
[ProtoMember(1)]
public UnitGearItemInfo Rod { get; set; }
[ProtoMember(2)]
public UnitGearItemInfo Reel { get; set; }
[ProtoMember(3)]
public UnitGearItemInfo Bobber { get; set; }
[ProtoMember(4)]
public UnitGearItemInfo Hook { get; set; }
[ProtoMember(5)]
public UnitGearItemInfo Bait { get; set; }
[ProtoMember(6)]
public UnitGearItemInfo Lure { get; set; }
[ProtoMember(7)]
public UnitGearItemInfo Weight { get; set; }
[ProtoMember(8)]
public UnitGearItemInfo Line { get; set; }
[ProtoMember(9)]
public UnitGearItemInfo Leader { get; set; }
[ProtoMember(10)]
public UnitGearItemInfo Feeder { get; set; }
}
[ProtoContract]
public partial class Vector3Info : AMessage, IProto
{
@@ -205,7 +141,7 @@ namespace Fantasy
[ProtoMember(4)]
public UnitStateInfo State { get; set; }
[ProtoMember(5)]
public UnitGearInfo Gears { get; set; }
public GearInfo Gears { get; set; }
[ProtoMember(6)]
public UnitFishingInfo FishingInfo { get; set; }
[ProtoMember(7)]

View File

@@ -211,7 +211,7 @@ namespace Fantasy
[ProtoMember(1)]
public long Id { get; set; }
[ProtoMember(2)]
public UnitGearInfo Gears { get; set; }
public GearInfo Gears { get; set; }
}
/// <summary>
/// 玩家位置变化