public void Init(KGiftData giftData) { InitUIComponentReferences(); this.GiftData = giftData; UpdateUIOnDataChanged(); InitUIListener(); }
private void UpdateGiftAvailableCount() { OnlineGiftAvailableCount = 0; CombatGiftAvailableCount = 0; LevelGiftAvailableCount = 0; MajorPlayer player = PlayerManager.GetInstance().MajorPlayer; List <GiftItem> onlineGiftItemList = OnlineGiftView.GetInstance().OnlineGiftItemList; int playerOnlineTime = (int)player.onlineTime; foreach (GiftItem onlineGiftItem in onlineGiftItemList) { KGiftData onlineGiftData = onlineGiftItem.GiftData; if (player.rewardData != null && player.rewardData[onlineGiftData.nID] != null) { bool isReward = player.rewardData[onlineGiftData.nID]; if (!isReward && onlineGiftData.nOnlineTime * 60 - playerOnlineTime <= 0) { ++OnlineGiftAvailableCount; } } } List <GiftItem> levelGiftItemList = GiftHallView.GetInstance().LevelGiftItemList; foreach (GiftItem levelGiftItem in levelGiftItemList) { KGiftData levelGiftData = levelGiftItem.GiftData; if (player.rewardData != null && player.rewardData[levelGiftData.nID] != null) { bool isReward = player.rewardData[levelGiftData.nID]; if (!isReward && levelGiftData.nLevelLimit - player.levelCurrent <= 0) { ++LevelGiftAvailableCount; } } } List <GiftItem> combatGiftItemList = GiftHallView.GetInstance().CombatGiftItemList; foreach (GiftItem combatGiftItem in combatGiftItemList) { KGiftData combatGiftData = combatGiftItem.GiftData; if (player.rewardData != null && player.rewardData[combatGiftData.nID] != null) { bool isReward = player.rewardData[combatGiftData.nID]; if (!isReward && combatGiftData.nCombatLimit - player.combat <= 0) { ++CombatGiftAvailableCount; } } } }