private void AutoBet(Dictionary <int, int> dictChips, UIBauCuaGate uiGate) { int count = 0; foreach (var item in dictChips) { if (count >= uiGate.maxChip) { return; } for (int i = 0; i < item.Value; i++) { count++; BauCuaChip bcChip = vkChipPool.BorrowObject <BauCuaChip>(); bcChip.SetChip(sprChips[item.Key], VKCommon.ConvertSubMoneyString(uiChips[item.Key].money), item.Key, _baucua.moneyType); uiGate.AddChip(vkChipPool, bcChip, uiChips[item.Key].transform, tranWorld, uiChips[item.Key].money); if (count >= uiGate.maxChip) { return; } } } }
public void AddChip(VKObjectPoolManager vkPool, BauCuaChip chip, Transform tranStart, Transform tranWorld, double value) { if (bcChips.Count >= maxChip) { vkPool.GiveBackObject(bcChips[0].gameObject); bcChips.RemoveAt(0); } chip.transform.position = tranStart.position; chip.transform.SetParent(tranWorld); LeanTween.move(chip.gameObject, transform.position + new Vector3(Random.Range(-0.8f, 0.8f), Random.Range(-0.45f, 0.45f), 0f), 0.2f).setOnComplete(() => { chip.transform.SetParent(transform); }); bcChips.Add(chip); meBetValue += value; txtBetMe.text = VKCommon.ConvertStringMoney(meBetValue + meBetOld); txtBetMe.color = cMeBets[1]; }
public void ButtonGateClickListener(UIBauCuaGate uiGate) { if (_baucua.session.State != BauCuaState.BETTING) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SFAIL); SetNoti("Đã hết thời gian đặt cược"); return; } if (_account.GetCurrentBalance(_baucua.moneyType) < GetTotalBetValue() + uiChipSelected.money) { AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SFAIL); SetNoti("Số dư của bạn không đủ"); return; } AudioAssistant.Instance.PlaySoundGame(_GAMEID, _SCOIN); BauCuaChip bcChip = vkChipPool.BorrowObject <BauCuaChip>(); bcChip.SetChip(sprChips[uiChipSelected.index], VKCommon.ConvertSubMoneyString(uiChipSelected.money), uiChipSelected.index, _baucua.moneyType); uiGate.AddChip(vkChipPool, bcChip, uiChipSelected.transform, tranWorld, uiChipSelected.money); }