Beispiel #1
0
    public static void BetToWin(long _bet
                                , List <BetToWinValueDetail> _listBetToWinInfo
                                , List <long> _listBetToWinValue
                                , System.Action <MessageReceiving, int> _onFinished)
    {
        if (CoreGameManager.instance.giaLapNgatKetNoi)
        {
            if (_onFinished != null)
            {
                _onFinished(null, 1);
            }
            return;
        }
        if (CoreGameManager.instance.giaLapMangChapChon)
        {
            if (Random.Range(0, 100) < CoreGameManager.instance.giaLapTyLeRotMang)
            {
                if (_onFinished != null)
                {
                    _onFinished(null, 1);
                }
                return;
            }
        }
        if (message_BetToWin == null)
        {
            message_BetToWin = new MessageSending(CMD_ONEHIT.Game_BetToWin_NoAchievement);
        }
        else
        {
            message_BetToWin.ClearData();
        }
        message_BetToWin.writeLong(_bet);
        message_BetToWin.writeshort((short)_listBetToWinInfo.Count);
        for (int i = 0; i < _listBetToWinInfo.Count; i++)
        {
            message_BetToWin.writeInt(_listBetToWinInfo[i].weight);
            message_BetToWin.writeLong(_listBetToWinValue[i]);
        }
        message_BetToWin.writeByte((byte)DataManager.instance.userData.databaseId);
        message_BetToWin.writeLong(DataManager.instance.userData.userId);
        switch (DataManager.instance.userData.databaseId)
        {
        case UserData.DatabaseType.DATABASEID_DEVICE:
            message_BetToWin.writeString(DataManager.instance.userData.deviceId);
            // message_BetToWin.writeString (SystemInfo.deviceModel);
            break;

        case UserData.DatabaseType.DATABASEID_BIGXU:
            message_BetToWin.writeString(DataManager.instance.userData.username);
            message_BetToWin.writeString(DataManager.instance.userData.password);
            break;

        case UserData.DatabaseType.DATABASEID_FACEBOOK:
            message_BetToWin.writeString(DataManager.instance.userData.tokenFBIdOfBusiness);
            break;

        default:
                        #if TEST
            Debug.LogError(">>> Lỗi databaseId: " + DataManager.instance.userData.databaseId);
                        #endif
            break;
        }

                #if TEST
        string _tmp = _bet + "|"
                      + DataManager.instance.userData.databaseId + "|"
                      + DataManager.instance.userData.userId + "|";
        Debug.Log(">>>CMD BetToWin : " + message_BetToWin.getCMD() + "|" + _tmp);
                #endif

        NetworkGlobal.instance.StartOnehit(message_BetToWin, _onFinished);
    }