配置表接入和升级服务器框架到最新版
This commit is contained in:
@@ -29,6 +29,9 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Game\Shop\" />
|
||||
<Folder Include="Generate\ConfigTable\Entity\" />
|
||||
<Folder Include="Generate\ConfigTable\Partial\" />
|
||||
<Folder Include="Social\Entity\" />
|
||||
<Folder Include="Social\Mail\" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -29,7 +29,7 @@ public class PlayerBasicCache : Entity
|
||||
/// <summary>
|
||||
/// 是否是vip
|
||||
/// </summary>
|
||||
public bool IsVip;
|
||||
public int Vip;
|
||||
|
||||
/// <summary>
|
||||
/// 缓存失效时间
|
||||
|
||||
@@ -3,12 +3,12 @@ using MongoDB.Bson.Serialization.Attributes;
|
||||
|
||||
namespace NB.Game;
|
||||
|
||||
public enum ItemType
|
||||
public enum ItemBasicType
|
||||
{
|
||||
None = 0,
|
||||
Item,
|
||||
Equip,
|
||||
Fish,
|
||||
None,
|
||||
Currency = 1,
|
||||
Item = 2,
|
||||
Fish = 3,
|
||||
}
|
||||
|
||||
public class Item : Entity
|
||||
@@ -21,7 +21,7 @@ public class Item : Entity
|
||||
/// <summary>
|
||||
/// 配置id
|
||||
/// </summary>
|
||||
[BsonElement("cid")] public int ConfigId;
|
||||
[BsonElement("cid")] public uint ConfigId;
|
||||
|
||||
/// <summary>
|
||||
/// 是否绑定
|
||||
@@ -46,5 +46,5 @@ public class Item : Entity
|
||||
/// <summary>
|
||||
/// 物品所属的容器
|
||||
/// </summary>
|
||||
[BsonIgnore] PlayerItemContainer Container;
|
||||
[BsonIgnore] PlayerItemContainerComponent Container;
|
||||
}
|
||||
@@ -6,7 +6,7 @@ using NB.Game;
|
||||
|
||||
namespace NB;
|
||||
|
||||
public sealed class PlayerItemContainer : Entity
|
||||
public sealed class PlayerItemContainerComponent : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 最大格子数量
|
||||
@@ -24,14 +24,4 @@ public sealed class PlayerItemContainer : Entity
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<long, List<long>> FishingRig = new Dictionary<long, List<long>>();
|
||||
|
||||
// /// <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>();
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public sealed class Player : Entity
|
||||
/// 当前经验
|
||||
/// </summary>
|
||||
[BsonElement("exp")] public int Exp;
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 星数
|
||||
@@ -47,41 +47,20 @@ public sealed class Player : Entity
|
||||
[BsonElement("high")] public int Highlight;
|
||||
|
||||
/// <summary>
|
||||
/// 角色vip信息
|
||||
/// vip状态
|
||||
/// </summary>
|
||||
[BsonElement("vInfo")] public PlayerVip Vip;
|
||||
[BsonElement("vip")] public int Vip;
|
||||
|
||||
/// <summary>
|
||||
/// 钱包
|
||||
/// 获取时间
|
||||
/// </summary>
|
||||
[BsonElement("wallet")] public PlayerWallet Wallet;
|
||||
[BsonElement("vTime")] public long VipGetTime;
|
||||
|
||||
/// <summary>
|
||||
/// 背包
|
||||
/// 失效时间
|
||||
/// </summary>
|
||||
[BsonElement("bag")] public PlayerItemContainer ItemContainer;
|
||||
[BsonElement("vExTime")] public long VipExpirationTime;
|
||||
|
||||
/// <summary>
|
||||
/// 鱼护
|
||||
/// </summary>
|
||||
[BsonElement("fish")] public FishContainer FishContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 技能
|
||||
/// </summary>
|
||||
[BsonElement("skill")] public SkillContainer SkillContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 成就
|
||||
/// </summary>
|
||||
[BsonElement("achievement")] public AchievementContainer AchievementContainer;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是vip
|
||||
/// </summary>
|
||||
[BsonIgnore]
|
||||
public bool IsVip => Vip != null && Vip.ExpirationTime > TimeHelper.Now;
|
||||
|
||||
[BsonIgnore] public long SessionRunTimeId;
|
||||
|
||||
}
|
||||
@@ -7,21 +7,11 @@ namespace NB.Game;
|
||||
/// <summary>
|
||||
/// 用户钱包
|
||||
/// </summary>
|
||||
public class PlayerWallet : Entity
|
||||
public class PlayerWalletComponent : Entity
|
||||
{
|
||||
/// <summary>
|
||||
/// 余额
|
||||
/// </summary>
|
||||
public int Money;
|
||||
|
||||
/// <summary>
|
||||
/// 金币
|
||||
/// </summary>
|
||||
public int Gold;
|
||||
|
||||
/// <summary>
|
||||
/// 其他货币
|
||||
/// 所有货币
|
||||
/// </summary>
|
||||
[BsonDictionaryOptions(DictionaryRepresentation.ArrayOfArrays)]
|
||||
public Dictionary<int, int> Other = new();
|
||||
public Dictionary<uint, int> Currency = new();
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class BaitConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class BaitConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<BaitConfig> List { get; set; } = new List<BaitConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, BaitConfig> _configs = new ConcurrentDictionary<uint, BaitConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, BaitConfig> _configs = new Dictionary<uint, BaitConfig>();
|
||||
#endif
|
||||
private static BaitConfigData _instance = null;
|
||||
|
||||
public static BaitConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<BaitConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public BaitConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"BaitConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out BaitConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class BaitConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -96,6 +23,71 @@ namespace Fantasy
|
||||
[ProtoMember(4)]
|
||||
public uint Length { get; set; } // 长度(毫米)
|
||||
[ProtoMember(5)]
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
}
|
||||
}
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
[ProtoMember(6)]
|
||||
public uint[] Arr { get; set; } = Array.Empty<uint>(); // 重量(克)
|
||||
[ProtoMember(7)]
|
||||
public string[] ArrStr { get; set; } = Array.Empty<string>(); // 重量(克)
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<BaitConfig> Context => ConfigTableHelper.Table<BaitConfig>();
|
||||
|
||||
public static BaitConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static BaitConfig Get(Predicate<BaitConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static BaitConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static BaitConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static BaitConfig Fist(Predicate<BaitConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static BaitConfig Last(Predicate<BaitConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<BaitConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<BaitConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<BaitConfig> GetList(Predicate<BaitConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<BaitConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
85
Entity/Generate/ConfigTable/Entity/BasicConfig.cs
Normal file
85
Entity/Generate/ConfigTable/Entity/BasicConfig.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.Serialize;
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class BasicConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public string Name { get; set; } // 参数名
|
||||
[ProtoMember(3)]
|
||||
public string[] Val { get; set; } = Array.Empty<string>(); // 参数值
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<BasicConfig> Context => ConfigTableHelper.Table<BasicConfig>();
|
||||
|
||||
public static BasicConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static BasicConfig Get(Predicate<BasicConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static BasicConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static BasicConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static BasicConfig Fist(Predicate<BasicConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static BasicConfig Last(Predicate<BasicConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<BasicConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<BasicConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<BasicConfig> GetList(Predicate<BasicConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<BasicConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class BobberConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class BobberConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<BobberConfig> List { get; set; } = new List<BobberConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, BobberConfig> _configs = new ConcurrentDictionary<uint, BobberConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, BobberConfig> _configs = new Dictionary<uint, BobberConfig>();
|
||||
#endif
|
||||
private static BobberConfigData _instance = null;
|
||||
|
||||
public static BobberConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<BobberConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public BobberConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"BobberConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out BobberConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class BobberConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -99,5 +26,66 @@ namespace Fantasy
|
||||
public uint Displacement { get; set; } // 位移
|
||||
[ProtoMember(6)]
|
||||
public uint NightLight { get; set; } // 是否夜光
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<BobberConfig> Context => ConfigTableHelper.Table<BobberConfig>();
|
||||
|
||||
public static BobberConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static BobberConfig Get(Predicate<BobberConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static BobberConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static BobberConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static BobberConfig Fist(Predicate<BobberConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static BobberConfig Last(Predicate<BobberConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<BobberConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<BobberConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<BobberConfig> GetList(Predicate<BobberConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<BobberConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class FeederConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class FeederConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<FeederConfig> List { get; set; } = new List<FeederConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, FeederConfig> _configs = new ConcurrentDictionary<uint, FeederConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, FeederConfig> _configs = new Dictionary<uint, FeederConfig>();
|
||||
#endif
|
||||
private static FeederConfigData _instance = null;
|
||||
|
||||
public static FeederConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<FeederConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public FeederConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"FeederConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out FeederConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class FeederConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -97,5 +24,66 @@ namespace Fantasy
|
||||
public uint Capacity { get; set; } // 能力
|
||||
[ProtoMember(5)]
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<FeederConfig> Context => ConfigTableHelper.Table<FeederConfig>();
|
||||
|
||||
public static FeederConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static FeederConfig Get(Predicate<FeederConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static FeederConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static FeederConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static FeederConfig Fist(Predicate<FeederConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static FeederConfig Last(Predicate<FeederConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<FeederConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<FeederConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<FeederConfig> GetList(Predicate<FeederConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<FeederConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class FishConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class FishConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<FishConfig> List { get; set; } = new List<FishConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, FishConfig> _configs = new ConcurrentDictionary<uint, FishConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, FishConfig> _configs = new Dictionary<uint, FishConfig>();
|
||||
#endif
|
||||
private static FishConfigData _instance = null;
|
||||
|
||||
public static FishConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<FishConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public FishConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"FishConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out FishConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class FishConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -101,5 +28,66 @@ namespace Fantasy
|
||||
public uint MaxWeight { get; set; } // 最大重量(克)
|
||||
[ProtoMember(7)]
|
||||
public uint Accept { get; set; } // 接受饵
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<FishConfig> Context => ConfigTableHelper.Table<FishConfig>();
|
||||
|
||||
public static FishConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static FishConfig Get(Predicate<FishConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static FishConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static FishConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static FishConfig Fist(Predicate<FishConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static FishConfig Last(Predicate<FishConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<FishConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<FishConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<FishConfig> GetList(Predicate<FishConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<FishConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class HookConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class HookConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<HookConfig> List { get; set; } = new List<HookConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, HookConfig> _configs = new ConcurrentDictionary<uint, HookConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, HookConfig> _configs = new Dictionary<uint, HookConfig>();
|
||||
#endif
|
||||
private static HookConfigData _instance = null;
|
||||
|
||||
public static HookConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<HookConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public HookConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"HookConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out HookConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class HookConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -99,5 +26,66 @@ namespace Fantasy
|
||||
public uint Length { get; set; } // 长度(毫米)
|
||||
[ProtoMember(6)]
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<HookConfig> Context => ConfigTableHelper.Table<HookConfig>();
|
||||
|
||||
public static HookConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static HookConfig Get(Predicate<HookConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static HookConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static HookConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static HookConfig Fist(Predicate<HookConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static HookConfig Last(Predicate<HookConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<HookConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<HookConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<HookConfig> GetList(Predicate<HookConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<HookConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
85
Entity/Generate/ConfigTable/Entity/InitConfig.cs
Normal file
85
Entity/Generate/ConfigTable/Entity/InitConfig.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.Serialize;
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class InitConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public uint ItemId { get; set; } // 物品Id
|
||||
[ProtoMember(3)]
|
||||
public int Amount { get; set; } // 数量
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<InitConfig> Context => ConfigTableHelper.Table<InitConfig>();
|
||||
|
||||
public static InitConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static InitConfig Get(Predicate<InitConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static InitConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static InitConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static InitConfig Fist(Predicate<InitConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static InitConfig Last(Predicate<InitConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<InitConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<InitConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<InitConfig> GetList(Predicate<InitConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<InitConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
89
Entity/Generate/ConfigTable/Entity/ItemConfig.cs
Normal file
89
Entity/Generate/ConfigTable/Entity/ItemConfig.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.Serialize;
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class ItemConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public string Model { get; set; } // 模型
|
||||
[ProtoMember(3)]
|
||||
public uint Type { get; set; } // 类型
|
||||
[ProtoMember(4)]
|
||||
public uint Max { get; set; } // 最大堆叠数量
|
||||
[ProtoMember(5)]
|
||||
public uint AutoUse { get; set; } // 获得自动使用
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<ItemConfig> Context => ConfigTableHelper.Table<ItemConfig>();
|
||||
|
||||
public static ItemConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static ItemConfig Get(Predicate<ItemConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static ItemConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static ItemConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static ItemConfig Fist(Predicate<ItemConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static ItemConfig Last(Predicate<ItemConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<ItemConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<ItemConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<ItemConfig> GetList(Predicate<ItemConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<ItemConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class LineConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class LineConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<LineConfig> List { get; set; } = new List<LineConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, LineConfig> _configs = new ConcurrentDictionary<uint, LineConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, LineConfig> _configs = new Dictionary<uint, LineConfig>();
|
||||
#endif
|
||||
private static LineConfigData _instance = null;
|
||||
|
||||
public static LineConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<LineConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public LineConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"LineConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out LineConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class LineConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -99,5 +26,66 @@ namespace Fantasy
|
||||
public uint Strength { get; set; } // 强度
|
||||
[ProtoMember(6)]
|
||||
public uint Size { get; set; } // 尺寸
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<LineConfig> Context => ConfigTableHelper.Table<LineConfig>();
|
||||
|
||||
public static LineConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static LineConfig Get(Predicate<LineConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static LineConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static LineConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static LineConfig Fist(Predicate<LineConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static LineConfig Last(Predicate<LineConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<LineConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<LineConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<LineConfig> GetList(Predicate<LineConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<LineConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class LureConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class LureConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<LureConfig> List { get; set; } = new List<LureConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, LureConfig> _configs = new ConcurrentDictionary<uint, LureConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, LureConfig> _configs = new Dictionary<uint, LureConfig>();
|
||||
#endif
|
||||
private static LureConfigData _instance = null;
|
||||
|
||||
public static LureConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<LureConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public LureConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"LureConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out LureConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class LureConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -99,5 +26,66 @@ namespace Fantasy
|
||||
public uint Length { get; set; } // 长度(毫米)
|
||||
[ProtoMember(6)]
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<LureConfig> Context => ConfigTableHelper.Table<LureConfig>();
|
||||
|
||||
public static LureConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static LureConfig Get(Predicate<LureConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static LureConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static LureConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static LureConfig Fist(Predicate<LureConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static LureConfig Last(Predicate<LureConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<LureConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<LureConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<LureConfig> GetList(Predicate<LureConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<LureConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class ReelConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class ReelConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<ReelConfig> List { get; set; } = new List<ReelConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, ReelConfig> _configs = new ConcurrentDictionary<uint, ReelConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, ReelConfig> _configs = new Dictionary<uint, ReelConfig>();
|
||||
#endif
|
||||
private static ReelConfigData _instance = null;
|
||||
|
||||
public static ReelConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<ReelConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public ReelConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"ReelConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out ReelConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class ReelConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -99,5 +26,66 @@ namespace Fantasy
|
||||
public uint Size { get; set; } // 尺寸
|
||||
[ProtoMember(6)]
|
||||
public uint Strength { get; set; } // 强度
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<ReelConfig> Context => ConfigTableHelper.Table<ReelConfig>();
|
||||
|
||||
public static ReelConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static ReelConfig Get(Predicate<ReelConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static ReelConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static ReelConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static ReelConfig Fist(Predicate<ReelConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static ReelConfig Last(Predicate<ReelConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<ReelConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<ReelConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<ReelConfig> GetList(Predicate<ReelConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<ReelConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,91 +5,79 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class RingConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class RingConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<RingConfig> List { get; set; } = new List<RingConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, RingConfig> _configs = new ConcurrentDictionary<uint, RingConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, RingConfig> _configs = new Dictionary<uint, RingConfig>();
|
||||
#endif
|
||||
private static RingConfigData _instance = null;
|
||||
|
||||
public static RingConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<RingConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public RingConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"RingConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out RingConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class RingConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public string Model { get; set; } // 模型
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<RingConfig> Context => ConfigTableHelper.Table<RingConfig>();
|
||||
|
||||
public static RingConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static RingConfig Get(Predicate<RingConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static RingConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static RingConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static RingConfig Fist(Predicate<RingConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static RingConfig Last(Predicate<RingConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<RingConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<RingConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<RingConfig> GetList(Predicate<RingConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<RingConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class RodConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class RodConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<RodConfig> List { get; set; } = new List<RodConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, RodConfig> _configs = new ConcurrentDictionary<uint, RodConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, RodConfig> _configs = new Dictionary<uint, RodConfig>();
|
||||
#endif
|
||||
private static RodConfigData _instance = null;
|
||||
|
||||
public static RodConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<RodConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public RodConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"RodConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out RodConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class RodConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -105,5 +32,66 @@ namespace Fantasy
|
||||
public uint MaxRange { get; set; } // 最大范围
|
||||
[ProtoMember(9)]
|
||||
public uint ConstructionType { get; set; } // 结构类型
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<RodConfig> Context => ConfigTableHelper.Table<RodConfig>();
|
||||
|
||||
public static RodConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static RodConfig Get(Predicate<RodConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static RodConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static RodConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static RodConfig Fist(Predicate<RodConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static RodConfig Last(Predicate<RodConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<RodConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<RodConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<RodConfig> GetList(Predicate<RodConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<RodConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
using System;
|
||||
using ProtoBuf;
|
||||
using Fantasy;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class UnitConfigData : ASerialize, IConfigTable, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<UnitConfig> List { get; set; } = new List<UnitConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, UnitConfig> _configs = new ConcurrentDictionary<uint, UnitConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, UnitConfig> _configs = new Dictionary<uint, UnitConfig>();
|
||||
#endif
|
||||
private static UnitConfigData _instance = null;
|
||||
|
||||
public static UnitConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<UnitConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public UnitConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"UnitConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out UnitConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class UnitConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
public string Name { get; set; } // 名称
|
||||
[ProtoMember(3)]
|
||||
public string Model { get; set; } // 数据库类型
|
||||
[ProtoMember(4)]
|
||||
public StringDictionaryConfig Dic { get; set; } // 字典类型
|
||||
}
|
||||
}
|
||||
@@ -5,88 +5,15 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using Fantasy.ConfigTable;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
|
||||
#pragma warning disable CS0169
|
||||
#pragma warning disable CS8618
|
||||
#pragma warning disable CS8625
|
||||
#pragma warning disable CS8603
|
||||
using Fantasy.ConfigTable;
|
||||
|
||||
namespace Fantasy
|
||||
namespace NBF
|
||||
{
|
||||
[ProtoContract]
|
||||
public sealed partial class WeightConfigData : ASerialize, IConfigTable, IProto
|
||||
public sealed partial class WeightConfig : ASerialize, IProto, IConfigTable
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public List<WeightConfig> List { get; set; } = new List<WeightConfig>();
|
||||
#if FANTASY_NET
|
||||
[ProtoIgnore]
|
||||
private readonly ConcurrentDictionary<uint, WeightConfig> _configs = new ConcurrentDictionary<uint, WeightConfig>();
|
||||
#else
|
||||
[ProtoIgnore]
|
||||
private readonly Dictionary<uint, WeightConfig> _configs = new Dictionary<uint, WeightConfig>();
|
||||
#endif
|
||||
private static WeightConfigData _instance = null;
|
||||
|
||||
public static WeightConfigData Instance
|
||||
{
|
||||
get { return _instance ??= ConfigTableHelper.Load<WeightConfigData>(); }
|
||||
private set => _instance = value;
|
||||
}
|
||||
|
||||
public WeightConfig Get(uint id, bool check = true)
|
||||
{
|
||||
if (_configs.ContainsKey(id))
|
||||
{
|
||||
return _configs[id];
|
||||
}
|
||||
|
||||
if (check)
|
||||
{
|
||||
throw new Exception($"WeightConfig not find {id} Id");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
public bool TryGet(uint id, out WeightConfig config)
|
||||
{
|
||||
config = null;
|
||||
|
||||
if (!_configs.ContainsKey(id))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
config = _configs[id];
|
||||
return true;
|
||||
}
|
||||
public override void AfterDeserialization()
|
||||
{
|
||||
foreach (var config in List)
|
||||
{
|
||||
#if FANTASY_NET
|
||||
_configs.TryAdd(config.Id, config);
|
||||
#else
|
||||
_configs.Add(config.Id, config);
|
||||
#endif
|
||||
config.AfterDeserialization();
|
||||
}
|
||||
|
||||
EndInit();
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
Instance = null;
|
||||
}
|
||||
}
|
||||
|
||||
[ProtoContract]
|
||||
public sealed partial class WeightConfig : ASerialize, IProto
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public uint Id { get; set; } // Id
|
||||
[ProtoMember(2)]
|
||||
@@ -95,5 +22,66 @@ namespace Fantasy
|
||||
public uint Type { get; set; } // 类型
|
||||
[ProtoMember(4)]
|
||||
public uint Weight { get; set; } // 重量(克)
|
||||
}
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public uint Key => Id;
|
||||
|
||||
#region Static
|
||||
|
||||
private static ConfigContext<WeightConfig> Context => ConfigTableHelper.Table<WeightConfig>();
|
||||
|
||||
public static WeightConfig Get(uint key)
|
||||
{
|
||||
return Context.Get(key);
|
||||
}
|
||||
|
||||
public static WeightConfig Get(Predicate<WeightConfig> match)
|
||||
{
|
||||
return Context.Get(match);
|
||||
}
|
||||
|
||||
public static WeightConfig Fist()
|
||||
{
|
||||
return Context.Fist();
|
||||
}
|
||||
|
||||
public static WeightConfig Last()
|
||||
{
|
||||
return Context.Last();
|
||||
}
|
||||
|
||||
public static WeightConfig Fist(Predicate<WeightConfig> match)
|
||||
{
|
||||
return Context.Fist(match);
|
||||
}
|
||||
|
||||
public static WeightConfig Last(Predicate<WeightConfig> match)
|
||||
{
|
||||
return Context.Last(match);
|
||||
}
|
||||
|
||||
public static int Count()
|
||||
{
|
||||
return Context.Count();
|
||||
}
|
||||
|
||||
public static int Count(Func<WeightConfig, bool> predicate)
|
||||
{
|
||||
return Context.Count(predicate);
|
||||
}
|
||||
|
||||
public static List<WeightConfig> GetList()
|
||||
{
|
||||
return Context.GetList();
|
||||
}
|
||||
|
||||
public static List<WeightConfig> GetList(Predicate<WeightConfig> match)
|
||||
{
|
||||
return Context.GetList(match);
|
||||
}
|
||||
public static void ParseJson(Newtonsoft.Json.Linq.JArray arr)
|
||||
{
|
||||
ConfigTableHelper.ParseLine<WeightConfig>(arr);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed partial class UnitConfigData
|
||||
{
|
||||
public override void EndInit()
|
||||
{
|
||||
Log.Debug("UnitConfigData EndInit");
|
||||
base.EndInit();
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,6 @@ namespace Fantasy
|
||||
Country = default;
|
||||
Level = default;
|
||||
Exp = default;
|
||||
Vip = default;
|
||||
VipInfo = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<RoleBaseInfo>(this);
|
||||
@@ -51,8 +50,6 @@ namespace Fantasy
|
||||
[ProtoMember(5)]
|
||||
public int Exp { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public bool Vip { get; set; }
|
||||
[ProtoMember(7)]
|
||||
public VipInfo VipInfo { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
@@ -156,7 +153,7 @@ namespace Fantasy
|
||||
[ProtoMember(5)]
|
||||
public int Level { get; set; }
|
||||
[ProtoMember(6)]
|
||||
public bool Vip { get; set; }
|
||||
public int Vip { get; set; }
|
||||
[ProtoMember(7)]
|
||||
public int MapId { get; set; }
|
||||
}
|
||||
@@ -172,6 +169,7 @@ namespace Fantasy
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Level = default;
|
||||
OpenTime = default;
|
||||
ExpirationTime = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
@@ -179,8 +177,10 @@ namespace Fantasy
|
||||
#endif
|
||||
}
|
||||
[ProtoMember(1)]
|
||||
public long OpenTime { get; set; }
|
||||
public int Level { get; set; }
|
||||
[ProtoMember(2)]
|
||||
public long OpenTime { get; set; }
|
||||
[ProtoMember(3)]
|
||||
public long ExpirationTime { get; set; }
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user