修改钓组相关协议
This commit is contained in:
@@ -54,7 +54,7 @@ message Map2C_RoleGearStateNotify // ICustomRouteMessage,MapRoute
|
|||||||
message Map2C_RoleGearChangeNotify // ICustomRouteMessage,MapRoute
|
message Map2C_RoleGearChangeNotify // ICustomRouteMessage,MapRoute
|
||||||
{
|
{
|
||||||
int64 Id = 1;
|
int64 Id = 1;
|
||||||
UnitGearInfo Gears = 2; //钓组数据
|
GearInfo Gears = 2; //钓组数据
|
||||||
}
|
}
|
||||||
|
|
||||||
///玩家位置变化
|
///玩家位置变化
|
||||||
|
|||||||
@@ -120,10 +120,5 @@ message SkillInfo
|
|||||||
message GearInfo
|
message GearInfo
|
||||||
{
|
{
|
||||||
int64 Rod = 1;
|
int64 Rod = 1;
|
||||||
int64 Line = 2;
|
repeated int64 Rigs = 2; //钓组配件
|
||||||
int64 Bobber = 3;
|
|
||||||
int64 Hook = 4;
|
|
||||||
int64 Bait = 5;
|
|
||||||
int64 Weight = 6;
|
|
||||||
int64 Reel = 7;
|
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,3 @@
|
|||||||
|
|
||||||
message UnitGearItemInfo
|
|
||||||
{
|
|
||||||
int64 Id = 1; //唯一id
|
|
||||||
int32 ConfigId = 2; //配置id
|
|
||||||
}
|
|
||||||
|
|
||||||
message UnitGearInfo
|
|
||||||
{
|
|
||||||
UnitGearItemInfo Rod = 1;
|
|
||||||
UnitGearItemInfo Reel = 2;
|
|
||||||
UnitGearItemInfo Bobber = 3;
|
|
||||||
UnitGearItemInfo Hook = 4;
|
|
||||||
UnitGearItemInfo Bait = 5;
|
|
||||||
UnitGearItemInfo Lure = 6;
|
|
||||||
UnitGearItemInfo Weight = 7;
|
|
||||||
UnitGearItemInfo Line = 8;
|
|
||||||
UnitGearItemInfo Leader = 9;
|
|
||||||
UnitGearItemInfo Feeder = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
message Vector3Info
|
message Vector3Info
|
||||||
{
|
{
|
||||||
float x = 1;
|
float x = 1;
|
||||||
@@ -53,7 +32,7 @@ message MapUnitInfo
|
|||||||
RoleSimpleInfo RoleInfo = 2; //基础信息
|
RoleSimpleInfo RoleInfo = 2; //基础信息
|
||||||
MapUnitPositionInfo Location = 3; //位置信息
|
MapUnitPositionInfo Location = 3; //位置信息
|
||||||
UnitStateInfo State = 4; //状态信息
|
UnitStateInfo State = 4; //状态信息
|
||||||
UnitGearInfo Gears = 5; //钓组数据
|
GearInfo Gears = 5; //钓组数据
|
||||||
UnitFishingInfo FishingInfo = 6; //钓鱼状态信息
|
UnitFishingInfo FishingInfo = 6; //钓鱼状态信息
|
||||||
repeated KeyValueInt32 KV = 7; //属性信息
|
repeated KeyValueInt32 KV = 7; //属性信息
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,14 +19,19 @@ public sealed class ItemContainer : Entity
|
|||||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||||
public Dictionary<long, Item> Items = new Dictionary<long, Item>();
|
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>
|
// /// <summary>
|
||||||
/// 按物品id分组
|
// /// 按物品id分组
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByConfigId = new OneToManyListPool<uint, Item>();
|
// [BsonIgnore] public readonly OneToManyList<int, Item> ItemsByConfigId = new OneToManyListPool<int, Item>();
|
||||||
|
//
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 容器内按物品类型分组
|
// /// 容器内按物品类型分组
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
[BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByType = new OneToManyListPool<uint, Item>();
|
// [BsonIgnore] public readonly OneToManyList<uint, Item> ItemsByType = new OneToManyListPool<uint, Item>();
|
||||||
}
|
}
|
||||||
@@ -49,32 +49,32 @@ public sealed class Player : Entity
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 角色vip信息
|
/// 角色vip信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("vInfo")] public PlayerVip? Vip;
|
[BsonElement("vInfo")] public PlayerVip Vip;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 钱包
|
/// 钱包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("wallet")] public PlayerWallet? Wallet;
|
[BsonElement("wallet")] public PlayerWallet Wallet;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 背包
|
/// 背包
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("bag")] public ItemContainer? ItemContainer;
|
[BsonElement("bag")] public ItemContainer ItemContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 鱼护
|
/// 鱼护
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("fish")] public FishContainer? FishContainer;
|
[BsonElement("fish")] public FishContainer FishContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 技能
|
/// 技能
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("skill")] public SkillContainer? SkillContainer;
|
[BsonElement("skill")] public SkillContainer SkillContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 成就
|
/// 成就
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[BsonElement("achievement")] public AchievementContainer? AchievementContainer;
|
[BsonElement("achievement")] public AchievementContainer AchievementContainer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 是否是vip
|
/// 是否是vip
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ namespace Fantasy
|
|||||||
Currency.Clear();
|
Currency.Clear();
|
||||||
Slots.Clear();
|
Slots.Clear();
|
||||||
Skills.Clear();
|
Skills.Clear();
|
||||||
|
Gears.Clear();
|
||||||
MapId = default;
|
MapId = default;
|
||||||
#if FANTASY_NET || FANTASY_UNITY
|
#if FANTASY_NET || FANTASY_UNITY
|
||||||
GetScene().MessagePoolComponent.Return<RoleInfo>(this);
|
GetScene().MessagePoolComponent.Return<RoleInfo>(this);
|
||||||
@@ -177,6 +178,8 @@ namespace Fantasy
|
|||||||
[ProtoMember(8)]
|
[ProtoMember(8)]
|
||||||
public List<SkillInfo> Skills = new List<SkillInfo>();
|
public List<SkillInfo> Skills = new List<SkillInfo>();
|
||||||
[ProtoMember(9)]
|
[ProtoMember(9)]
|
||||||
|
public List<GearInfo> Gears = new List<GearInfo>();
|
||||||
|
[ProtoMember(10)]
|
||||||
public int MapId { get; set; }
|
public int MapId { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -382,4 +385,27 @@ 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>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,70 +17,6 @@ using Fantasy.Serialize;
|
|||||||
|
|
||||||
namespace Fantasy
|
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]
|
[ProtoContract]
|
||||||
public partial class Vector3Info : AMessage, IProto
|
public partial class Vector3Info : AMessage, IProto
|
||||||
{
|
{
|
||||||
@@ -205,7 +141,7 @@ namespace Fantasy
|
|||||||
[ProtoMember(4)]
|
[ProtoMember(4)]
|
||||||
public UnitStateInfo State { get; set; }
|
public UnitStateInfo State { get; set; }
|
||||||
[ProtoMember(5)]
|
[ProtoMember(5)]
|
||||||
public UnitGearInfo Gears { get; set; }
|
public GearInfo Gears { get; set; }
|
||||||
[ProtoMember(6)]
|
[ProtoMember(6)]
|
||||||
public UnitFishingInfo FishingInfo { get; set; }
|
public UnitFishingInfo FishingInfo { get; set; }
|
||||||
[ProtoMember(7)]
|
[ProtoMember(7)]
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ namespace Fantasy
|
|||||||
[ProtoMember(1)]
|
[ProtoMember(1)]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
[ProtoMember(2)]
|
[ProtoMember(2)]
|
||||||
public UnitGearInfo Gears { get; set; }
|
public GearInfo Gears { get; set; }
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 玩家位置变化
|
/// 玩家位置变化
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Fantasy;
|
using Fantasy;
|
||||||
using Fantasy.Async;
|
using Fantasy.Async;
|
||||||
|
using Fantasy.Entitas;
|
||||||
using Fantasy.Network.Interface;
|
using Fantasy.Network.Interface;
|
||||||
using NB.Map;
|
using NB.Map;
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ public class C2Game_GetRoleInfoRequestHandler : RouteRPC<Player, C2Game_GetRoleI
|
|||||||
{
|
{
|
||||||
response.RoomId = 0;
|
response.RoomId = 0;
|
||||||
response.RoleInfo = entity.GetRoleInfo();
|
response.RoleInfo = entity.GetRoleInfo();
|
||||||
|
|
||||||
await FTask.CompletedTask;
|
await FTask.CompletedTask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,23 @@
|
|||||||
namespace NB.Game;
|
using Fantasy;
|
||||||
|
using Fantasy.Entitas;
|
||||||
|
using NB.Map;
|
||||||
|
|
||||||
public class ItemFactory
|
namespace NB.Game;
|
||||||
|
|
||||||
|
public static class ItemFactory
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 创建一个新的Player
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="scene"></param>
|
||||||
|
/// <param name="configId"></param>
|
||||||
|
/// <param name="count"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static Item Create(Scene scene, int configId, int count = 1)
|
||||||
|
{
|
||||||
|
var item = Entity.Create<Item>(scene, true, true);
|
||||||
|
item.ConfigId = configId;
|
||||||
|
item.Count = count;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Fantasy.Entitas.Interface;
|
using Fantasy;
|
||||||
|
using Fantasy.Entitas.Interface;
|
||||||
|
|
||||||
namespace NB.Game;
|
namespace NB.Game;
|
||||||
|
|
||||||
@@ -14,8 +15,8 @@ public sealed class ItemContainerDestroySystem : DestroySystem<ItemContainer>
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.Items.Clear();
|
self.Items.Clear();
|
||||||
self.ItemsByConfigId.Clear();
|
// self.ItemsByConfigId.Clear();
|
||||||
self.ItemsByType.Clear();
|
// self.ItemsByType.Clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,7 +31,7 @@ public static class ItemContainerSystem
|
|||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static bool GetItemById(this ItemContainer self, uint id, out Item item)
|
public static bool GetItemById(this ItemContainer self, long id, out Item? item)
|
||||||
{
|
{
|
||||||
return self.Items.TryGetValue(id, out item);
|
return self.Items.TryGetValue(id, out item);
|
||||||
}
|
}
|
||||||
@@ -40,31 +41,99 @@ public static class ItemContainerSystem
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="self"></param>
|
/// <param name="self"></param>
|
||||||
/// <param name="configId"></param>
|
/// <param name="configId"></param>
|
||||||
/// <param name="items"></param>
|
/// <param name="item"></param>
|
||||||
public static void GetItemByConfigId(this ItemContainer self, uint configId, List<Item> items)
|
public static bool GetFistItemByConfigId(this ItemContainer self, int configId, out Item? item)
|
||||||
{
|
{
|
||||||
if (!self.ItemsByConfigId.TryGetValue(configId, out var itemList))
|
foreach (var (_, it) in self.Items)
|
||||||
{
|
{
|
||||||
return;
|
if (it.ConfigId == configId)
|
||||||
|
{
|
||||||
|
item = it;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
items.AddRange(itemList);
|
item = null;
|
||||||
|
return false;
|
||||||
|
// if (!self.ItemsByConfigId.TryGetValue(configId, out var itemList))
|
||||||
|
// {
|
||||||
|
// item = null;
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// item = itemList.First();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
// /// <summary>
|
||||||
/// 通过类型获取物品
|
// /// 通过配置id获取物品
|
||||||
/// </summary>
|
// /// </summary>
|
||||||
/// <param name="self"></param>
|
// /// <param name="self"></param>
|
||||||
/// <param name="type"></param>
|
// /// <param name="configId"></param>
|
||||||
/// <param name="items"></param>
|
// /// <param name="items"></param>
|
||||||
public static void GetItemByType(this ItemContainer self, ItemType type, List<Item> items)
|
// public static void GetItemByConfigId(this ItemContainer self, uint configId, List<Item> items)
|
||||||
|
// {
|
||||||
|
// if (!self.ItemsByConfigId.TryGetValue(configId, out var itemList))
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// items.AddRange(itemList);
|
||||||
|
// }
|
||||||
|
|
||||||
|
// /// <summary>
|
||||||
|
// /// 通过类型获取物品
|
||||||
|
// /// </summary>
|
||||||
|
// /// <param name="self"></param>
|
||||||
|
// /// <param name="type"></param>
|
||||||
|
// /// <param name="items"></param>
|
||||||
|
// public static void GetItemByType(this ItemContainer self, ItemType type, List<Item> items)
|
||||||
|
// {
|
||||||
|
// if (!self.ItemsByType.TryGetValue((uint)type, out var itemList))
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// items.AddRange(itemList);
|
||||||
|
// }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Add
|
||||||
|
|
||||||
|
public static void Add(this ItemContainer self, int configId, int count)
|
||||||
{
|
{
|
||||||
if (!self.ItemsByType.TryGetValue((uint)type, out var itemList))
|
var item = ItemFactory.Create(self.Scene, configId, count);
|
||||||
|
self.Items.Add(item.Id, item);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region 结构转换
|
||||||
|
|
||||||
|
public static List<ItemInfo> GetItemInfos(this ItemContainer self)
|
||||||
|
{
|
||||||
|
List<ItemInfo> ret = new List<ItemInfo>();
|
||||||
|
foreach (var (_, item) in self.Items)
|
||||||
{
|
{
|
||||||
return;
|
ret.Add(item.ToItemInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
items.AddRange(itemList);
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<GearInfo> GetGearInfos(this ItemContainer self)
|
||||||
|
{
|
||||||
|
List<GearInfo> ret = new List<GearInfo>();
|
||||||
|
|
||||||
|
foreach (var (rod, rigs) in self.FishingRig)
|
||||||
|
{
|
||||||
|
GearInfo gearInfo = new GearInfo();
|
||||||
|
gearInfo.Rod = rod;
|
||||||
|
gearInfo.Rigs.AddRange(rigs);
|
||||||
|
ret.Add(gearInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -18,14 +18,16 @@ public class ItemDestroySystem : DestroySystem<Item>
|
|||||||
|
|
||||||
public static class ItemSystem
|
public static class ItemSystem
|
||||||
{
|
{
|
||||||
public static ItemInfo ToItemInfo(this Item item)
|
public static ItemInfo ToItemInfo(this Item self)
|
||||||
{
|
{
|
||||||
return new ItemInfo()
|
return new ItemInfo()
|
||||||
{
|
{
|
||||||
ConfigId = item.ConfigId,
|
Id = self.Id,
|
||||||
Id = item.Id,
|
ConfigId = self.Count,
|
||||||
Count = item.Count,
|
Count = self.Count,
|
||||||
// ExpirationTime = item.IsBind;
|
ExpirationTime = self.ExpirationTime,
|
||||||
|
GetTime = self.GetTime,
|
||||||
|
Abrasion = self.Abrasion
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,4 +61,5 @@ public static class ItemSystem
|
|||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -103,7 +103,8 @@ public static class PlayerManageComponentSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
// account.Statistics.LoginTime = TimeHelper.Now;
|
// account.Statistics.LoginTime = TimeHelper.Now;
|
||||||
|
account.SetTestData();
|
||||||
|
|
||||||
await account.Save();
|
await account.Save();
|
||||||
|
|
||||||
return account;
|
return account;
|
||||||
@@ -170,4 +171,6 @@ public static class PlayerManageComponentSystem
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ public sealed class PlayerDestroySystem : DestroySystem<Player>
|
|||||||
self.Exp = 0;
|
self.Exp = 0;
|
||||||
self.Country = string.Empty;
|
self.Country = string.Empty;
|
||||||
self.Head = string.Empty;
|
self.Head = string.Empty;
|
||||||
|
|
||||||
// self.ItemContainer.Dispose();
|
// self.ItemContainer.Dispose();
|
||||||
// self.ItemContainer = null;
|
// self.ItemContainer = null;
|
||||||
// self.FishContainer.Dispose();
|
// self.FishContainer.Dispose();
|
||||||
@@ -35,5 +35,56 @@ public sealed class PlayerDestroySystem : DestroySystem<Player>
|
|||||||
|
|
||||||
public static class PlayerSystem
|
public static class PlayerSystem
|
||||||
{
|
{
|
||||||
|
#region 测试数据
|
||||||
|
|
||||||
|
public static void SetTestData(this Player player)
|
||||||
|
{
|
||||||
|
List<int> addItemConfigs = new List<int>()
|
||||||
|
{
|
||||||
|
100001, 100002, 100003,
|
||||||
|
200001,
|
||||||
|
300001, 300002, 300003,
|
||||||
|
400001,
|
||||||
|
500001, 500002,
|
||||||
|
600001, 600002, 600003, 600004,
|
||||||
|
700001,
|
||||||
|
800001
|
||||||
|
};
|
||||||
|
Dictionary<int, List<int>> rigDic = new Dictionary<int, List<int>>()
|
||||||
|
{
|
||||||
|
{ 100001, [300001, 400001, 500002, 700001, 800001] },
|
||||||
|
{ 100002, [200001, 300001, 400001, 500002, 700001, 800001] },
|
||||||
|
{ 100003, [200001, 400001, 600001] }
|
||||||
|
};
|
||||||
|
//添加测试数据
|
||||||
|
if (player.ItemContainer != null && player.ItemContainer.Items.Count < 1)
|
||||||
|
{
|
||||||
|
foreach (var configId in addItemConfigs)
|
||||||
|
{
|
||||||
|
player.ItemContainer.Add(configId, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (var (rod, list) in rigDic)
|
||||||
|
{
|
||||||
|
if (player.ItemContainer.GetFistItemByConfigId(rod, out var item) && item != null)
|
||||||
|
{
|
||||||
|
var childs = new List<long>();
|
||||||
|
foreach (var i in list)
|
||||||
|
{
|
||||||
|
if (player.ItemContainer.GetFistItemByConfigId(i, out var itemChild) && itemChild != null)
|
||||||
|
{
|
||||||
|
childs.Add(itemChild.Id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
player.ItemContainer.FishingRig[item.Id] = childs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// player.ItemContainer.FishingRig
|
||||||
|
}
|
||||||
|
// if(player.gr)
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
@@ -12,11 +12,11 @@ public static class PlayerHelper
|
|||||||
|
|
||||||
public static void InitializeChildEntity(this Player self)
|
public static void InitializeChildEntity(this Player self)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (self.Vip == null)
|
if (self.Vip == null)
|
||||||
{
|
{
|
||||||
self.Vip = Entity.Create<PlayerVip>(self.Scene, true, true);
|
self.Vip = Entity.Create<PlayerVip>(self.Scene, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.Wallet == null)
|
if (self.Wallet == null)
|
||||||
{
|
{
|
||||||
self.Wallet = Entity.Create<PlayerWallet>(self.Scene, true, true);
|
self.Wallet = Entity.Create<PlayerWallet>(self.Scene, true, true);
|
||||||
@@ -31,12 +31,12 @@ public static class PlayerHelper
|
|||||||
{
|
{
|
||||||
self.FishContainer = Entity.Create<FishContainer>(self.Scene, true, true);
|
self.FishContainer = Entity.Create<FishContainer>(self.Scene, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.SkillContainer == null)
|
if (self.SkillContainer == null)
|
||||||
{
|
{
|
||||||
self.SkillContainer = Entity.Create<SkillContainer>(self.Scene, true, true);
|
self.SkillContainer = Entity.Create<SkillContainer>(self.Scene, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.AchievementContainer == null)
|
if (self.AchievementContainer == null)
|
||||||
{
|
{
|
||||||
self.AchievementContainer = Entity.Create<AchievementContainer>(self.Scene, true, true);
|
self.AchievementContainer = Entity.Create<AchievementContainer>(self.Scene, true, true);
|
||||||
@@ -80,6 +80,12 @@ public static class PlayerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
account.Deserialize(scene);
|
account.Deserialize(scene);
|
||||||
|
account.ItemContainer.Deserialize(scene);
|
||||||
|
foreach (var (_, item) in account.ItemContainer.Items)
|
||||||
|
{
|
||||||
|
item.Deserialize(scene);
|
||||||
|
}
|
||||||
|
|
||||||
return account;
|
return account;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,9 +155,9 @@ public static class PlayerHelper
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region 结构转换
|
#region 结构转换
|
||||||
|
|
||||||
public static RoleSimpleInfo GetRoleSimpleInfo(this Player self)
|
public static RoleSimpleInfo GetRoleSimpleInfo(this Player self)
|
||||||
{
|
{
|
||||||
return new RoleSimpleInfo()
|
return new RoleSimpleInfo()
|
||||||
@@ -169,6 +175,8 @@ public static class PlayerHelper
|
|||||||
{
|
{
|
||||||
var info = new RoleInfo();
|
var info = new RoleInfo();
|
||||||
info.BaseInfo = GetRoleBaseInfo(self);
|
info.BaseInfo = GetRoleBaseInfo(self);
|
||||||
|
info.Items = self.ItemContainer.GetItemInfos();
|
||||||
|
info.Gears = self.ItemContainer.GetGearInfos();
|
||||||
info.RoleId = self.RouteId;
|
info.RoleId = self.RouteId;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"Main": {
|
"Main": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"workingDirectory": "$(OutputPath)",
|
// "workingDirectory": "$(OutputPath)",
|
||||||
"environmentVariables": {},
|
"environmentVariables": {},
|
||||||
"commandLineArgs": "--m Develop"
|
"commandLineArgs": "--m Develop"
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user