public void Init() { UILayerController.Instance.ShowLoading(); uiSelect.gameObject.SetActive(false); _assetBundleConfig = AssetbundlesManager.Instance.assetSetting.GetItemByGameId(_GAMEID); _soundSetting = AudioAssistant.Instance.GetSettingSound(_GAMEID, true); moneyType = (int)MoneyType.GOLD; _server = SignalRController.Instance.CreateServer <VuaBaoSignalRServer>((int)_GAMEID); _server.OnSRSEvent = OnSRSEvent; _server.OnSRSHubEvent = OnSRSHubEvent; _server.SRSInit(_URL, _HUBNAME); this.roomIdSelected = 1; lastResult = null; this.isAuto = false; btAuto.SetupAll(false); vkBtBets[roomIdSelected - 1].VKInteractable = false; this.accountInfo = Database.Instance.Account(); ChangeSound(); ChangeTypeMoney(); slotMachine.ClearUI(); List <int> id = new List <int>() { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 }; slotMachine.InitLineSelected(id); }
public void HandleSpinResult(object[] data) { string json = LitJson.JsonMapper.ToJson(data[0]); SRSVuaBaoResultSpin result = JsonUtility.FromJson <SRSVuaBaoResultSpin>(json); result.LoadPrizesData(); lastUpdateMoney = DateTime.Now; isSpinning = true; slotMachine.HideItemWin(); slotMachine.HideLineWin(); StopAnimLastResult(); StartCoroutine(LineSpinResult(result)); }
IEnumerator LineSpinResult(SRSVuaBaoResultSpin result) { lastResult = result; slotMachine.StartMachineLeftToRight(result.GetItems()); yield return(new WaitForSeconds(timePlaySpin)); AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SREEL_SPIN); yield return(new WaitUntil(() => !slotMachine.isRunning)); List <int> lineWins = result.GetLinesWin(); List <int> itemWins = new List <int>(); foreach (var line in result.prizesDatas) { itemWins.AddRange(line.GetPosition(mapItemWins, result.itemIds)); } slotMachine.ShowLineAndItemWin(lineWins, itemWins); if (Database.Instance.CanUpdateMoney(moneyType, lastUpdateMoney)) { Database.Instance.UpdateUserMoney(moneyType, result._Balance); } double moneyAdd = result.GetMoneyBonus(); if (result._IsJackpot) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SJACKPOT); uiWin.InitJackpot((float)moneyAdd); yield return(new WaitUntil(() => !uiWin.gameObject.activeSelf)); } else { if (result._TotalPrizeValue > 0) { double winPer = moneyAdd / roomBetValue; if (winPer >= 25) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SBIGWIN); uiWin.InitPerfect((float)moneyAdd); yield return(new WaitUntil(() => !uiWin.gameObject.activeSelf)); } else if (winPer >= 10) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SBONUS); uiWin.InitBigWin((float)moneyAdd); yield return(new WaitUntil(() => !uiWin.gameObject.activeSelf)); } else { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SWIN); txtMoneyAdd.text = VKCommon.ConvertStringMoney(moneyAdd); txtMoneyAdd.gameObject.SetActive(true); StartCoroutine(LerpColor()); yield return(new WaitUntil(() => !txtMoneyAdd.gameObject.activeSelf)); } } else { yield return(new WaitForSeconds(0.5f)); } } isSpinning = false; slotMachine.HideLineWin(); StartAnimLastResult(); if (isAuto) { ButtonSpinClickListener(); } else { btSpin.interactable = true; } }