protected override void Init() { base.Init(); base.Hide(); Dictionary <string, KGiftData> giftAllData = KConfigFileManager.GetInstance().giftTabFile.getAllData(); List <KGiftData> levelAndCombatGiftDataList = new List <KGiftData>(); foreach (KGiftData giftData in giftAllData.Values) { if (giftData.eType == KGiftType.gtLevel || giftData.eType == KGiftType.gtCombat) { levelAndCombatGiftDataList.Add(giftData); } } levelAndCombatGiftDataList.Sort( delegate(KGiftData k1, KGiftData k2) { int compare = k1.nCombatLimit - k2.nCombatLimit; if (compare == 0) { return(k1.nLevelLimit - k2.nLevelLimit); } else { return(compare); } } ); foreach (KGiftData giftData in levelAndCombatGiftDataList) { UIDragPanelContents uiDragPanelContents = (UIDragPanelContents)UnityEngine.Object.Instantiate(base.GiftItem, base.GiftItem.transform.position, base.GiftItem.transform.rotation); uiDragPanelContents.transform.localScale = base.GiftItem.transform.lossyScale; GiftItem giftItem = uiDragPanelContents.gameObject.AddComponent <GiftItem>(); giftItem.Init(giftData); if (giftData.eType == KGiftType.gtLevel) { uiDragPanelContents.transform.parent = base.LevelList.gameObject.transform; LevelGiftItemList.Add(giftItem); } else if (giftData.eType == KGiftType.gtCombat) { uiDragPanelContents.transform.parent = base.CombatList.gameObject.transform; CombatGiftItemList.Add(giftItem); } } base.GiftItem.gameObject.SetActive(false); base.LevelList.sorted = false; base.LevelList.repositionNow = true; base.CombatList.sorted = false; base.CombatList.repositionNow = true; this.isListChanged = true; }
protected override void Init() { base.Init(); base.Hide(); Dictionary <string, KGiftData> GiftAllData = KConfigFileManager.GetInstance().giftTabFile.getAllData(); List <KGiftData> onlineGiftDataList = new List <KGiftData>(); foreach (KGiftData giftData in GiftAllData.Values) { if (giftData.eType == KGiftType.gtOnlineTime) { onlineGiftDataList.Add(giftData); } } onlineGiftDataList.Sort( delegate(KGiftData k1, KGiftData k2) { return(k1.nOnlineTime - k2.nOnlineTime); } ); foreach (KGiftData onlineGiftData in onlineGiftDataList) { UIDragPanelContents uiDragPanelContents = (UIDragPanelContents)UnityEngine.Object.Instantiate(base.GiftItem, base.GiftItem.transform.position, base.GiftItem.transform.rotation); uiDragPanelContents.transform.localScale = base.GiftItem.transform.lossyScale; uiDragPanelContents.transform.parent = base.GiftList.gameObject.transform; GiftItem giftItem = uiDragPanelContents.gameObject.AddComponent <GiftItem>(); giftItem.Init(onlineGiftData); OnlineGiftItemList.Add(giftItem); } base.GiftItem.gameObject.SetActive(false); base.GiftList.sorted = false; base.GiftList.repositionNow = true; }