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()); }
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 ClearUI() { keyCount = 0; totalWin = 0; gChets.SetActive(false); canvasItems.alpha = 1; uiItems.ForEach(a => a.ClearUI()); uiChests.ForEach(a => a.ClearUI()); bonusChestItem = null; uiItemChest = null; StopAllCoroutines(); vkCountDown.StopCountDown(); }
IEnumerator WaitToShowItem() { graphicRaycaster.enabled = false; yield return(new WaitForSeconds(1f)); graphicRaycaster.enabled = true; uiItemChest.ShowReward(bonusChestItem.money, UILGameSlot20LineBonusItem.BonusItemType.OPEN_CHESTED); bonusChestItem = null; uiItemChest = null; gChets.SetActive(false); canvasItems.alpha = 1; // nếu mở chest cuối cùng thì delay đóng layer if (bonusItems.Count <= 0) { uiItems.ForEach(a => a.btItem.enabled = false); vkCountDown.SetSeconds(0); StartCoroutine(WaitToShowResult()); } }