Exemple #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);
    }
Exemple #2
0
 public void PlayAudio(string name)
 {
     if (Database.Instance.localData.isOpenSound)
     {
         AudioClip clip = GetAudioClip(name);
         if (clip != null)
         {
             AudioItem item = poolAudioItem.BorrowObject <AudioItem>();
             item.PlayAudio(clip, poolAudioItem);
         }
     }
 }
    public SamCard BorrowCard()
    {
        SamCard samCard = vkPoolManager.BorrowObject <SamCard>();

        samCard.Init(this);
        return(samCard);
    }
Exemple #4
0
    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);
    }
Exemple #5
0
    public void LoadStatistic()
    {
        vkDotPool.GiveBackAll();

        Dictionary <int, int> gateCount = new Dictionary <int, int>();

        for (int i = 0; i < iMax; i++)
        {
            if (_baucua.histories.Count > i)
            {
                var item = _baucua.histories[i];

                // count
                if (gateCount.ContainsKey(item.Dice1))
                {
                    gateCount[item.Dice1]++;
                }
                else
                {
                    gateCount.Add(item.Dice1, 1);
                }

                if (gateCount.ContainsKey(item.Dice2))
                {
                    gateCount[item.Dice2]++;
                }
                else
                {
                    gateCount.Add(item.Dice2, 1);
                }

                if (gateCount.ContainsKey(item.Dice3))
                {
                    gateCount[item.Dice3]++;
                }
                else
                {
                    gateCount.Add(item.Dice3, 1);
                }

                // dice 1
                UIBauCuaStatisticDot uiDot1 = vkDotPool.BorrowObject <UIBauCuaStatisticDot>();
                SetDotTrans(uiDot1, i, item.Dice1);
                SetDot(uiDot1, 1);

                // dice 2
                UIBauCuaStatisticDot uiDot2 = vkDotPool.BorrowObject <UIBauCuaStatisticDot>();
                SetDotTrans(uiDot2, i, item.Dice2);
                SetDot(uiDot2, 2);

                if (item.Dice1 == item.Dice2)
                {
                    uiDot1.transform.localPosition += new Vector3(0f, 8f, 0f);
                    uiDot2.transform.localPosition += new Vector3(0f, -8f, 0f);
                }

                // dice 3
                UIBauCuaStatisticDot uiDot3 = vkDotPool.BorrowObject <UIBauCuaStatisticDot>();
                SetDotTrans(uiDot3, i, item.Dice3);
                SetDot(uiDot3, 3);

                if (item.Dice1 == item.Dice2 && item.Dice1 == item.Dice3)
                {
                    uiDot1.transform.localPosition = new Vector3(uiDot1.transform.localPosition.x, 16f, 0f);
                    uiDot2.transform.localPosition = new Vector3(uiDot2.transform.localPosition.x, 0f, 0f);
                    uiDot3.transform.localPosition = new Vector3(uiDot3.transform.localPosition.x, -16f, 0f);
                }
                else if (item.Dice3 == item.Dice1)
                {
                    uiDot1.transform.localPosition  = new Vector3(uiDot1.transform.localPosition.x, 8f, 0f);
                    uiDot3.transform.localPosition += new Vector3(0f, -8f, 0f);
                }
                else if (item.Dice3 == item.Dice2)
                {
                    uiDot2.transform.localPosition  = new Vector3(uiDot2.transform.localPosition.x, 8f, 0f);
                    uiDot3.transform.localPosition += new Vector3(0f, -8f, 0f);
                }
            }
        }

        for (int i = 0; i < txtGates.Length; i++)
        {
            int count = 0;
            if (gateCount.ContainsKey(i + 1))
            {
                count = gateCount[i + 1];
            }
            txtGates[i].text = count.ToString();
        }
    }