Beispiel #1
0
    public void ButtonGateClickListener(UIXocXocGate uiGate)
    {
        if (_xocxoc.IsDealer())
        {
            return;
        }

        if (_xocxoc.session.CurrentState != XocXocGameState.BETTING)
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioButtonFail);
            SetNotify("Chưa đến thời gian đặt cược");
            return;
        }

        if (_account.GetCurrentBalance(_xocxoc.moneyType) < GetTotalBetValue() + uiChipSelected.money)
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioButtonFail);
            SetNotify("Số dư của bạn không đủ");
            return;
        }

        AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioNemCoin);
        XocXocChip xChip = vkChipPool.BorrowObject <XocXocChip>();

        xChip.SetChip(sprChips[uiChipSelected.index], VKCommon.ConvertSubMoneyString(uiChipSelected.money), uiChipSelected.index);

        uiGate.AddMeChip(vkChipPool, xChip, imgMyAvatar.transform, transWorld, uiChipSelected.money);
    }
Beispiel #2
0
    private void PlayerAutoBet(Dictionary <int, int> dictChips, UIXocXocGate uiGate, Transform transStart)
    {
        int count = 0;

        foreach (var item in dictChips)
        {
            if (count >= uiGate.maxPlayerChip)
            {
                return;
            }

            for (int i = 0; i < item.Value; i++)
            {
                count++;

                XocXocChip xChip = vkChipPool.BorrowObject <XocXocChip>();
                xChip.SetChip(sprChips[item.Key], VKCommon.ConvertSubMoneyString(uiChips[item.Key].money), item.Key);

                uiGate.AddAllChip(vkChipPool, xChip, transStart, transWorld);
                if (count >= uiGate.maxPlayerChip)
                {
                    return;
                }
            }
        }
    }
    public void AddMeChip(VKObjectPoolManager vkPool, XocXocChip chip, Transform tranStart, Transform tranWorld, double value)
    {
        if (xMeChips.Count >= maxMeChip)
        {
            vkPool.GiveBackObject(xMeChips[0].gameObject);
            xMeChips.RemoveAt(0);
        }

        chip.transform.position = tranStart.position;
        chip.transform.SetParent(tranWorld);
        LeanTween.move(chip.gameObject, GetChipPosition(), 0.2f).setOnComplete(() => {
            chip.transform.SetParent(transChipContent);
        });

        xMeChips.Add(chip);
        meBetValue += value;

        txtBetMe.SetNumber(meBetValue + meBetOld);
        txtBetMe.txtNumber.color = cMeBets[1];
    }
    public void AddAllChip(VKObjectPoolManager vkPool, XocXocChip chip, Transform tranStart, Transform tranWorld)
    {
        chip.transform.position = tranStart.position;
        chip.transform.SetParent(tranWorld);

        xAllChips.Add(chip);

        LeanTween.move(chip.gameObject, GetChipPosition(), 0.2f).setOnComplete(() => {
            chip.transform.SetParent(transChipContent);

            LeanTween.value(chip.gameObject, (Color color) =>
            {
                chip.imgChip.color = color;
            }, new Color(1f, 1f, 1f, 1f), new Color(1f, 1f, 1f, 0f), 0.5f).setDelay(1f).setOnComplete(() => {
                xAllChips.Remove(chip);

                LeanTween.cancel(chip.gameObject);
                vkPool.GiveBackObject(chip.gameObject);
            });
        });
    }
Beispiel #5
0
    private void MoveWinAuto(Dictionary <int, int> dictChips, UIXocXocGate uiGate, Transform target)
    {
        int count = 0;

        foreach (var item in dictChips)
        {
            if (count >= uiGate.maxMeChip)
            {
                return;
            }

            for (int i = 0; i < item.Value; i++)
            {
                count++;
                XocXocChip xChip = vkChipPool.BorrowObject <XocXocChip>();
                xChip.SetChip(sprChips[item.Key], VKCommon.ConvertSubMoneyString(uiChips[item.Key].money), item.Key);
                xChip.imgChip.color = new Color(1f, 1f, 1f, 0f);

                xChip.transform.position = uiGate.GetChipPosition();
                xChip.transform.SetParent(transWorld);

                LeanTween.value(xChip.gameObject, (Color color) =>
                {
                    xChip.imgChip.color = color;
                }, new Color(1f, 1f, 1f, 0f), new Color(1f, 1f, 1f, 1f), 0.5f).setOnComplete(() => {
                    LeanTween.move(xChip.gameObject, target.position, 0.4f).setDelay(0.1f).setOnComplete(() => {
                        LeanTween.cancel(xChip.gameObject);
                        vkChipPool.GiveBackObject(xChip.gameObject);
                    });
                });

                if (count >= uiGate.maxMeChip)
                {
                    return;
                }
            }
        }
    }