コード例 #1
0
    // banker - type 12
    public void HandleBankerSellGate(object[] data)
    {
        int    gate     = int.Parse(data[0].ToString());
        string gateName = "Chẵn";

        AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioBanCua);

        if (gate == (int)XocXocGate.Even)
        {
            if (!_xocxoc.IsDealer())
            {
                btMuaChan.gameObject.SetActive(true);
            }
        }
        else if (gate == (int)XocXocGate.Odd)
        {
            if (!_xocxoc.IsDealer())
            {
                btMuaLe.gameObject.SetActive(true);
            }
            gateName = "Lẻ";
        }

        SetNotify("Nhà cái bán cửa " + VKCommon.FillColorString(gateName, colorWin));
        DisableDealerButton();
    }
コード例 #2
0
    public static void LogError(string log, string hex)
    {
        //return;
#if UNITY_EDITOR || DEVELOPER
        Debug.LogError(VKCommon.FillColorString(log, hex));
#endif
    }
コード例 #3
0
 private void AddChat(SRSTaiXiuChat item)
 {
     chatData += "\n" + VKCommon.SetBoldString(VKCommon.FillColorString(item.U + ":", item.U.Equals(Database.Instance.Account().DisplayName) ? hexColorChatMe : hexColorChatOther))
                 + " " + item.M;
     if (chatData.Length > maxChatItem)
     {
         int index = chatData.IndexOf("\n");
         chatData = chatData.Substring(index + 1);
     }
 }
コード例 #4
0
    public void Load(SRSTaiXiuTransactionHistoryItem data, Color cWin, Color cLose, Color cNormal)
    {
        gameObject.SetActive(true);

        txtId.text     = "#" + data.SessionID.ToString("F0");
        txtTime.text   = data.Time;
        txtGate.text   = VKCommon.FillColorString(data.BetSide == 0 ? "TÀI" : "XỈU", "#" + (data.BetSide == data.Result ? ColorUtility.ToHtmlStringRGB(cWin) : ColorUtility.ToHtmlStringRGB(cLose)));
        txtResult.text = data.ResultText + VKCommon.FillColorString(" (" + (data.Result == 0 ? "TÀI" : "XỈU") + ")", "#" + ColorUtility.ToHtmlStringRGB(cNormal));
        txtBet.text    = VKCommon.ConvertStringMoney(data.Bet);
        txtRefund.text = VKCommon.ConvertStringMoney(data.Refund);
        txtWin.text    = VKCommon.ConvertStringMoney(data.Award);
    }
コード例 #5
0
    public void HandleUserBuyGate(object[] data)
    {
        string userId = data[0].ToString();
        int    gate   = int.Parse(data[1].ToString());

        var uiGateTemp = uiGates.FirstOrDefault(a => a.gateType == (XocXocGate)gate);

        if (uiGateTemp != null)
        {
            uiGateTemp.accountIdBuyGate = userId;
        }

        string gateName = "Chẵn";

        if (gate == (int)XocXocGate.Odd)
        {
            gateName = "Lẻ";
        }

        if (_xocxoc.myData.AccountId.Equals(userId))
        {
            SetNotify("Bạn đã mua mua cửa " + VKCommon.FillColorString(gateName, colorWin));
        }
        else
        {
            var uiPlayerTemp = uiPlayers.FirstOrDefault(a => a._player != null && a._player.AccountId.Equals(userId));
            if (uiPlayerTemp != null)
            {
                SetNotify("Người chơi " + VKCommon.FillColorString("'" + uiPlayerTemp._player.AccountName + "'", colorWin) + " đã mua cửa " + VKCommon.FillColorString(gateName, colorWin));
            }
            else
            {
                SetNotify("Đã có người chơi mua cửa " + VKCommon.FillColorString(gateName, colorWin));
            }
        }

        DisableBuyerButton();
    }
コード例 #6
0
    public void Load(SRSBauCuaRankItem info, int rank)
    {
        gameObject.SetActive(true);

        gBackground.SetActive(rank % 2 == 0);

        txtRank.text = rank.ToString();

        txtName.text  = Database.Instance.Account().DisplayName.Equals(info.AccountName) ? VKCommon.FillColorString(info.AccountName, "#DBD476") : info.AccountName;
        txtMoney.text = VKCommon.ConvertStringMoney(info.Award);
    }
コード例 #7
0
    // 20s for end
    IEnumerator WaitShowResult(int result, SRSXocXocMyWinLose myWinLose, List <SRSXocXocPlayerWinLose> playerWinLoses)
    {
        vkCountDown.StopCountDown();
        vkCountDown.gameObject.SetActive(false);

        List <int>        dices   = new List <int>();
        List <XocXocGate> winGate = new List <XocXocGate>();

        switch (result)
        {
        case 0:
            dices = new List <int> {
                1, 1, 1, 1
            };
            winGate.Add(XocXocGate.Even);
            winGate.Add(XocXocGate.FourDown);
            break;

        case 1:
            dices = new List <int> {
                0, 1, 1, 1
            };
            winGate.Add(XocXocGate.Odd);
            winGate.Add(XocXocGate.ThreeDown);
            break;

        case 2:
            dices = new List <int> {
                1, 1, 0, 0
            };
            winGate.Add(XocXocGate.Even);
            break;

        case 3:
            dices = new List <int> {
                0, 0, 0, 1
            };
            winGate.Add(XocXocGate.Odd);
            winGate.Add(XocXocGate.ThreeUp);
            break;

        case 4:
            dices = new List <int> {
                0, 0, 0, 0
            };
            winGate.Add(XocXocGate.Even);
            winGate.Add(XocXocGate.FourUp);
            break;
        }
        VKCommon.Shuffle(dices);
        _batdia.InitDice(dices[0], dices[1], dices[2], dices[3]);

        Database.Instance.UpdateUserMoney(_xocxoc.moneyType, myWinLose.balance);
        yield return(new WaitForSeconds(1f));

        _xocxoc.session.History.Add(result);
        LoadHistory();

        // refund + Banker win
        double dealerTakeMoney = 0;

        foreach (var uiGate in uiGates)
        {
            if (winGate.Contains(uiGate.gateType))
            {
                uiGate.ShowResult(true);
                dealerTakeMoney += uiGate.allBet;
            }
            else
            {
                uiGate.ShowResult(false);
                Transform transTarget = transSystemChip;
                if (!string.IsNullOrEmpty(uiGate.accountIdBuyGate))
                {
                    var uiPlayerTemp = uiPlayers.FirstOrDefault(a => a._player != null && a._player.AccountId.Equals(uiGate.accountIdBuyGate));
                    if (uiPlayerTemp != null)
                    {
                        transTarget = uiPlayerTemp.transform;
                    }
                }

                MoveWinAuto(ConvertTotalMoneyToChip(uiGate.allBet), uiGate, transTarget);
            }

            // anim or refun
            var winLose = myWinLose.winLose.FirstOrDefault(a => a.Gate == (int)uiGate.gateType);
            if (winLose != null)
            {
                if (_xocxoc.IsDealer())
                {
                    // chua lam gi
                }
                else
                {
                    if (winLose.Refund > 0)
                    {
                        uiGate.ShowDataGate(uiGate.allBet, uiGate.meBetOld - winLose.Refund, false);
                        uiGate.ShowNotify("Hoàn tiền\n" + VKCommon.FillColorString(VKCommon.ConvertStringMoney(winLose.Refund), colorRefund));
                    }
                }
            }
        }

        yield return(new WaitForSeconds(1.2f));

        // show tien an neu la dealer
        if (_xocxoc.IsDealer() && dealerTakeMoney > 0)
        {
            uiPlayerMaster.ShowNotify("+" + VKCommon.FillColorString(VKCommon.ConvertStringMoney(dealerTakeMoney), colorWin));
        }

        // load chip me - player
        double winPrize = 0;

        foreach (var uiGate in uiGates)
        {
            // me
            if (!_xocxoc.IsDealer())
            {
                var winLose = myWinLose.winLose.FirstOrDefault(a => a.Gate == (int)uiGate.gateType);
                if (winLose != null)
                {
                    if (winLose.Prize > 0)
                    {
                        winPrize += winLose.Prize;
                        MoveWinAuto(ConvertTotalMoneyToChip(winLose.Prize), uiGate, imgMyAvatar.transform);
                    }
                }
            }

            // player
            if (winGate.Contains(uiGate.gateType))
            {
                foreach (var uiPlayerTemp in uiPlayers)
                {
                    if (uiPlayerTemp._player != null && uiPlayerTemp.gateBets.ContainsKey(uiGate.gateType))
                    {
                        MoveWinAuto(ConvertTotalMoneyToChip(uiPlayerTemp.gateBets[uiGate.gateType] * uiGate.multiReward), uiGate, uiPlayerTemp.transform);
                    }
                }
            }

            // gate
            uiGate.ShowDataGate(0, 0, false);
        }

        yield return(new WaitForSeconds(1.2f));

        // show money
        if (winPrize > 0)
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioThang);
            SetNotifyWinLose(VKCommon.FillColorString("+" + VKCommon.ConvertStringMoney(winPrize), colorWin));
        }
        else if (winPrize < 0)
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioThua);
        }
        else
        {
            AudioAssistant.Instance.PlaySoundGame(_config.gameId, _config.audioThang);
        }

        foreach (var playerData in playerWinLoses)
        {
            var uiPlayer = uiPlayers.FirstOrDefault(a => a.IsPlayer(playerData.AccountId));
            if (uiPlayer != null)
            {
                if (playerData.TotalPrize > 0)
                {
                    uiPlayer.ShowNotify(VKCommon.FillColorString("+" + VKCommon.ConvertStringMoney(playerData.TotalPrize), colorWin));
                    uiPlayer.UpdatePlayer(playerData.Balance);
                }
            }
            else if (uiPlayerMaster.gameObject.activeSelf && uiPlayerMaster.IsPlayer(playerData.AccountId))
            {
                uiPlayerMaster.UpdatePlayer(playerData.Balance);
            }
        }

        if (_xocxoc.session.TotalPlayer == 1 && uiPlayerMaster.gameObject.activeSelf)
        {
            yield return(new WaitForSeconds(2f));

            // fake Update State
            if (_xocxoc.session.TotalPlayer == 1)
            {
                object[] fakeData = new object[4];
                fakeData[0] = "0";
                fakeData[1] = "0";
                fakeData[2] = _xocxoc.session.SessionId;
                fakeData[3] = _xocxoc.myData.AccountId;

                HandleChangeState(fakeData);
            }
        }
    }
コード例 #8
0
    public void Load(SRSTaiXiuSessionLogItem info)
    {
        gameObject.SetActive(true);

        txtTime.text = info.Time;

        txtName.text = Database.Instance.Account().DisplayName.Equals(info.AccountName) ? VKCommon.FillColorString(info.AccountName, "#DBD476") : info.AccountName;
        txtHoan.text = VKCommon.ConvertStringMoney(info.Refund);
        txtDat.text  = VKCommon.ConvertStringMoney(info.Bet);
    }