You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

292 lines
12 KiB

1 month ago
//============================================
//--4>:
// Exported by ExcelConfigExport
//
// 此代码为工具根据配置自动生成, 请不要修改
//
//============================================
using System;
using Sog;
using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using System.IO;
using System.Linq;
public partial class DropDescMgr : IConfigManager
{
//Singleton
private static DropDescMgr _instance;
private static readonly object syslock = new object();
public static DropDescMgr Instance { get { if (_instance == null) { lock (syslock) { if (_instance == null) { _instance = new DropDescMgr(); }}} return _instance; }}
public class ItemData
{
public DropDesc Item;
public int Line;
public bool ReadAlready;
}
protected Dictionary<int, ItemData> m_ItemTable = new ();
//for server only, m_readKeyOnly must be false
protected SortedList<int, DropDesc> m_ItemDescTable = new ();
public SortedList<int, DropDesc> ItemTable { get {
if (m_ItemDescTable.Count == 0) { foreach (var item in m_ItemTable) { m_ItemDescTable.Add(item.Key, item.Value.Item); }}
return m_ItemDescTable; } }
private TabBinFile m_tbf;
//private TabTextFile m_tf;
private int m_curAsynKey1;
public override bool InitBin(string fileName, byte[] fileContent)
{
m_ErrorCount = 0;
m_ItemTable.Clear();
m_ItemDescTable.Clear();
m_allRead = false;
m_curAsynKey1 = 0;
m_tbf = new TabBinFile(fileName, fileContent);
while (m_tbf.Next())
{
ItemData itemData = new ItemData() { Item = new DropDesc() };
var item = itemData.Item;
if (m_readKeyOnly) {m_tbf.SetCurrentCol(0); }
if (item.ReadItemBin(m_tbf, m_readKeyOnly) == false)
{
TraceLog.Error("Failed to InitBin TabManager:{0}, read line error, line: {1}", this.ToString(), m_tbf.CurrentLine);
m_ErrorCount++;
continue;
}
if (m_ItemTable.ContainsKey(item.GetKey1()))
{
TraceLog.Error("Failed to InitBin TabManager:{0}, multi key:{1}, line: {2}", this.ToString(), item.GetKey1(), m_tbf.CurrentLine);
m_ErrorCount++;
continue;
}
m_ItemTable.Add(item.GetKey1(), itemData);
if (m_readKeyOnly)
{
itemData.Line = m_tbf.CurrentLine;
}
else
{
itemData.ReadAlready = true;
}
}
if (!m_readKeyOnly)
{
m_tbf = null;
}
return true;
}
public DropDesc GetConfig(int key)
{
ItemData itemData;
if (m_ItemTable.TryGetValue(key, out itemData) == false)
{
return null;
}
if(itemData.ReadAlready)
{
return itemData.Item;
}
if (m_tbf == null)
{
TraceLog.Error("Cfg1KeyMgrTemplate.GetConfig Failed fs null TabManager:{ 0}, read line error,", this.ToString());
return null;
}
m_tbf.SetCurrentLine(itemData.Line);
m_tbf.SetCurrentCol(0);
itemData.ReadAlready = true;
if (itemData.Item.ReadItemBin(m_tbf, false) == false)
{
TraceLog.Error("Cfg1KeyMgrTemplate.GetConfig Failed to init TabManager:{0}, read line error, line: {1}", this.ToString(), m_tbf.CurrentLine);
return null;
}
return itemData.Item;
}
}
public partial class DropDesc
{
public partial class BindDropOne
{
/// <summary>
/// 0掉落1类型
/// </summary>
public int wareType{ get; set; }
/// <summary>
/// 0掉落1ID
/// </summary>
public string wareID{ get; set; }
/// <summary>
/// 0掉落1数量
/// </summary>
public int num{ get; set; }
/// <summary>
/// 0掉落1权重
/// </summary>
public int rate{ get; set; }
}
public static readonly string _KEY_id = "id";
public static readonly string _KEY_dropType = "dropType";
public static readonly string _KEY_repeatNum = "repeatNum";
public static readonly string _KEY_bindDropOne_0_wareType = "bindDropOne_0_wareType";
public static readonly string _KEY_bindDropOne_0_wareID = "bindDropOne_0_wareID";
public static readonly string _KEY_bindDropOne_0_num = "bindDropOne_0_num";
public static readonly string _KEY_bindDropOne_0_rate = "bindDropOne_0_rate";
public static readonly string _KEY_bindDropOne_1_wareType = "bindDropOne_1_wareType";
public static readonly string _KEY_bindDropOne_1_wareID = "bindDropOne_1_wareID";
public static readonly string _KEY_bindDropOne_1_num = "bindDropOne_1_num";
public static readonly string _KEY_bindDropOne_1_rate = "bindDropOne_1_rate";
public static readonly string _KEY_bindDropOne_2_wareType = "bindDropOne_2_wareType";
public static readonly string _KEY_bindDropOne_2_wareID = "bindDropOne_2_wareID";
public static readonly string _KEY_bindDropOne_2_num = "bindDropOne_2_num";
public static readonly string _KEY_bindDropOne_2_rate = "bindDropOne_2_rate";
public static readonly string _KEY_bindDropOne_3_wareType = "bindDropOne_3_wareType";
public static readonly string _KEY_bindDropOne_3_wareID = "bindDropOne_3_wareID";
public static readonly string _KEY_bindDropOne_3_num = "bindDropOne_3_num";
public static readonly string _KEY_bindDropOne_3_rate = "bindDropOne_3_rate";
public static readonly string _KEY_bindDropOne_4_wareType = "bindDropOne_4_wareType";
public static readonly string _KEY_bindDropOne_4_wareID = "bindDropOne_4_wareID";
public static readonly string _KEY_bindDropOne_4_num = "bindDropOne_4_num";
public static readonly string _KEY_bindDropOne_4_rate = "bindDropOne_4_rate";
public static readonly string _KEY_bindDropOne_5_wareType = "bindDropOne_5_wareType";
public static readonly string _KEY_bindDropOne_5_wareID = "bindDropOne_5_wareID";
public static readonly string _KEY_bindDropOne_5_num = "bindDropOne_5_num";
public static readonly string _KEY_bindDropOne_5_rate = "bindDropOne_5_rate";
public static readonly string _KEY_bindDropOne_6_wareType = "bindDropOne_6_wareType";
public static readonly string _KEY_bindDropOne_6_wareID = "bindDropOne_6_wareID";
public static readonly string _KEY_bindDropOne_6_num = "bindDropOne_6_num";
public static readonly string _KEY_bindDropOne_6_rate = "bindDropOne_6_rate";
public static readonly string _KEY_bindDropOne_7_wareType = "bindDropOne_7_wareType";
public static readonly string _KEY_bindDropOne_7_wareID = "bindDropOne_7_wareID";
public static readonly string _KEY_bindDropOne_7_num = "bindDropOne_7_num";
public static readonly string _KEY_bindDropOne_7_rate = "bindDropOne_7_rate";
public static readonly string _KEY_bindDropOne_8_wareType = "bindDropOne_8_wareType";
public static readonly string _KEY_bindDropOne_8_wareID = "bindDropOne_8_wareID";
public static readonly string _KEY_bindDropOne_8_num = "bindDropOne_8_num";
public static readonly string _KEY_bindDropOne_8_rate = "bindDropOne_8_rate";
public static readonly string _KEY_bindDropOne_9_wareType = "bindDropOne_9_wareType";
public static readonly string _KEY_bindDropOne_9_wareID = "bindDropOne_9_wareID";
public static readonly string _KEY_bindDropOne_9_num = "bindDropOne_9_num";
public static readonly string _KEY_bindDropOne_9_rate = "bindDropOne_9_rate";
public static readonly string _KEY_bindDropOne_10_wareType = "bindDropOne_10_wareType";
public static readonly string _KEY_bindDropOne_10_wareID = "bindDropOne_10_wareID";
public static readonly string _KEY_bindDropOne_10_num = "bindDropOne_10_num";
public static readonly string _KEY_bindDropOne_10_rate = "bindDropOne_10_rate";
public static readonly string _KEY_bindDropOne_11_wareType = "bindDropOne_11_wareType";
public static readonly string _KEY_bindDropOne_11_wareID = "bindDropOne_11_wareID";
public static readonly string _KEY_bindDropOne_11_num = "bindDropOne_11_num";
public static readonly string _KEY_bindDropOne_11_rate = "bindDropOne_11_rate";
/// <summary>
/// 掉落主键ID
/// </summary>
public int id { get; set; }
/// <summary>
/// 掉落类型
/// </summary>
public int dropType { get; set; }
/// <summary>
/// 扔筛子次数
/// </summary>
public int repeatNum { get; set; }
public BindDropOne[] bindDropOne { get; set; }
public Dictionary<string, Type> listDic = new Dictionary<string, Type>();
public DropDesc()
{
bindDropOne = new BindDropOne[12];
bindDropOne[0] = new BindDropOne();
bindDropOne[1] = new BindDropOne();
bindDropOne[2] = new BindDropOne();
bindDropOne[3] = new BindDropOne();
bindDropOne[4] = new BindDropOne();
bindDropOne[5] = new BindDropOne();
bindDropOne[6] = new BindDropOne();
bindDropOne[7] = new BindDropOne();
bindDropOne[8] = new BindDropOne();
bindDropOne[9] = new BindDropOne();
bindDropOne[10] = new BindDropOne();
bindDropOne[11] = new BindDropOne();
listDic.Add("bindDropOne", typeof(BindDropOne));
}
public int GetKey1() { return id; }
public bool ReadItemBin(TabBinFile txf, bool readKeyOnly)
{
id = txf.GetintByIndex(_KEY_id);
if(readKeyOnly) { return true; }
dropType = txf.GetintByIndex(_KEY_dropType);
repeatNum = txf.GetintByIndex(_KEY_repeatNum);
bindDropOne[0].wareType = txf.GetintByIndex(_KEY_bindDropOne_0_wareType);
bindDropOne[0].wareID = txf.GetstringByIndex(_KEY_bindDropOne_0_wareID);
bindDropOne[0].num = txf.GetintByIndex(_KEY_bindDropOne_0_num);
bindDropOne[0].rate = txf.GetintByIndex(_KEY_bindDropOne_0_rate);
bindDropOne[1].wareType = txf.GetintByIndex(_KEY_bindDropOne_1_wareType);
bindDropOne[1].wareID = txf.GetstringByIndex(_KEY_bindDropOne_1_wareID);
bindDropOne[1].num = txf.GetintByIndex(_KEY_bindDropOne_1_num);
bindDropOne[1].rate = txf.GetintByIndex(_KEY_bindDropOne_1_rate);
bindDropOne[2].wareType = txf.GetintByIndex(_KEY_bindDropOne_2_wareType);
bindDropOne[2].wareID = txf.GetstringByIndex(_KEY_bindDropOne_2_wareID);
bindDropOne[2].num = txf.GetintByIndex(_KEY_bindDropOne_2_num);
bindDropOne[2].rate = txf.GetintByIndex(_KEY_bindDropOne_2_rate);
bindDropOne[3].wareType = txf.GetintByIndex(_KEY_bindDropOne_3_wareType);
bindDropOne[3].wareID = txf.GetstringByIndex(_KEY_bindDropOne_3_wareID);
bindDropOne[3].num = txf.GetintByIndex(_KEY_bindDropOne_3_num);
bindDropOne[3].rate = txf.GetintByIndex(_KEY_bindDropOne_3_rate);
bindDropOne[4].wareType = txf.GetintByIndex(_KEY_bindDropOne_4_wareType);
bindDropOne[4].wareID = txf.GetstringByIndex(_KEY_bindDropOne_4_wareID);
bindDropOne[4].num = txf.GetintByIndex(_KEY_bindDropOne_4_num);
bindDropOne[4].rate = txf.GetintByIndex(_KEY_bindDropOne_4_rate);
bindDropOne[5].wareType = txf.GetintByIndex(_KEY_bindDropOne_5_wareType);
bindDropOne[5].wareID = txf.GetstringByIndex(_KEY_bindDropOne_5_wareID);
bindDropOne[5].num = txf.GetintByIndex(_KEY_bindDropOne_5_num);
bindDropOne[5].rate = txf.GetintByIndex(_KEY_bindDropOne_5_rate);
bindDropOne[6].wareType = txf.GetintByIndex(_KEY_bindDropOne_6_wareType);
bindDropOne[6].wareID = txf.GetstringByIndex(_KEY_bindDropOne_6_wareID);
bindDropOne[6].num = txf.GetintByIndex(_KEY_bindDropOne_6_num);
bindDropOne[6].rate = txf.GetintByIndex(_KEY_bindDropOne_6_rate);
bindDropOne[7].wareType = txf.GetintByIndex(_KEY_bindDropOne_7_wareType);
bindDropOne[7].wareID = txf.GetstringByIndex(_KEY_bindDropOne_7_wareID);
bindDropOne[7].num = txf.GetintByIndex(_KEY_bindDropOne_7_num);
bindDropOne[7].rate = txf.GetintByIndex(_KEY_bindDropOne_7_rate);
bindDropOne[8].wareType = txf.GetintByIndex(_KEY_bindDropOne_8_wareType);
bindDropOne[8].wareID = txf.GetstringByIndex(_KEY_bindDropOne_8_wareID);
bindDropOne[8].num = txf.GetintByIndex(_KEY_bindDropOne_8_num);
bindDropOne[8].rate = txf.GetintByIndex(_KEY_bindDropOne_8_rate);
bindDropOne[9].wareType = txf.GetintByIndex(_KEY_bindDropOne_9_wareType);
bindDropOne[9].wareID = txf.GetstringByIndex(_KEY_bindDropOne_9_wareID);
bindDropOne[9].num = txf.GetintByIndex(_KEY_bindDropOne_9_num);
bindDropOne[9].rate = txf.GetintByIndex(_KEY_bindDropOne_9_rate);
bindDropOne[10].wareType = txf.GetintByIndex(_KEY_bindDropOne_10_wareType);
bindDropOne[10].wareID = txf.GetstringByIndex(_KEY_bindDropOne_10_wareID);
bindDropOne[10].num = txf.GetintByIndex(_KEY_bindDropOne_10_num);
bindDropOne[10].rate = txf.GetintByIndex(_KEY_bindDropOne_10_rate);
bindDropOne[11].wareType = txf.GetintByIndex(_KEY_bindDropOne_11_wareType);
bindDropOne[11].wareID = txf.GetstringByIndex(_KEY_bindDropOne_11_wareID);
bindDropOne[11].num = txf.GetintByIndex(_KEY_bindDropOne_11_num);
bindDropOne[11].rate = txf.GetintByIndex(_KEY_bindDropOne_11_rate);
return true;
}
}