提交示例代码
This commit is contained in:
BIN
物品和背包的完整代码/Server/Entity/Generate/.DS_Store
vendored
Normal file
BIN
物品和背包的完整代码/Server/Entity/Generate/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -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; } // 是否可以整理
|
||||
}
|
||||
}
|
||||
@@ -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; } // 介绍
|
||||
}
|
||||
}
|
||||
@@ -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>(); // 属性数组
|
||||
}
|
||||
}
|
||||
@@ -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; } // 法术强度
|
||||
}
|
||||
}
|
||||
@@ -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; } // 文本内容
|
||||
}
|
||||
}
|
||||
@@ -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; } // 装备位置
|
||||
}
|
||||
}
|
||||
@@ -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; } // 分组
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
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; } // 玩家阵营
|
||||
[ProtoMember(8)]
|
||||
public uint[] MountContainer { get; set; } = Array.Empty<uint>(); // 挂载的容器列表
|
||||
[ProtoMember(9)]
|
||||
public uint[] Items { get; set; } = Array.Empty<uint>(); // 容器物品初始列表
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
namespace Fantasy;
|
||||
|
||||
public sealed partial class ContainerConfigData
|
||||
{
|
||||
private readonly Dictionary<int, ContainerConfig> _configsByType = new Dictionary<int, ContainerConfig>();
|
||||
|
||||
public override void EndInit()
|
||||
{
|
||||
foreach (var containerConfig in List)
|
||||
{
|
||||
_configsByType.Add(containerConfig.Type, containerConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public ContainerConfig GetConfig(ContainerType containerType)
|
||||
{
|
||||
if (!_configsByType.TryGetValue((int)containerType, out var config))
|
||||
{
|
||||
Log.Error($"containerType {containerType} not found!");
|
||||
return null;
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
public bool TryGetConfig(ContainerType containerType, out ContainerConfig containerConfig)
|
||||
{
|
||||
if (!_configsByType.TryGetValue((int)containerType, out containerConfig))
|
||||
{
|
||||
Log.Error($"containerType {containerType} not found!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#pragma warning disable CS8601 // Possible null reference assignment.
|
||||
namespace Fantasy;
|
||||
|
||||
public partial class EquipValueConfigData
|
||||
{
|
||||
private readonly Dictionary<ulong, EquipValueConfig> _equipValueDic = new Dictionary<ulong, EquipValueConfig>();
|
||||
public override void EndInit()
|
||||
{
|
||||
foreach (var equipValueConfig in List)
|
||||
{
|
||||
var equipValueKey = GetEquipValueKey(equipValueConfig.ItemConfigId, equipValueConfig.Quality);
|
||||
_equipValueDic.Add(equipValueKey, equipValueConfig);
|
||||
}
|
||||
}
|
||||
|
||||
public bool TryGetValue(uint itemConfigId, int quality, out EquipValueConfig value)
|
||||
{
|
||||
var equipValueKey = GetEquipValueKey(itemConfigId, quality);
|
||||
|
||||
if (!_equipValueDic.TryGetValue(equipValueKey, out value))
|
||||
{
|
||||
Log.Error($"itemConfigId: {itemConfigId} and quality: {quality} not found in EquipValueConfig!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private ulong GetEquipValueKey(uint itemConfigId, int quality)
|
||||
{
|
||||
return ((ulong)itemConfigId << 32) | (uint)quality;
|
||||
}
|
||||
}
|
||||
27
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ConstValue.cs
Normal file
27
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ConstValue.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// 生成器自动生成,请不要手动编辑,修改请在#ConstValue.xsl里。
|
||||
public partial class ConstValue
|
||||
{
|
||||
/// <summary>
|
||||
/// 游戏版本
|
||||
/// </summary>
|
||||
public const string Version = "v202501";
|
||||
/// <summary>
|
||||
/// JWT令牌加密密钥
|
||||
/// </summary>
|
||||
public const string JWTSecret = "6666";
|
||||
/// <summary>
|
||||
/// 客户端使用的网络类型
|
||||
/// </summary>
|
||||
public const string Network = "KCP";
|
||||
/// <summary>
|
||||
/// 客户端发送心跳的时间(毫秒单位)
|
||||
/// </summary>
|
||||
public const int Heartbeat = 2000;
|
||||
/// <summary>
|
||||
/// 服务器最大容纳玩家人数
|
||||
/// </summary>
|
||||
public const int PlayerCount = 5000;
|
||||
}
|
||||
}
|
||||
@@ -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,// 正常的容器
|
||||
}
|
||||
}
|
||||
15
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ErrorCode.cs
Normal file
15
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ErrorCode.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
12
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ItemType.cs
Normal file
12
物品和背包的完整代码/Server/Entity/Generate/CustomExport/ItemType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// 生成器自动生成,请不要手动编辑,修改请在#ItemType.xsl里。
|
||||
public enum ItemType
|
||||
{
|
||||
None = 0,
|
||||
Drug = 1,// 药品
|
||||
Equip = 2,// 装备
|
||||
Prop = 3,// 道具
|
||||
Garbage = 4,// 垃圾
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// 生成器自动生成,请不要手动编辑,修改请在#ItemUseEffect.xsl里。
|
||||
public enum ItemUseEffect
|
||||
{
|
||||
None = 0,
|
||||
Equip = 1,// 装备到身上
|
||||
UnEquip = 2,// 从身上卸下
|
||||
AddAttr = 3,// 增加属性
|
||||
CutAttr = 4,// 减少属性
|
||||
}
|
||||
}
|
||||
27
物品和背包的完整代码/Server/Entity/Generate/CustomExport/SceneType.cs
Normal file
27
物品和背包的完整代码/Server/Entity/Generate/CustomExport/SceneType.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
// 生成器自动生成,请不要手动编辑。
|
||||
public static class SceneType
|
||||
{
|
||||
public const int Authentication = 1;
|
||||
public const int Addressable = 2;
|
||||
public const int Gate = 3;
|
||||
public const int Map = 4;
|
||||
public const int CopyDispatcher = 5;
|
||||
public const int CopyManager = 6;
|
||||
public const int Copy = 7;
|
||||
public const int Chat = 8;
|
||||
|
||||
public static readonly Dictionary<string, int> SceneTypeDic = new Dictionary<string, int>()
|
||||
{
|
||||
{ "Authentication", 1 },
|
||||
{ "Addressable", 2 },
|
||||
{ "Gate", 3 },
|
||||
{ "Map", 4 },
|
||||
{ "CopyDispatcher", 5 },
|
||||
{ "CopyManager", 6 },
|
||||
{ "Copy", 7 },
|
||||
{ "Chat", 8 },
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Fantasy;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
// ReSharper disable RedundantOverriddenMember
|
||||
// ReSharper disable PartialTypeWithSinglePart
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
#pragma warning disable CS8618
|
||||
|
||||
namespace Fantasy
|
||||
{
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestMessage : AMessage, IRouteMessage, IProto
|
||||
{
|
||||
public static G2A_TestMessage Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestMessage>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
Tag = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestMessage>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestMessage; }
|
||||
[ProtoMember(1)]
|
||||
public string Tag { get; set; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestRequest : AMessage, IRouteRequest, IProto
|
||||
{
|
||||
public static G2A_TestRequest Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestRequest>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestRequest>(this);
|
||||
#endif
|
||||
}
|
||||
[ProtoIgnore]
|
||||
public G2A_TestResponse ResponseType { get; set; }
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestRequest; }
|
||||
}
|
||||
[ProtoContract]
|
||||
public partial class G2A_TestResponse : AMessage, IRouteResponse, IProto
|
||||
{
|
||||
public static G2A_TestResponse Create(Scene scene)
|
||||
{
|
||||
return scene.MessagePoolComponent.Rent<G2A_TestResponse>();
|
||||
}
|
||||
public override void Dispose()
|
||||
{
|
||||
ErrorCode = default;
|
||||
#if FANTASY_NET || FANTASY_UNITY
|
||||
GetScene().MessagePoolComponent.Return<G2A_TestResponse>(this);
|
||||
#endif
|
||||
}
|
||||
public uint OpCode() { return InnerOpcode.G2A_TestResponse; }
|
||||
[ProtoMember(1)]
|
||||
public uint ErrorCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Fantasy
|
||||
{
|
||||
public static partial class InnerOpcode
|
||||
{
|
||||
public const uint G2A_TestMessage = 939534097;
|
||||
public const uint G2A_TestRequest = 1073751825;
|
||||
public const uint G2A_TestResponse = 1207969553;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
using ProtoBuf;
|
||||
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using Fantasy;
|
||||
using Fantasy.Network.Interface;
|
||||
using Fantasy.Serialize;
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable RedundantUsingDirective
|
||||
// ReSharper disable RedundantOverriddenMember
|
||||
// ReSharper disable PartialTypeWithSinglePart
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable CheckNamespace
|
||||
#pragma warning disable CS8625 // Cannot convert null literal to non-nullable reference type.
|
||||
#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; }
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user