Example #1
0
    public void HandleSpinResult(object[] data)
    {
        string json = LitJson.JsonMapper.ToJson(data[0]);
        SRSResultSpinMiniPoker result = JsonUtility.FromJson <SRSResultSpinMiniPoker>(json);

        lastUpdateMoney = DateTime.Now;
        isSpinning      = true;

        StartCoroutine(LineSpinResult(result));
    }
Example #2
0
    IEnumerator LineSpinResult(SRSResultSpinMiniPoker result)
    {
        if (toggleFast.isOn == false)
        {
            AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SREEL_SPIN);
        }

        var listCards = result.GetListCard();

        for (int i = 0; i < lines.Count; i++)
        {
            yield return(new WaitForSeconds(toggleFast.isOn ? 0.07f : 0.2f));

            lines[i].Init(listCards[i], _GAMEID);
        }

        yield return(new WaitUntil(() => lines.All(a => a.isDone = true)));

        string msg = result.PrizeValue > 0 ? "\n+ " + VKCommon.ConvertStringMoney(result.PrizeValue) : "";

        if (Database.Instance.CanUpdateMoney(result.BetType, lastUpdateMoney))
        {
            Database.Instance.UpdateUserMoney(result.BetType, result.Balance);
        }

        vkTxtJackpot.UpdateNumber(result.Jackpot);

        if (result.Cards[0].CardTypeID == 12)
        {
            txtJackpot.UpdateNumber(result.PrizeValue);
            gJackpot.SetActive(true);

            AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SJACKPOT);

            yield return(new WaitForSeconds(3));

            gJackpot.SetActive(false);
        }
        else
        {
            switch (result.Cards[0].CardTypeID)
            {
            case 10:
            case 11:
                break;

            default:
                SetNoti(VKCommon.ConvertCardTypeId(result.Cards[0].CardTypeID) + msg);
                AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SWIN);
                break;
            }
        }

        isSpinning = false;

        if (isAuto)
        {
            yield return(new WaitForSeconds(1.5f));

            gNoti.SetActive(false);

            isAbleSpin = true;
            ButtonSpinClickListener();
        }
        else
        {
            //btSpin.interactable = true;
            isAbleSpin = true;
        }
    }