Files
hjha-server/Config/Code/QueueConfigCategory.cs
xiaoou e9616125ce feat: initial commit - HJHA game server full source
6 major server modules (PdkFriendServer/GlobalSever/ServerCore/GameModule/GameNetModule) +
game logic (GameFix/GameDAL/ServerData) +
network layer (NetWorkMessage) +
data layer (ObjectModel) +
utilities (MrWu/Core/Config/CloudAPI/dll) +
adapters (zyxAdapter/base)

.NET 8.0 C# solution, 16 projects, 958 source files
2026-07-07 12:02:15 +08:00

84 lines
2.5 KiB
C#

//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using Luban;
namespace Server.Config
{
public partial class QueueConfigCategory : ConfigSingleton<QueueConfigCategory>
{
public const string TableName = Tables.QueueConfigCategory;
private readonly System.Collections.Generic.Dictionary<int, QueueConfig> _dataMap;
private readonly System.Collections.Generic.List<QueueConfig> _dataList;
public QueueConfigCategory()
{
_dataMap = new System.Collections.Generic.Dictionary<int, QueueConfig>();
_dataList = new System.Collections.Generic.List<QueueConfig>();
this.ReLoadData();
}
public sealed override void ReLoadData()
{
// 备份旧数据,以便加载失败时回滚
var oldDataList = new System.Collections.Generic.List<QueueConfig>(_dataList);
_dataMap.Clear();
_dataList.Clear();
try
{
byte[] data = TableManager.Instance.GetTableData(TableName);
LoadData(new ByteBuf(data));
}
catch
{
// 加载失败,回滚到旧数据
_dataMap.Clear();
_dataList.Clear();
foreach (var item in oldDataList)
{
_dataList.Add(item);
_dataMap.Add(item.Id, item);
}
throw;
}
}
protected sealed override void LoadData(ByteBuf _buf)
{
for(int n = _buf.ReadSize() ; n > 0 ; --n)
{
QueueConfig _v;
_v = QueueConfig.DeserializeQueueConfig(_buf);
_dataList.Add(_v);
_dataMap.Add(_v.Id, _v);
}
PostInit();
}
public System.Collections.Generic.Dictionary<int, QueueConfig> DataMap => _dataMap;
public System.Collections.Generic.List<QueueConfig> DataList => _dataList;
public QueueConfig GetOrDefault(int key) => _dataMap.TryGetValue(key, out var v) ? v : null;
public QueueConfig Get(int key) => _dataMap[key];
public QueueConfig this[int key] => _dataMap[key];
public bool Contain(int key) => _dataMap.ContainsKey(key);
partial void PostInit();
}
}