public void HandleSetBetResult(object[] data) { string json = LitJson.JsonMapper.ToJson(data[0]); SRSResultHighLowSetBet result = JsonUtility.FromJson <SRSResultHighLowSetBet>(json); lastUpdateMoney = DateTime.Now; step = result.step; txtId.text = "#" + result.turnId.ToString("F0"); txtHistoryNotify.gameObject.SetActive(false); if (result.responseStatus >= 0) { if (result.betValue > 1) { StartCoroutine(WaitGameResult(result)); } else { SetNoti("Lượt #" + result.turnId.ToString("F0") + " bạn đã thắng " + txtMoneyAdd.text + " " + strMoneyType[(int)moneyType - 1] + " sau " + step + " lần mở bài."); txtMoneyWin.text = "+" + txtMoneyAdd.text; txtMoneyWin.gameObject.SetActive(true); ClearUI(); } } else { ClearUI(); } }
IEnumerator WaitGameResult(SRSResultHighLowSetBet result) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SREEL_SPIN); uiCard.StartAnimation(result.cardId); yield return(new WaitUntil(() => !uiCard.isRunning)); AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SREEL_STOP); AddHistory(result.cardId); if ((result.cardId + 1) % 13 == 0) { for (int i = 0; i < gCardAts.Count; i++) { if (!gCardAts[i].activeSelf) { gCardAts[i].SetActive(true); break; } } } if (result.step == 1) { vkCountDown.StartCoundown(timeCountDown); } if (result.balance >= 0) { Database.Instance.UpdateUserMoney(moneyType, result.balance); } CalculatorMoney(result.betRateUp, result.betRateDown, result.prizeValue); if (result.isJackpot == 1) { yield return(new WaitForSeconds(1f)); AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SJACKPOT); gJackpot.SetActive(true); vkTxtWinJackpot.UpdateNumber(result.prizeValue); ClearUI(); } else if (result.prizeValue <= 1) //check thua { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SLOSE); SetNoti("Bạn đã thua"); yield return(new WaitForSeconds(1.5f)); ClearUI(); } else if (isAuto) { ButtonNewGameClickListener(); } else { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SWIN); btNewGame.interactable = result.step != 1; btUp.interactable = step > 0 && ((result.cardId + 1) % 13 != 0); btDown.interactable = step > 0 && (result.cardId % 13 != 0); } }