IEnumerator PlayLastSpinResult(SRSSlot25LineResultSpin result) { List <int> itemBonus = _machine.GetListItemBonus(); while (true) { yield return(new WaitForSeconds(1.5f)); SetNotifyMoney(""); List <int> lineTemps = new List <int>(); List <int> itemWins = new List <int>(); foreach (var lineWin in result.PrizeLines) { //_machine.HideItemWin(); lineTemps.Add(lineWin.LineId); itemWins.AddRange(lineWin.Position); _machine.ShowLineAndItemWin(new List <int> { lineWin.LineId }, lineWin.Position); SetNotifyMoney(lineWin.PrizeValue > 0 ? VKCommon.ConvertStringMoney(lineWin.PrizeValue) : ""); yield return(new WaitForSeconds(2.5f)); } // bonus game if (lastResult.IsBonusGame()) { itemWins.AddRange(itemBonus); _machine.ShowLineAndItemWin(new List <int> (), itemBonus); SetNotifyMoney("Bonus Game"); yield return(new WaitForSeconds(2.5f)); } if (result.TotalPrizeValue > 0) { SetNotifyMoney(VKCommon.ConvertStringMoney(result.TotalPrizeValue)); } _machine.ShowLineAndItemWin(lineTemps, itemWins); yield return(new WaitForSeconds(1.5f)); _machine.HideLineWin(); _machine.HideItemWin(); } }
public void HandleSpinResult(object[] data) { //setup Button auto btAutoSpin.enabled = isAutoSpin; //data string json = LitJson.JsonMapper.ToJson(data[0]); SRSSlot25LineResultSpin result = JsonUtility.FromJson <SRSSlot25LineResultSpin>(json); if (result.ResponseStatus != (int)GameResponseStatus.SUCCESS) { isAutoSpin = false; LoadAutoSpinState(); EnableToPlay(); return; } // Reset StopAnimLastResult(); SetNotifyMoney(""); vkTxtTotalWin.UpdateNumber(0); _machine.HideItemWin(); _machine.HideLineWin(); if (waitMachineFinish != null) { StopCoroutine(waitMachineFinish); } //updatejackpot jackpot = result.Jackpot; UpdateJackpot(); // spin waitMachineFinish = WaitMachineFinish(result); StartCoroutine(waitMachineFinish); }
public void ClearUI() { isAutoSpin = false; lastResult = null; // lieu an nhieu _minigame.ClearUI(); btLieu.gameObject.SetActive(false); // sieutoc btSieuToc.SetupAll(!isSieuToc); _machine.SetSpeed(isSieuToc ? 3 : 1); StopAllCoroutines(); playLastResult = null; waitMachineFinish = null; gNotifyMoneyWin.SetActive(false); gNotifyMoneyWin.SetActive(false); gMenuContent.SetActive(false); vkTxtTotalWin.SetNumber(0); _machine.ClearUI(); if (gEvent.activeSelf) { vkEventNoticeRun.StopRunNotice(); gEvent.SetActive(false); } LoadAutoSpinState(); EnableToPlay(); }
// quay spin IEnumerator WaitMachineFinish(SRSSlot25LineResultSpin result) { _machine.StartMachineLeftToRight(result.GetSlotData()); if (!isSieuToc) { yield return(new WaitForSeconds(0.5f)); AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioSpin); } lastResult = result; yield return(new WaitUntil(() => !_machine.isRunning)); if (accountSpin.FreeSpins <= 0 || result.Balance > 0) { Database.Instance.UpdateUserMoney(moneyType, result.Balance); } if ((result.PrizeLines != null && result.PrizeLines.Count > 0) || result.IsBonusGame()) { // show line win List <int> itemBonus = _machine.GetListItemBonus(); List <int> lineTemps = new List <int>(); List <int> itemWins = new List <int>(); foreach (var lineWin in result.PrizeLines) { lineTemps.Add(lineWin.LineId); itemWins.AddRange(lineWin.Position); } itemWins = itemWins.Distinct().ToList(); itemWins.AddRange(itemBonus); _machine.ShowLineAndItemWin(lineTemps, itemWins); if (result.IsJackpot) { bool isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineWin, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineWin)layer).Init(LGameSlot25LineWin.Slot25LineWinType.JACKPOT, _config, () => { isShowing = false; }, result.TotalJackpotValue); }); yield return(new WaitUntil(() => !isShowing)); yield return(new WaitForSeconds(0.5f)); } } else { // ko trung gi } // free if (result.AddFreeSpin > 0) { if (accountSpin.FreeSpins <= 0) { bool isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineWin, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineWin)layer).Init(LGameSlot25LineWin.Slot25LineWinType.FREE, _config, () => { isShowing = false; }, result.AddFreeSpin); }); yield return(new WaitUntil(() => !isShowing)); yield return(new WaitForSeconds(0.5f)); } } if (result.FreeSpins > 0) { accountSpin.FreeSpins = result.FreeSpins; } else if (result.AddFreeSpin > 0) { accountSpin.FreeSpins = result.AddFreeSpin; } else { accountSpin.FreeSpins = result.FreeSpins; } SetNotifyFree(); // bigwin if (!result.IsJackpot) { int xBet = (int)(result.TotalPrizeValue / (roomBetValue * _machine.idLineSelecteds.Count)); // bigwin if (xBet >= 25) { bool isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineWin, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineWin)layer).Init(LGameSlot25LineWin.Slot25LineWinType.PERFECT, _config, () => { isShowing = false; }, result.TotalPrizeValue); }); yield return(new WaitUntil(() => !isShowing)); yield return(new WaitForSeconds(0.5f)); } else if (xBet >= 10) { bool isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineWin, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineWin)layer).Init(LGameSlot25LineWin.Slot25LineWinType.BIGWIN, _config, () => { isShowing = false; }, result.TotalPrizeValue); }); yield return(new WaitUntil(() => !isShowing)); yield return(new WaitForSeconds(0.5f)); } } // bonus if (result.IsBonusGame()) { bonusResult = null; // show win bonus bool isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineWin, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineWin)layer).Init(LGameSlot25LineWin.Slot25LineWinType.BONUS, _config, () => { isShowing = false; }); }); yield return(new WaitUntil(() => !isShowing)); // show game bonus isShowing = true; UILayerController.Instance.ShowLayer(UILayerKey.LGameSlot25LineBonus, _assetBundleConfig.name, (layer) => { ((LGameSlot25LineBonus)layer).Init(_config, result.BonusGame, roomBetValue, () => { isShowing = false; _server.HubCallFinishBonusGame(moneyType, result.SpinId); }); }); yield return(new WaitUntil(() => !isShowing)); yield return(new WaitUntil(() => bonusResult != null)); yield return(new WaitUntil(() => bonusResult == null)); } // Money if (result.TotalPrizeValue > 0) { AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioWin); btLieu.gameObject.SetActive(true); } SetNotifyMoney(result.TotalPrizeValue > 0 ? VKCommon.ConvertStringMoney(result.TotalPrizeValue) : ""); vkTxtTotalWin.UpdateNumber(result.TotalPrizeValue); //yield return new WaitForSeconds(2f); // finish waitMachineFinish = null; if (isAutoSpin) { if (result.TotalPrizeValue > 0) { yield return(new WaitForSeconds(_config.timeWaitNextAuto)); } else { yield return(new WaitForSeconds(0.2f)); } if (isAutoSpin) { ButtonSpinClickListener(); } } else { if (!_minigame.isPlaying) { EnableToPlay(); } StartAnimLastResult(); } }