public void OnCountDownDone() { if (gChets.activeSelf) { gChets.SetActive(false); canvasItems.alpha = 1; uiItemChest.ShowReward(bonusChestItem.money, UILGameSlot20LineBonusItem.BonusItemType.OPEN_CHEST); } List <int> indexs = new List <int>(); for (int i = 0; i < uiItems.Count; i++) { var item = uiItems[i]; item.btItem.enabled = false; if (!item.isOpen) { indexs.Add(i); } } VKCommon.Shuffle(indexs); for (int i = 0; i < bonusItems.Count; i++) { var bonusItem = bonusItems[i]; var uiItem = uiItems[indexs[i]]; if (bonusItem.IsChest()) { uiItem.ShowReward(bonusItem.money, UILGameSlot20LineBonusItem.BonusItemType.OPEN_CHEST); } else if (bonusItem.IsKey()) { uiItem.ShowReward(bonusItem.money, UILGameSlot20LineBonusItem.BonusItemType.KEY); keyCount++; } else { uiItem.ShowReward(bonusItem.money, UILGameSlot20LineBonusItem.BonusItemType.NORNAL); } } totalWin = bonusGame.PrizeValue; SetHeSo(); SetLuotMo(); SetTotalWin(); StartCoroutine(WaitToShowResult()); }
public void ButtonItemClickListener(UILGameSlot20LineBonusItem item) { if (bonusItems.Count > 0) { var bonusItem = bonusItems[0]; bonusItems.RemoveAt(0); SetLuotMo(); if (bonusItem.IsChest()) { bonusChestItem = bonusItem; uiItemChest = item; AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioWin); item.ShowReward(0, UILGameSlot20LineBonusItem.BonusItemType.CHEST); StartCoroutine(WaitToShowChest()); } else { AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioButtonClick); if (bonusItem.IsKey()) { item.ShowReward(bonusItem.money, UILGameSlot20LineBonusItem.BonusItemType.KEY); keyCount++; SetHeSo(); } else { item.ShowReward(bonusItem.money, UILGameSlot20LineBonusItem.BonusItemType.NORNAL); } totalWin += bonusItem.money; SetTotalWin(); } item.btItem.enabled = false; } if (bonusItems.Count <= 0) { uiItems.ForEach(a => a.btItem.enabled = false); // nếu đã mở hết item thì delay đóng layer if (bonusChestItem == null && !vkCountDown.isCountDone) { vkCountDown.SetSeconds(0); StartCoroutine(WaitToShowResult()); } } }
public void ButtonChestClickListener(UILGameSlot20LineBonusItem item) { AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioWin); item.ShowReward(bonusChestItem.money, UILGameSlot20LineBonusItem.BonusItemType.OPEN_CHEST); uiChests.ForEach(a => a.btItem.enabled = false); totalWin += bonusChestItem.money; SetTotalWin(); StartCoroutine(WaitToShowItem()); }