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();
    }
Example #3
0
    public List <SRSSlot20LineBonusGameItem> GetItems()
    {
        List <SRSSlot20LineBonusGameItem> items = new List <SRSSlot20LineBonusGameItem>();

        string[] strItems = GoldMinerData.Split(';');
        for (int i = 0; i < strItems.Length; i++)
        {
            string[] data = strItems[i].Split(',');;
            SRSSlot20LineBonusGameItem item = new SRSSlot20LineBonusGameItem {
                id     = int.Parse(data[0]),
                idItem = int.Parse(data[1]),
                heso   = int.Parse(data[2]),
                money  = int.Parse(data[3])
            };
            items.Add(item);
        }
        items.OrderBy(a => a.id);
        return(items);
    }
    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());
        }
    }