提交示例代码

This commit is contained in:
Bob.Song
2026-03-05 11:39:06 +08:00
commit 25958f58c3
2534 changed files with 209593 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: eea06cf63e0d24f0c878a1ea9aae9751
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: be6a0fc31d8e942149e6291afbff18d8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
namespace Fantasy
{
public partial class ErrorCode
{
public static string GetText(uint errorCode)
{
return ErrorCodeData.Instance.Get(errorCode).Text;
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a6cd7984eec694f5ca83080cbed1da95
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f4598fcac010243349354de5df0a6c60
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 4d9f327360a24d41b52855d149c87578
timeCreated: 1742971118

View File

@@ -0,0 +1,11 @@
namespace Fantasy
{
public partial class LevelConfig
{
public bool IsGroup1;
public override void EndInit()
{
IsGroup1 = Group == 1;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9dd377279fae44f4850cacc93b7010ed
timeCreated: 1742971691

View File

@@ -0,0 +1,26 @@
using System.Collections.Generic;
using Fantasy.DataStructure.Collection;
namespace Fantasy
{
public partial class LevelConfigData
{
private readonly OneToManyList<uint, LevelConfig> _levelConfigsByGroup = new OneToManyList<uint, LevelConfig>();
public override void EndInit()
{
foreach (var levelConfig in List)
{
_levelConfigsByGroup.Add(levelConfig.Group, levelConfig);
}
}
public List<LevelConfig> GetLevelConfigByGroup(uint group)
{
return _levelConfigsByGroup[group];
}
public bool TryGetLevelConfigByGroup(uint group, out List<LevelConfig> levelConfig)
{
return _levelConfigsByGroup.TryGetValue(group, out levelConfig);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bc1dd9007e40493cb31de31aabdf1a8c
timeCreated: 1742971129

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 80b620ba3ea924f0dad7d8f27e24e912
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
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 ContainerConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<ContainerConfig> List { get; set; } = new List<ContainerConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, ContainerConfig> _configs = new ConcurrentDictionary<uint, ContainerConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, ContainerConfig> _configs = new Dictionary<uint, ContainerConfig>();
#endif
private static ContainerConfigData _instance = null;
public static ContainerConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<ContainerConfigData>(); }
private set => _instance = value;
}
public ContainerConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"ContainerConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out ContainerConfig 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 ContainerConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Name { get; set; } // 名字
[ProtoMember(3)]
public int Type { get; set; } // 容器类型
[ProtoMember(4)]
public int CellCountMax { get; set; } // 容器最大的格子数
[ProtoMember(5)]
public int CellCount { get; set; } // 初始解锁格子
[ProtoMember(6)]
public bool CanSort { get; set; } // 是否可以整理
[ProtoMember(7)]
public int SortCD { get; set; } // 是否可以整理
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d7274baf613e94a51998deb754d756cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Fantasy.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 EquipAffixConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<EquipAffixConfig> List { get; set; } = new List<EquipAffixConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, EquipAffixConfig> _configs = new ConcurrentDictionary<uint, EquipAffixConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, EquipAffixConfig> _configs = new Dictionary<uint, EquipAffixConfig>();
#endif
private static EquipAffixConfigData _instance = null;
public static EquipAffixConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<EquipAffixConfigData>(); }
private set => _instance = value;
}
public EquipAffixConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"EquipAffixConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out EquipAffixConfig 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 EquipAffixConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public uint BuffConfigId { get; set; } // 触发的Buff
[ProtoMember(3)]
public string Descride { get; set; } // 介绍
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cea9d23e4b03b4979918c5daa31f09d2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
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 EquipEntryConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<EquipEntryConfig> List { get; set; } = new List<EquipEntryConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, EquipEntryConfig> _configs = new ConcurrentDictionary<uint, EquipEntryConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, EquipEntryConfig> _configs = new Dictionary<uint, EquipEntryConfig>();
#endif
private static EquipEntryConfigData _instance = null;
public static EquipEntryConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<EquipEntryConfigData>(); }
private set => _instance = value;
}
public EquipEntryConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"EquipEntryConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out EquipEntryConfig 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 EquipEntryConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public int Min { get; set; } // 词条最小数
[ProtoMember(3)]
public int Max { get; set; } // 词条最大数
[ProtoMember(4)]
public int AffixMin { get; set; } // 词缀最小数
[ProtoMember(5)]
public int AffixMax { get; set; } // 词缀最大数
[ProtoMember(6)]
public uint[] Affix { get; set; } = Array.Empty<uint>(); // 词缀列表
[ProtoMember(7)]
public int[] Attrs { get; set; } = Array.Empty<int>(); // 属性数组
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 785516e0f77da4618a0ed9dd3face3b2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,101 @@
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 EquipValueConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<EquipValueConfig> List { get; set; } = new List<EquipValueConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, EquipValueConfig> _configs = new ConcurrentDictionary<uint, EquipValueConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, EquipValueConfig> _configs = new Dictionary<uint, EquipValueConfig>();
#endif
private static EquipValueConfigData _instance = null;
public static EquipValueConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<EquipValueConfigData>(); }
private set => _instance = value;
}
public EquipValueConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"EquipValueConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out EquipValueConfig 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 EquipValueConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public uint ItemConfigId { get; set; } // ItemConfigId
[ProtoMember(3)]
public uint EquipEntryConfigId { get; set; } // EquipEntryConfigId
[ProtoMember(4)]
public int Quality { get; set; } // 品质
[ProtoMember(5)]
public IntDictionaryConfig MainAttrs { get; set; } // 法术强度
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e843d1e93bb2d480e9b504817c8752c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,97 @@
using System;
using ProtoBuf;
using Fantasy;
using System.Linq;
using System.Reflection;
using System.Collections.Generic;
using System.Collections.Concurrent;
using Fantasy.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 ErrorCodeData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<ErrorCode> List { get; set; } = new List<ErrorCode>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, ErrorCode> _configs = new ConcurrentDictionary<uint, ErrorCode>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, ErrorCode> _configs = new Dictionary<uint, ErrorCode>();
#endif
private static ErrorCodeData _instance = null;
public static ErrorCodeData Instance
{
get { return _instance ??= ConfigTableHelper.Load<ErrorCodeData>(); }
private set => _instance = value;
}
public ErrorCode Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"ErrorCode not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out ErrorCode 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 ErrorCode : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Name { get; set; } // 名称
[ProtoMember(3)]
public string Text { get; set; } // 文本内容
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 93c9bbffbdcf24e4da780112640c17ba
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,123 @@
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 ItemConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<ItemConfig> List { get; set; } = new List<ItemConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, ItemConfig> _configs = new ConcurrentDictionary<uint, ItemConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, ItemConfig> _configs = new Dictionary<uint, ItemConfig>();
#endif
private static ItemConfigData _instance = null;
public static ItemConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<ItemConfigData>(); }
private set => _instance = value;
}
public ItemConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"ItemConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out ItemConfig 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 ItemConfig : ASerialize, IProto
{
[ProtoMember(1)]
public uint Id { get; set; } // Id
[ProtoMember(2)]
public string Name { get; set; } // 名称
[ProtoMember(3)]
public string Descride { get; set; } // 描述
[ProtoMember(4)]
public int Weight { get; set; } // 排序权重
[ProtoMember(5)]
public string Model2D { get; set; } // 对应模型
[ProtoMember(6)]
public bool Superposed { get; set; } // 是否可以叠加
[ProtoMember(7)]
public uint SuperposedMax { get; set; } // 叠加
[ProtoMember(8)]
public uint Type { get; set; } // 类型
[ProtoMember(9)]
public bool IsDeal { get; set; } // 是否可以交易
[ProtoMember(10)]
public bool IsSell { get; set; } // 是否可以出售
[ProtoMember(11)]
public int[] Sell { get; set; } = Array.Empty<int>(); // 出售价格
[ProtoMember(12)]
public int Effect { get; set; } // 使用效果
[ProtoMember(13)]
public string[] Params { get; set; } = Array.Empty<string>(); // 效果参数
[ProtoMember(14)]
public int Durable { get; set; } // 耐久度
[ProtoMember(15)]
public int Quality { get; set; } // 品质
[ProtoMember(16)]
public int Position { get; set; } // 装备位置
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 736d7304df10e40e4b20fcce1ec0cf51
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,99 @@
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 LevelConfigData : ASerialize, IConfigTable, IProto
{
[ProtoMember(1)]
public List<LevelConfig> List { get; set; } = new List<LevelConfig>();
#if FANTASY_NET
[ProtoIgnore]
private readonly ConcurrentDictionary<uint, LevelConfig> _configs = new ConcurrentDictionary<uint, LevelConfig>();
#else
[ProtoIgnore]
private readonly Dictionary<uint, LevelConfig> _configs = new Dictionary<uint, LevelConfig>();
#endif
private static LevelConfigData _instance = null;
public static LevelConfigData Instance
{
get { return _instance ??= ConfigTableHelper.Load<LevelConfigData>(); }
private set => _instance = value;
}
public LevelConfig Get(uint id, bool check = true)
{
if (_configs.ContainsKey(id))
{
return _configs[id];
}
if (check)
{
throw new Exception($"LevelConfig not find {id} Id");
}
return null;
}
public bool TryGet(uint id, out LevelConfig 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 LevelConfig : 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 uint Group { get; set; } // 分组
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 60ae3251840bf48c7b8bb30a059c02a8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,105 @@
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 uint Type { get; set; } // 类型
[ProtoMember(5)]
public uint MonsterPRange { get; set; } // 怪物追击范围
[ProtoMember(6)]
public uint TalkConfigId { get; set; } // NPC对话列表Id
[ProtoMember(7)]
public uint Camp { get; set; } // 玩家阵营
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7ba8eb1bdd9f740659c67a32dba1eba2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2673f292fb01410492068cbd15e2341
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,27 @@
namespace Fantasy
{
// 生成器自动生成,请不要手动编辑,修改请在#ConstValue.xsl里。
public partial class ConstValue
{
/// <summary>
/// 游戏版本
/// </summary>
public const string Version = "v202501";
/// <summary>
/// 可以创建角色的最大数量
/// </summary>
public const int CreateRoleMax = 5;
/// <summary>
/// 客户端使用的网络类型
/// </summary>
public const string Network = "KCP";
/// <summary>
/// 客户端发送心跳的时间(毫秒单位)
/// </summary>
public const int Heartbeat = 2000;
/// <summary>
/// 服务器最大容纳玩家人数
/// </summary>
public const int PlayerCount = 5000;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 78d090fa7aa79473fba4f9156b162664
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
using System;
namespace Fantasy
{
// 生成器自动生成,请不要手动编辑,修改请在ContainerConfig.xsl里。
[Flags]
public enum ContainerType : byte
{
None = 0,
Bag = 1,// 背包
Equip = 2,// 装备栏
Trade = 4,// 交易
Cell = Equip | Trade,// 按格子存储的容器
Normal = Bag,// 正常的容器
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 41386197615e84f64a03fec1523194a0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,15 @@
namespace Fantasy
{
// 生成器自动生成,请不要手动编辑,修改请在ErrorCode.xsl里。
public partial class ErrorCode
{
/// <summary>
/// 登陆失败
/// </summary>
public const uint LoingError = 1;
/// <summary>
/// 角色登陆失败
/// </summary>
public const uint LoginRoleError = 2;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52e540e7dcf8241aeb76ce3ace622a06
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
namespace Fantasy
{
// 生成器自动生成,请不要手动编辑,修改请在#ItemType.xsl里。
public enum ItemType
{
None = 0,
Drug = 1,// 药品
Equip = 2,// 装备
Prop = 3,// 道具
Garbage = 4,// 垃圾
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d2dacd15b6b61438eba3c56686b2f7cf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,12 @@
namespace Fantasy
{
// 生成器自动生成,请不要手动编辑,修改请在#ItemUseEffect.xsl里。
public enum ItemUseEffect
{
None = 0,
Equip = 1,// 装备到身上
UnEquip = 2,// 从身上卸下
AddAttr = 3,// 增加属性
CutAttr = 4,// 减少属性
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2cc1f02b07b064cb6a3540aced600b52
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f6f4ef09be2d4afb85592aaf63045e8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,341 @@
using ProtoBuf;
using System.Collections.Generic;
using Fantasy;
using Fantasy.Network.Interface;
using Fantasy.Serialize;
#pragma warning disable CS8618
namespace Fantasy
{
/// <summary>
/// 客户端登陆到服务器
/// </summary>
[ProtoContract]
public partial class C2G_LoginRequest : AMessage, IRequest, IProto
{
public static C2G_LoginRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_LoginRequest>();
}
public override void Dispose()
{
UserName = default;
PassWord = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_LoginRequest>(this);
#endif
}
[ProtoIgnore]
public G2C_LoginResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2G_LoginRequest; }
[ProtoMember(1)]
public string UserName { get; set; }
[ProtoMember(2)]
public string PassWord { get; set; }
}
/// <summary>
/// 服务器返回登陆状态给客户端
/// </summary>
[ProtoContract]
public partial class G2C_LoginResponse : AMessage, IResponse, IProto
{
public static G2C_LoginResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_LoginResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_LoginResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_LoginResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 客户端请求服务器使用物品
/// </summary>
[ProtoContract]
public partial class C2G_UseItemRequest : AMessage, IRequest, IProto
{
public static C2G_UseItemRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_UseItemRequest>();
}
public override void Dispose()
{
ItemId = default;
Count = default;
ContainerType = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_UseItemRequest>(this);
#endif
}
[ProtoIgnore]
public G2C_UseItemResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2G_UseItemRequest; }
[ProtoMember(1)]
public long ItemId { get; set; }
[ProtoMember(2)]
public int Count { get; set; }
[ProtoMember(3)]
public int ContainerType { get; set; }
}
[ProtoContract]
public partial class G2C_UseItemResponse : AMessage, IResponse, IProto
{
public static G2C_UseItemResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_UseItemResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_UseItemResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_UseItemResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 装备基础信息类
/// </summary>
[ProtoContract]
public partial class EquipInfo : AMessage, IProto
{
public static EquipInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<EquipInfo>();
}
public override void Dispose()
{
Durable = default;
DurableMax = default;
MainKeys.Clear();
EquipAttrKeys.Clear();
EquipAttrValues.Clear();
EquipAttrSValues.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<EquipInfo>(this);
#endif
}
[ProtoMember(1)]
public int Durable { get; set; }
[ProtoMember(2)]
public int DurableMax { get; set; }
[ProtoMember(3)]
public List<int> MainKeys = new List<int>();
[ProtoMember(4)]
public List<int> EquipAttrKeys = new List<int>();
[ProtoMember(5)]
public List<int> EquipAttrValues = new List<int>();
[ProtoMember(6)]
public List<int> EquipAttrSValues = new List<int>();
///<summary>
/// 比如强化等级,副属性,词缀等。都可以在这里添加
///</summary>
}
/// <summary>
/// 物品基础信息类
/// </summary>
[ProtoContract]
public partial class ItemInfo : AMessage, IProto
{
public static ItemInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<ItemInfo>();
}
public override void Dispose()
{
ItemId = default;
Container = default;
ConfigId = default;
CellId = default;
Count = default;
IsBind = default;
EquipInfo = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ItemInfo>(this);
#endif
}
[ProtoMember(1)]
public long ItemId { get; set; }
[ProtoMember(2)]
public int Container { get; set; }
[ProtoMember(3)]
public int ConfigId { get; set; }
[ProtoMember(4)]
public long CellId { get; set; }
[ProtoMember(5)]
public int Count { get; set; }
[ProtoMember(6)]
public bool IsBind { get; set; }
[ProtoMember(7)]
public EquipInfo EquipInfo { get; set; }
///<summary>
/// 后面可能会有装备词条 也会在这里定义的,现在没有所以就是先不管了
///</summary>
}
/// <summary>
/// 容器信息类
/// </summary>
[ProtoContract]
public partial class ContainerInfo : AMessage, IProto
{
public static ContainerInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<ContainerInfo>();
}
public override void Dispose()
{
CurrentCellCount = default;
ConfigId = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<ContainerInfo>(this);
#endif
}
[ProtoMember(1)]
public int CurrentCellCount { get; set; }
[ProtoMember(2)]
public int ConfigId { get; set; }
[ProtoMember(3)]
public List<ItemInfo> Items = new List<ItemInfo>();
}
/// <summary>
/// 物品变更协议(服务器推送给客户端)
/// </summary>
[ProtoContract]
public partial class G2C_UpdateItems : AMessage, IMessage, IProto
{
public static G2C_UpdateItems Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_UpdateItems>();
}
public override void Dispose()
{
ItemReason = default;
Items.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_UpdateItems>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_UpdateItems; }
[ProtoMember(1)]
public int ItemReason { get; set; }
[ProtoMember(2)]
public List<ItemInfo> Items = new List<ItemInfo>();
}
/// <summary>
/// 通知服务器客户端初始化完成
/// </summary>
[ProtoContract]
public partial class C2G_GameInitCompleteRequest : AMessage, IRequest, IProto
{
public static C2G_GameInitCompleteRequest Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_GameInitCompleteRequest>();
}
public override void Dispose()
{
PushContainer = default;
PushUnitInfo = default;
Aoi = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_GameInitCompleteRequest>(this);
#endif
}
[ProtoIgnore]
public G2C_GameInitCompleteResponse ResponseType { get; set; }
public uint OpCode() { return OuterOpcode.C2G_GameInitCompleteRequest; }
[ProtoMember(1)]
public bool PushContainer { get; set; }
[ProtoMember(2)]
public bool PushUnitInfo { get; set; }
[ProtoMember(3)]
public bool Aoi { get; set; }
}
[ProtoContract]
public partial class G2C_GameInitCompleteResponse : AMessage, IResponse, IProto
{
public static G2C_GameInitCompleteResponse Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_GameInitCompleteResponse>();
}
public override void Dispose()
{
ErrorCode = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_GameInitCompleteResponse>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_GameInitCompleteResponse; }
[ProtoMember(1)]
public uint ErrorCode { get; set; }
}
/// <summary>
/// 推送所有容器数据给客户端
/// </summary>
[ProtoContract]
public partial class G2C_PushAllContainerInfo : AMessage, IMessage, IProto
{
public static G2C_PushAllContainerInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_PushAllContainerInfo>();
}
public override void Dispose()
{
Containers.Clear();
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_PushAllContainerInfo>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_PushAllContainerInfo; }
[ProtoMember(1)]
public List<ContainerInfo> Containers = new List<ContainerInfo>();
}
/// <summary>
/// 推送单个的容器数据给客户端
/// </summary>
[ProtoContract]
public partial class G2C_PushContainerInfo : AMessage, IMessage, IProto
{
public static G2C_PushContainerInfo Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<G2C_PushContainerInfo>();
}
public override void Dispose()
{
Container = default;
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<G2C_PushContainerInfo>(this);
#endif
}
public uint OpCode() { return OuterOpcode.G2C_PushContainerInfo; }
[ProtoMember(1)]
public ContainerInfo Container { get; set; }
}
/// <summary>
/// 通知服务器创建一个物品到背包容器中。
/// </summary>
[ProtoContract]
public partial class C2G_StartCreateItem : AMessage, IMessage, IProto
{
public static C2G_StartCreateItem Create(Scene scene)
{
return scene.MessagePoolComponent.Rent<C2G_StartCreateItem>();
}
public override void Dispose()
{
#if FANTASY_NET || FANTASY_UNITY
GetScene().MessagePoolComponent.Return<C2G_StartCreateItem>(this);
#endif
}
public uint OpCode() { return OuterOpcode.C2G_StartCreateItem; }
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c24653a7e44534a69812243fb639e44b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,16 @@
namespace Fantasy
{
public static partial class OuterOpcode
{
public const uint C2G_LoginRequest = 268445457;
public const uint G2C_LoginResponse = 402663185;
public const uint C2G_UseItemRequest = 268445458;
public const uint G2C_UseItemResponse = 402663186;
public const uint G2C_UpdateItems = 134227729;
public const uint C2G_GameInitCompleteRequest = 268445459;
public const uint G2C_GameInitCompleteResponse = 402663187;
public const uint G2C_PushAllContainerInfo = 134227730;
public const uint G2C_PushContainerInfo = 134227731;
public const uint C2G_StartCreateItem = 134227732;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f7a4d22b54bb447b79f6b2e64c015560
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,9 @@
namespace Fantasy
{
// Route协议定义(需要定义1000以上、因为1000以内的框架预留)
public static class RouteType
{
public const int GateRoute = 1001; // Gate
public const int ChatRoute = 1002; // Chat
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 51588b3c7353f43a7b77d55ca78e0cae
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: