//============================================ //--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 PayDiamondDescMgr : IConfigManager { //Singleton private static PayDiamondDescMgr _instance; private static readonly object syslock = new object(); public static PayDiamondDescMgr Instance { get { if (_instance == null) { lock (syslock) { if (_instance == null) { _instance = new PayDiamondDescMgr(); }}} return _instance; }} public class ItemData { public PayDiamondDesc Item; public int Line; public bool ReadAlready; } protected Dictionary m_ItemTable = new (); protected Dictionary n_ItemTable = new (); //for server only, m_readKeyOnly must be false protected SortedList m_ItemDescTable = new (); 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(); n_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 PayDiamondDesc() }; 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); n_ItemTable.Add(item.InternalId, item); if (m_readKeyOnly) { itemData.Line = m_tbf.CurrentLine; } else { itemData.ReadAlready = true; } } if (!m_readKeyOnly) { m_tbf = null; } return true; } public PayDiamondDesc 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 PayDiamondDesc GetConfigByInternal(int internalId) { var desc = n_ItemTable.GetValueOrDefault(internalId, null); if (desc == null) { TraceLog.Error("Cfg1KeyMgrTemplate.Get by InternalId Failed fs null TabManager:{0}, internalId={1},read line error,", this.ToString(), internalId); } return desc; } } public partial class PayDiamondDesc { public partial class Currency { /// /// 0 占位不填 /// public uint Value { get; set; } } public partial class GiveItem { /// /// 0商品type1 /// public int type { get; set; } /// /// 0商品id1 /// public string id { get; set; } /// /// 0商品value1 /// public int count { get; set; } } public partial class ChooseItem { /// /// 0自选商品type1 /// public int[] type { get; set; } /// /// 0自选商品id1 /// public string[] id { get; set; } /// /// 0自选商品value1 /// public int[] count { get; set; } } public static readonly string _KEY_InternalId = "InternalId"; public static readonly string _KEY_itemID = "itemID"; public static readonly string _KEY_comm = "comm"; public static readonly string _KEY_nextItemID = "nextItemID"; public static readonly string _KEY_itemName = "itemName"; public static readonly string _KEY_goodsType = "goodsType"; public static readonly string _KEY_subType = "subType"; public static readonly string _KEY_vipCardType = "vipCardType"; public static readonly string _KEY_passCardType = "passCardType"; public static readonly string _KEY_SignType = "SignType"; public static readonly string _KEY_activityId = "activityId"; public static readonly string _KEY_isShow = "isShow"; public static readonly string _KEY_showSortIndex = "showSortIndex"; public static readonly string _KEY_showQuality = "showQuality"; public static readonly string _KEY_bg = "bg"; public static readonly string _KEY_icon = "icon"; public static readonly string _KEY_anim = "anim"; public static readonly string _KEY_currency_0_Value = "currency_0_Value"; public static readonly string _KEY_currency_1_Value = "currency_1_Value"; public static readonly string _KEY_currency_2_Value = "currency_2_Value"; public static readonly string _KEY_currency_3_Value = "currency_3_Value"; public static readonly string _KEY_currency_4_Value = "currency_4_Value"; public static readonly string _KEY_productID = "productID"; public static readonly string _KEY_bdc_product_type = "bdc_product_type"; public static readonly string _KEY_consumeItemId = "consumeItemId"; public static readonly string _KEY_consumeItemCount = "consumeItemCount"; public static readonly string _KEY_consumeAd = "consumeAd"; public static readonly string _KEY_buyCountLimit = "buyCountLimit"; public static readonly string _KEY_dailyLimit = "dailyLimit"; public static readonly string _KEY_weeklyLimit = "weeklyLimit"; public static readonly string _KEY_weeklyFreshDay = "weeklyFreshDay"; public static readonly string _KEY_monthlyLimit = "monthlyLimit"; public static readonly string _KEY_timeLimitType = "timeLimitType"; public static readonly string _KEY_timeLimitParam = "timeLimitParam"; public static readonly string _KEY_gain = "gain"; public static readonly string _KEY_sale = "sale"; public static readonly string _KEY_unlockToLevel = "unlockToLevel"; public static readonly string _KEY_chapterCondition = "chapterCondition"; public static readonly string _KEY_popUpPackageType = "popUpPackageType"; public static readonly string _KEY_firstPayAwardType = "firstPayAwardType"; public static readonly string _KEY_firstPayAwardId = "firstPayAwardId"; public static readonly string _KEY_firstPayAwardNum = "firstPayAwardNum"; public static readonly string _KEY_followPayAwardType = "followPayAwardType"; public static readonly string _KEY_followPayAwardId = "followPayAwardId"; public static readonly string _KEY_followPayAwardNum = "followPayAwardNum"; public static readonly string _KEY_giveItem_0_type = "giveItem_0_type"; public static readonly string _KEY_giveItem_0_id = "giveItem_0_id"; public static readonly string _KEY_giveItem_0_count = "giveItem_0_count"; public static readonly string _KEY_giveItem_1_type = "giveItem_1_type"; public static readonly string _KEY_giveItem_1_id = "giveItem_1_id"; public static readonly string _KEY_giveItem_1_count = "giveItem_1_count"; public static readonly string _KEY_giveItem_2_type = "giveItem_2_type"; public static readonly string _KEY_giveItem_2_id = "giveItem_2_id"; public static readonly string _KEY_giveItem_2_count = "giveItem_2_count"; public static readonly string _KEY_giveItem_3_type = "giveItem_3_type"; public static readonly string _KEY_giveItem_3_id = "giveItem_3_id"; public static readonly string _KEY_giveItem_3_count = "giveItem_3_count"; public static readonly string _KEY_giveItem_4_type = "giveItem_4_type"; public static readonly string _KEY_giveItem_4_id = "giveItem_4_id"; public static readonly string _KEY_giveItem_4_count = "giveItem_4_count"; public static readonly string _KEY_giveItem_5_type = "giveItem_5_type"; public static readonly string _KEY_giveItem_5_id = "giveItem_5_id"; public static readonly string _KEY_giveItem_5_count = "giveItem_5_count"; public static readonly string _KEY_chooseItem_0_type = "chooseItem_0_type"; public static readonly string _KEY_chooseItem_0_id = "chooseItem_0_id"; public static readonly string _KEY_chooseItem_0_count = "chooseItem_0_count"; public static readonly string _KEY_chooseItem_1_type = "chooseItem_1_type"; public static readonly string _KEY_chooseItem_1_id = "chooseItem_1_id"; public static readonly string _KEY_chooseItem_1_count = "chooseItem_1_count"; public static readonly string _KEY_chooseItem_2_type = "chooseItem_2_type"; public static readonly string _KEY_chooseItem_2_id = "chooseItem_2_id"; public static readonly string _KEY_chooseItem_2_count = "chooseItem_2_count"; public static readonly string _KEY_payDiamond = "payDiamond"; public static readonly string _KEY_diamond = "diamond"; /// /// 内部ID /// public int InternalId { get; set; } /// /// 物品ID /// public int itemID { get; set; } /// /// 备注 /// public string comm { get; set; } /// /// 下一个礼包 /// public int nextItemID { get; set; } /// /// 礼包名字,不能为空 /// public string itemName { get; set; } /// /// 商品类型 /// public PayGoodsType goodsType { get; set; } /// /// 商品子类型 /// public PaySubType subType { get; set; } /// /// 月卡id /// public int vipCardType { get; set; } /// /// 通行证id /// public int passCardType { get; set; } /// /// 签到id /// public int SignType { get; set; } /// /// 对应活动id /// public int activityId { get; set; } /// /// 玩家是否可见 /// public int isShow { get; set; } /// /// 内部按从小到大排序 /// public int showSortIndex { get; set; } /// /// 底图品质 /// public CommonQuality showQuality { get; set; } /// /// 礼包底图 /// public string bg { get; set; } /// /// 礼包图标 /// public string icon { get; set; } /// /// 礼包动画 /// public string anim { get; set; } public Currency[] currency { get; set; } /// /// 运营传输中台数据用(消耗道具购买时,不能配该字段) /// public string productID { get; set; } /// /// bdc日志的物品分类 1、钻石 2、礼包 3、月卡 4、通行证 5、代币 /// public int bdc_product_type { get; set; } /// /// 消耗道具id /// public string consumeItemId { get; set; } /// /// 消耗道具数量 /// public int consumeItemCount { get; set; } /// /// 广告获取id /// public string consumeAd { get; set; } /// /// 总次数限制 /// public int buyCountLimit { get; set; } /// /// 每天次数限制,配置即为每日重置 /// public int dailyLimit { get; set; } /// /// 每周限制次数 /// public int weeklyLimit { get; set; } /// /// 每周 周几 刷新 /// public int weeklyFreshDay { get; set; } /// /// 每月限制次数 /// public int monthlyLimit { get; set; } /// /// 限时类型 不填则不限时 1,弹窗触发后计时 2,伴随活动时间 /// public int timeLimitType { get; set; } /// /// 限时类型参数 (秒) /// public int timeLimitParam { get; set; } /// /// 显示收益(百分比) /// public int gain { get; set; } /// /// 显示折扣(百分比) /// public int sale { get; set; } /// /// 购买所需通行证进度 /// public int unlockToLevel { get; set; } /// /// 关卡进度条件【章节id;关卡id】 /// public int[] chapterCondition { get; set; } /// /// 弹出礼包类型 /// public string popUpPackageType { get; set; } /// /// 首次购买, 赠送道具类型 /// public int firstPayAwardType { get; set; } /// /// 首次购买, 赠送道具id /// public string firstPayAwardId { get; set; } /// /// 首次购买, 赠送道具数量 /// public int firstPayAwardNum { get; set; } /// /// 后续购买, 赠送道具类型 /// public int followPayAwardType { get; set; } /// /// 后续购买, 赠送道具id /// public string followPayAwardId { get; set; } /// /// 后续购买, 赠送道具数量 /// public int followPayAwardNum { get; set; } public GiveItem[] giveItem { get; set; } public ChooseItem[] chooseItem { get; set; } /// /// 商品付费钻石数量 /// public uint payDiamond { get; set; } /// /// 商品免费钻石数量 /// public uint diamond { get; set; } public Dictionary listDic = new Dictionary(); public PayDiamondDesc() { currency = new Currency[5]; currency[0] = new Currency(); currency[1] = new Currency(); currency[2] = new Currency(); currency[3] = new Currency(); currency[4] = new Currency(); listDic.Add("currency", typeof(Currency)); giveItem = new GiveItem[6]; giveItem[0] = new GiveItem(); giveItem[1] = new GiveItem(); giveItem[2] = new GiveItem(); giveItem[3] = new GiveItem(); giveItem[4] = new GiveItem(); giveItem[5] = new GiveItem(); listDic.Add("giveItem", typeof(GiveItem)); chooseItem = new ChooseItem[3]; chooseItem[0] = new ChooseItem(); chooseItem[1] = new ChooseItem(); chooseItem[2] = new ChooseItem(); listDic.Add("chooseItem", typeof(ChooseItem)); } public int GetKey1() { return itemID; } public bool ReadItemBin(TabBinFile txf, bool readKeyOnly) { InternalId = txf.GetintByIndex(_KEY_InternalId); itemID = txf.GetintByIndex(_KEY_itemID); if(readKeyOnly) { return true; } comm = txf.GetstringByIndex(_KEY_comm); nextItemID = txf.GetintByIndex(_KEY_nextItemID); itemName = txf.GetstringByIndex(_KEY_itemName); goodsType = (PayGoodsType)txf.GetintByIndex(_KEY_goodsType); subType = (PaySubType)txf.GetintByIndex(_KEY_subType); vipCardType = txf.GetintByIndex(_KEY_vipCardType); passCardType = txf.GetintByIndex(_KEY_passCardType); SignType = txf.GetintByIndex(_KEY_SignType); activityId = txf.GetintByIndex(_KEY_activityId); isShow = txf.GetintByIndex(_KEY_isShow); showSortIndex = txf.GetintByIndex(_KEY_showSortIndex); showQuality = (CommonQuality)txf.GetintByIndex(_KEY_showQuality); bg = txf.GetstringByIndex(_KEY_bg); icon = txf.GetstringByIndex(_KEY_icon); anim = txf.GetstringByIndex(_KEY_anim); currency[0].Value = txf.GetuintByIndex(_KEY_currency_0_Value); currency[1].Value = txf.GetuintByIndex(_KEY_currency_1_Value); currency[2].Value = txf.GetuintByIndex(_KEY_currency_2_Value); currency[3].Value = txf.GetuintByIndex(_KEY_currency_3_Value); currency[4].Value = txf.GetuintByIndex(_KEY_currency_4_Value); productID = txf.GetstringByIndex(_KEY_productID); bdc_product_type = txf.GetintByIndex(_KEY_bdc_product_type); consumeItemId = txf.GetstringByIndex(_KEY_consumeItemId); consumeItemCount = txf.GetintByIndex(_KEY_consumeItemCount); consumeAd = txf.GetstringByIndex(_KEY_consumeAd); buyCountLimit = txf.GetintByIndex(_KEY_buyCountLimit); dailyLimit = txf.GetintByIndex(_KEY_dailyLimit); weeklyLimit = txf.GetintByIndex(_KEY_weeklyLimit); weeklyFreshDay = txf.GetintByIndex(_KEY_weeklyFreshDay); monthlyLimit = txf.GetintByIndex(_KEY_monthlyLimit); timeLimitType = txf.GetintByIndex(_KEY_timeLimitType); timeLimitParam = txf.GetintByIndex(_KEY_timeLimitParam); gain = txf.GetintByIndex(_KEY_gain); sale = txf.GetintByIndex(_KEY_sale); unlockToLevel = txf.GetintByIndex(_KEY_unlockToLevel); chapterCondition = txf.GetintArrayByIndex(_KEY_chapterCondition); popUpPackageType = txf.GetstringByIndex(_KEY_popUpPackageType); firstPayAwardType = txf.GetintByIndex(_KEY_firstPayAwardType); firstPayAwardId = txf.GetstringByIndex(_KEY_firstPayAwardId); firstPayAwardNum = txf.GetintByIndex(_KEY_firstPayAwardNum); followPayAwardType = txf.GetintByIndex(_KEY_followPayAwardType); followPayAwardId = txf.GetstringByIndex(_KEY_followPayAwardId); followPayAwardNum = txf.GetintByIndex(_KEY_followPayAwardNum); giveItem[0].type = txf.GetintByIndex(_KEY_giveItem_0_type); giveItem[0].id = txf.GetstringByIndex(_KEY_giveItem_0_id); giveItem[0].count = txf.GetintByIndex(_KEY_giveItem_0_count); giveItem[1].type = txf.GetintByIndex(_KEY_giveItem_1_type); giveItem[1].id = txf.GetstringByIndex(_KEY_giveItem_1_id); giveItem[1].count = txf.GetintByIndex(_KEY_giveItem_1_count); giveItem[2].type = txf.GetintByIndex(_KEY_giveItem_2_type); giveItem[2].id = txf.GetstringByIndex(_KEY_giveItem_2_id); giveItem[2].count = txf.GetintByIndex(_KEY_giveItem_2_count); giveItem[3].type = txf.GetintByIndex(_KEY_giveItem_3_type); giveItem[3].id = txf.GetstringByIndex(_KEY_giveItem_3_id); giveItem[3].count = txf.GetintByIndex(_KEY_giveItem_3_count); giveItem[4].type = txf.GetintByIndex(_KEY_giveItem_4_type); giveItem[4].id = txf.GetstringByIndex(_KEY_giveItem_4_id); giveItem[4].count = txf.GetintByIndex(_KEY_giveItem_4_count); giveItem[5].type = txf.GetintByIndex(_KEY_giveItem_5_type); giveItem[5].id = txf.GetstringByIndex(_KEY_giveItem_5_id); giveItem[5].count = txf.GetintByIndex(_KEY_giveItem_5_count); chooseItem[0].type = txf.GetintArrayByIndex(_KEY_chooseItem_0_type); chooseItem[0].id = txf.GetstringArrayByIndex(_KEY_chooseItem_0_id); chooseItem[0].count = txf.GetintArrayByIndex(_KEY_chooseItem_0_count); chooseItem[1].type = txf.GetintArrayByIndex(_KEY_chooseItem_1_type); chooseItem[1].id = txf.GetstringArrayByIndex(_KEY_chooseItem_1_id); chooseItem[1].count = txf.GetintArrayByIndex(_KEY_chooseItem_1_count); chooseItem[2].type = txf.GetintArrayByIndex(_KEY_chooseItem_2_type); chooseItem[2].id = txf.GetstringArrayByIndex(_KEY_chooseItem_2_id); chooseItem[2].count = txf.GetintArrayByIndex(_KEY_chooseItem_2_count); payDiamond = txf.GetuintByIndex(_KEY_payDiamond); diamond = txf.GetuintByIndex(_KEY_diamond); return true; } public PopUpPackageDesc GetPopUpPackageTypeDesc() { return PopUpPackageDescMgr.Instance.GetConfig(popUpPackageType); } }