//============================================ //--4>: // Exported by ExcelConfigExport // // 此代码为工具根据配置自动生成, 请不要修改 // //============================================ using System; using Sog; using System.Collections.Generic; #if UNITY_2019_1_OR_NEWER using GameLogic; #endif public partial class HorseDescMgr : IConfigManager { //Singleton private static HorseDescMgr _instance; private static readonly object syslock = new object(); public static HorseDescMgr Instance { get { if (_instance == null) { lock (syslock) { if (_instance == null) { _instance = new HorseDescMgr(); }}} return _instance; }} public class ItemData { public HorseDesc Item; public int Line; public bool ReadAlready; } protected SortedList m_ItemTable = new SortedList(); //for server only, m_readKeyOnly must be false protected SortedList m_ItemDescTable = new SortedList(); public SortedList 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 HorseDesc() }; 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; } #if UNITY_2019_1_OR_NEWER public override bool InitBinByIL(string fileName, byte[] fileContent) { m_ErrorCount = 0; m_ItemTable.Clear(); m_tbf = new TabBinFile(fileName, fileContent); while (m_tbf.Next()) { ItemData itemData = new ItemData() { Item = new HorseDesc() }; int keyCount = 0; if(m_readKeyOnly) { keyCount = 1;} var item = itemData.Item; item = item.ReadItemInIL(m_tbf, keyCount); if (item == null) { TraceLog.Error("Failed to init 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 init 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; } } return true; } #endif public HorseDesc 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 override int AsynReadBin(int maxTimes) { int times = 0; if (m_allRead) { return times; } if (m_tbf == null) { return times; } for (; m_curAsynKey1 < m_ItemTable.Count && times < maxTimes; m_curAsynKey1++) { var itemData = m_ItemTable.Values[m_curAsynKey1]; if (itemData.ReadAlready) { continue; } m_tbf.SetCurrentLine(itemData.Line); m_tbf.SetCurrentCol(0); itemData.ReadAlready = true; if (itemData.Item.ReadItemBin(m_tbf, false) == false) { TraceLog.Error("Cfg1KeyMgrTemplate.AsynReadBin Failed to init TabManager:{ 0}, read line error, line: { 1}", this.ToString(), m_tbf.CurrentLine); return times; } times++; } if (m_curAsynKey1 >= m_ItemTable.Count) { m_allRead = true; m_tbf = null; } return times; } } public partial class HorseDesc { public partial class ExtraProp { public int[] id{ get; set; } // 0//坐骑进阶特性属性类型 属性id;属性id, public int[] weight{ get; set; } // 0//坐骑进阶特性属性权重 对应属性id权重;对应属性id权重; public int[] reweight{ get; set; } // 0//每次进阶后,特性属性权重变化 public int[] min{ get; set; } // 0//坐骑进阶特性属性对应类型 成长最小值(万分比) public int[] max{ get; set; } // 0//坐骑进阶特性属性对应类型 成长最大值(万分比) } public static readonly string _KEY_id = "id"; public static readonly string _KEY_quality = "quality"; public static readonly string _KEY_maxLevel = "maxLevel"; public static readonly string _KEY_baseExtraPropId = "baseExtraPropId"; public static readonly string _KEY_baseExtraPropNum = "baseExtraPropNum"; public static readonly string _KEY_baseHpType = "baseHpType"; public static readonly string _KEY_baseAtkType = "baseAtkType"; public static readonly string _KEY_baseDefType = "baseDefType"; public static readonly string _KEY_baseHp = "baseHp"; public static readonly string _KEY_baseAtk = "baseAtk"; public static readonly string _KEY_baseDef = "baseDef"; public static readonly string _KEY_levelUpHp = "levelUpHp"; public static readonly string _KEY_levelUpAtk = "levelUpAtk"; public static readonly string _KEY_levelUpDef = "levelUpDef"; public static readonly string _KEY_extraProp_0_id_6_0 = "extraProp_0_id_6_0"; public static readonly string _KEY_extraProp_0_id_6_1 = "extraProp_0_id_6_1"; public static readonly string _KEY_extraProp_0_id_6_2 = "extraProp_0_id_6_2"; public static readonly string _KEY_extraProp_0_id_6_3 = "extraProp_0_id_6_3"; public static readonly string _KEY_extraProp_0_id_6_4 = "extraProp_0_id_6_4"; public static readonly string _KEY_extraProp_0_id_6_5 = "extraProp_0_id_6_5"; public static readonly string _KEY_extraProp_0_weight_6_0 = "extraProp_0_weight_6_0"; public static readonly string _KEY_extraProp_0_weight_6_1 = "extraProp_0_weight_6_1"; public static readonly string _KEY_extraProp_0_weight_6_2 = "extraProp_0_weight_6_2"; public static readonly string _KEY_extraProp_0_weight_6_3 = "extraProp_0_weight_6_3"; public static readonly string _KEY_extraProp_0_weight_6_4 = "extraProp_0_weight_6_4"; public static readonly string _KEY_extraProp_0_weight_6_5 = "extraProp_0_weight_6_5"; public static readonly string _KEY_extraProp_0_reweight_6_0 = "extraProp_0_reweight_6_0"; public static readonly string _KEY_extraProp_0_reweight_6_1 = "extraProp_0_reweight_6_1"; public static readonly string _KEY_extraProp_0_reweight_6_2 = "extraProp_0_reweight_6_2"; public static readonly string _KEY_extraProp_0_reweight_6_3 = "extraProp_0_reweight_6_3"; public static readonly string _KEY_extraProp_0_reweight_6_4 = "extraProp_0_reweight_6_4"; public static readonly string _KEY_extraProp_0_reweight_6_5 = "extraProp_0_reweight_6_5"; public static readonly string _KEY_extraProp_0_min_6_0 = "extraProp_0_min_6_0"; public static readonly string _KEY_extraProp_0_min_6_1 = "extraProp_0_min_6_1"; public static readonly string _KEY_extraProp_0_min_6_2 = "extraProp_0_min_6_2"; public static readonly string _KEY_extraProp_0_min_6_3 = "extraProp_0_min_6_3"; public static readonly string _KEY_extraProp_0_min_6_4 = "extraProp_0_min_6_4"; public static readonly string _KEY_extraProp_0_min_6_5 = "extraProp_0_min_6_5"; public static readonly string _KEY_extraProp_0_max_6_0 = "extraProp_0_max_6_0"; public static readonly string _KEY_extraProp_0_max_6_1 = "extraProp_0_max_6_1"; public static readonly string _KEY_extraProp_0_max_6_2 = "extraProp_0_max_6_2"; public static readonly string _KEY_extraProp_0_max_6_3 = "extraProp_0_max_6_3"; public static readonly string _KEY_extraProp_0_max_6_4 = "extraProp_0_max_6_4"; public static readonly string _KEY_extraProp_0_max_6_5 = "extraProp_0_max_6_5"; public static readonly string _KEY_levelUpCostType = "levelUpCostType"; public static readonly string _KEY_levelUpCostID = "levelUpCostID"; public static readonly string _KEY_levelUpCostNum1 = "levelUpCostNum1"; public static readonly string _KEY_levelUpCostNum2 = "levelUpCostNum2"; public static readonly string _KEY_levelUpCostNum3 = "levelUpCostNum3"; public static readonly string _KEY_levelUpCostNum4 = "levelUpCostNum4"; public static readonly string _KEY_levelUpCostNum5 = "levelUpCostNum5"; public static readonly string _KEY_levelUpCostNum6 = "levelUpCostNum6"; public static readonly string _KEY_levelUpCostNum7 = "levelUpCostNum7"; public static readonly string _KEY_levelUpCostNum8 = "levelUpCostNum8"; public static readonly string _KEY_exploreOutputPerSecond = "exploreOutputPerSecond"; public int id { get; set; } // // 等级 public int quality { get; set; } // //坐骑品质 public int maxLevel { get; set; } // 坐骑坐骑最大等级 public int baseExtraPropId { get; set; } // //坐骑初始额外属性类型 public int baseExtraPropNum { get; set; } // //坐骑初始额外属性(万分比) public int baseHpType { get; set; } // //生命百分比类型 public int baseAtkType { get; set; } // //攻击百分比类型 public int baseDefType { get; set; } // //防御百分比类型 public int baseHp { get; set; } // // 坐骑初始生命(万分比) public int baseAtk { get; set; } // // 坐骑初始攻击(万分比) public int baseDef { get; set; } // // 坐骑初始防御(万分比) public int levelUpHp { get; set; } // // 坐骑升级生命成长(万分比) public int levelUpAtk { get; set; } // // 坐骑升级攻击成长(万分比) public int levelUpDef { get; set; } // // 坐骑升级防御成长(万分比) public ExtraProp[] extraProp { get; set; } public int levelUpCostType { get; set; } // //坐骑升级消耗道具类型 public int levelUpCostID { get; set; } // //坐骑升级消耗道具id public int levelUpCostNum1 { get; set; } // //1-5级升级消耗道具数量 public int levelUpCostNum2 { get; set; } // //6-10级升级消耗道具数量 public int levelUpCostNum3 { get; set; } // //11-15级升级消耗道具数量 public int levelUpCostNum4 { get; set; } // //16-20级升级消耗道具数量 public int levelUpCostNum5 { get; set; } // //21-25级升级消耗道具数量 public int levelUpCostNum6 { get; set; } // //26-30级升级消耗道具数量 public int levelUpCostNum7 { get; set; } // //31-35级升级消耗道具数量 public int levelUpCostNum8 { get; set; } // //36-40级升级消耗道具数量 public int exploreOutputPerSecond { get; set; } // //探索每秒获得道具数量(万分比) public Dictionary listDic = new Dictionary(); public HorseDesc() { extraProp = new ExtraProp[1]; extraProp[0] = new ExtraProp(); listDic.Add("extraProp", typeof(ExtraProp)); extraProp[0].id = new int[6]; extraProp[0].weight = new int[6]; extraProp[0].reweight = new int[6]; extraProp[0].min = new int[6]; extraProp[0].max = new int[6]; } public int GetKey1() { return id; } public bool ReadItem(TabTextFile txf, bool readKeyOnly) { id = txf.Get(_KEY_id); if(readKeyOnly) { return true; } quality = txf.Get(_KEY_quality); maxLevel = txf.Get(_KEY_maxLevel); baseExtraPropId = txf.Get(_KEY_baseExtraPropId); baseExtraPropNum = txf.Get(_KEY_baseExtraPropNum); baseHpType = txf.Get(_KEY_baseHpType); baseAtkType = txf.Get(_KEY_baseAtkType); baseDefType = txf.Get(_KEY_baseDefType); baseHp = txf.Get(_KEY_baseHp); baseAtk = txf.Get(_KEY_baseAtk); baseDef = txf.Get(_KEY_baseDef); levelUpHp = txf.Get(_KEY_levelUpHp); levelUpAtk = txf.Get(_KEY_levelUpAtk); levelUpDef = txf.Get(_KEY_levelUpDef); extraProp[0].id[0] = txf.Get(_KEY_extraProp_0_id_6_0); extraProp[0].id[1] = txf.Get(_KEY_extraProp_0_id_6_1); extraProp[0].id[2] = txf.Get(_KEY_extraProp_0_id_6_2); extraProp[0].id[3] = txf.Get(_KEY_extraProp_0_id_6_3); extraProp[0].id[4] = txf.Get(_KEY_extraProp_0_id_6_4); extraProp[0].id[5] = txf.Get(_KEY_extraProp_0_id_6_5); extraProp[0].weight[0] = txf.Get(_KEY_extraProp_0_weight_6_0); extraProp[0].weight[1] = txf.Get(_KEY_extraProp_0_weight_6_1); extraProp[0].weight[2] = txf.Get(_KEY_extraProp_0_weight_6_2); extraProp[0].weight[3] = txf.Get(_KEY_extraProp_0_weight_6_3); extraProp[0].weight[4] = txf.Get(_KEY_extraProp_0_weight_6_4); extraProp[0].weight[5] = txf.Get(_KEY_extraProp_0_weight_6_5); extraProp[0].reweight[0] = txf.Get(_KEY_extraProp_0_reweight_6_0); extraProp[0].reweight[1] = txf.Get(_KEY_extraProp_0_reweight_6_1); extraProp[0].reweight[2] = txf.Get(_KEY_extraProp_0_reweight_6_2); extraProp[0].reweight[3] = txf.Get(_KEY_extraProp_0_reweight_6_3); extraProp[0].reweight[4] = txf.Get(_KEY_extraProp_0_reweight_6_4); extraProp[0].reweight[5] = txf.Get(_KEY_extraProp_0_reweight_6_5); extraProp[0].min[0] = txf.Get(_KEY_extraProp_0_min_6_0); extraProp[0].min[1] = txf.Get(_KEY_extraProp_0_min_6_1); extraProp[0].min[2] = txf.Get(_KEY_extraProp_0_min_6_2); extraProp[0].min[3] = txf.Get(_KEY_extraProp_0_min_6_3); extraProp[0].min[4] = txf.Get(_KEY_extraProp_0_min_6_4); extraProp[0].min[5] = txf.Get(_KEY_extraProp_0_min_6_5); extraProp[0].max[0] = txf.Get(_KEY_extraProp_0_max_6_0); extraProp[0].max[1] = txf.Get(_KEY_extraProp_0_max_6_1); extraProp[0].max[2] = txf.Get(_KEY_extraProp_0_max_6_2); extraProp[0].max[3] = txf.Get(_KEY_extraProp_0_max_6_3); extraProp[0].max[4] = txf.Get(_KEY_extraProp_0_max_6_4); extraProp[0].max[5] = txf.Get(_KEY_extraProp_0_max_6_5); levelUpCostType = txf.Get(_KEY_levelUpCostType); levelUpCostID = txf.Get(_KEY_levelUpCostID); levelUpCostNum1 = txf.Get(_KEY_levelUpCostNum1); levelUpCostNum2 = txf.Get(_KEY_levelUpCostNum2); levelUpCostNum3 = txf.Get(_KEY_levelUpCostNum3); levelUpCostNum4 = txf.Get(_KEY_levelUpCostNum4); levelUpCostNum5 = txf.Get(_KEY_levelUpCostNum5); levelUpCostNum6 = txf.Get(_KEY_levelUpCostNum6); levelUpCostNum7 = txf.Get(_KEY_levelUpCostNum7); levelUpCostNum8 = txf.Get(_KEY_levelUpCostNum8); exploreOutputPerSecond = txf.Get(_KEY_exploreOutputPerSecond); return true; } public bool ReadItemBin(TabBinFile txf, bool readKeyOnly) { id = txf.GetintByIndex(_KEY_id); if(readKeyOnly) { return true; } quality = txf.GetintByIndex(_KEY_quality); maxLevel = txf.GetintByIndex(_KEY_maxLevel); baseExtraPropId = txf.GetintByIndex(_KEY_baseExtraPropId); baseExtraPropNum = txf.GetintByIndex(_KEY_baseExtraPropNum); baseHpType = txf.GetintByIndex(_KEY_baseHpType); baseAtkType = txf.GetintByIndex(_KEY_baseAtkType); baseDefType = txf.GetintByIndex(_KEY_baseDefType); baseHp = txf.GetintByIndex(_KEY_baseHp); baseAtk = txf.GetintByIndex(_KEY_baseAtk); baseDef = txf.GetintByIndex(_KEY_baseDef); levelUpHp = txf.GetintByIndex(_KEY_levelUpHp); levelUpAtk = txf.GetintByIndex(_KEY_levelUpAtk); levelUpDef = txf.GetintByIndex(_KEY_levelUpDef); extraProp[0].id[0] = txf.GetintByIndex(_KEY_extraProp_0_id_6_0); extraProp[0].id[1] = txf.GetintByIndex(_KEY_extraProp_0_id_6_1); extraProp[0].id[2] = txf.GetintByIndex(_KEY_extraProp_0_id_6_2); extraProp[0].id[3] = txf.GetintByIndex(_KEY_extraProp_0_id_6_3); extraProp[0].id[4] = txf.GetintByIndex(_KEY_extraProp_0_id_6_4); extraProp[0].id[5] = txf.GetintByIndex(_KEY_extraProp_0_id_6_5); extraProp[0].weight[0] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_0); extraProp[0].weight[1] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_1); extraProp[0].weight[2] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_2); extraProp[0].weight[3] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_3); extraProp[0].weight[4] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_4); extraProp[0].weight[5] = txf.GetintByIndex(_KEY_extraProp_0_weight_6_5); extraProp[0].reweight[0] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_0); extraProp[0].reweight[1] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_1); extraProp[0].reweight[2] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_2); extraProp[0].reweight[3] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_3); extraProp[0].reweight[4] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_4); extraProp[0].reweight[5] = txf.GetintByIndex(_KEY_extraProp_0_reweight_6_5); extraProp[0].min[0] = txf.GetintByIndex(_KEY_extraProp_0_min_6_0); extraProp[0].min[1] = txf.GetintByIndex(_KEY_extraProp_0_min_6_1); extraProp[0].min[2] = txf.GetintByIndex(_KEY_extraProp_0_min_6_2); extraProp[0].min[3] = txf.GetintByIndex(_KEY_extraProp_0_min_6_3); extraProp[0].min[4] = txf.GetintByIndex(_KEY_extraProp_0_min_6_4); extraProp[0].min[5] = txf.GetintByIndex(_KEY_extraProp_0_min_6_5); extraProp[0].max[0] = txf.GetintByIndex(_KEY_extraProp_0_max_6_0); extraProp[0].max[1] = txf.GetintByIndex(_KEY_extraProp_0_max_6_1); extraProp[0].max[2] = txf.GetintByIndex(_KEY_extraProp_0_max_6_2); extraProp[0].max[3] = txf.GetintByIndex(_KEY_extraProp_0_max_6_3); extraProp[0].max[4] = txf.GetintByIndex(_KEY_extraProp_0_max_6_4); extraProp[0].max[5] = txf.GetintByIndex(_KEY_extraProp_0_max_6_5); levelUpCostType = txf.GetintByIndex(_KEY_levelUpCostType); levelUpCostID = txf.GetintByIndex(_KEY_levelUpCostID); levelUpCostNum1 = txf.GetintByIndex(_KEY_levelUpCostNum1); levelUpCostNum2 = txf.GetintByIndex(_KEY_levelUpCostNum2); levelUpCostNum3 = txf.GetintByIndex(_KEY_levelUpCostNum3); levelUpCostNum4 = txf.GetintByIndex(_KEY_levelUpCostNum4); levelUpCostNum5 = txf.GetintByIndex(_KEY_levelUpCostNum5); levelUpCostNum6 = txf.GetintByIndex(_KEY_levelUpCostNum6); levelUpCostNum7 = txf.GetintByIndex(_KEY_levelUpCostNum7); levelUpCostNum8 = txf.GetintByIndex(_KEY_levelUpCostNum8); exploreOutputPerSecond = txf.GetintByIndex(_KEY_exploreOutputPerSecond); return true; } #if UNITY_2019_1_OR_NEWER public HorseDesc ReadItemInIL(TabBinFile txf ,int keyCount = 0) { byte[] ret = txf.GetLength(); if (ret.Length == 0) { return null; } return SerializeObj.ConfigDeSerialize(this, ret, txf.ColPosList, txf.listPosList, this.listDic, txf.m_stringBlock, keyCount); } #endif }