public PlayerAddGold_Data(MessageReceiving _mess)
 {
     sessionId = _mess.readShort();
     reason    = _mess.readInt();
     goldAdd   = _mess.readLong();
     goldLast  = _mess.readLong();
 }
Exemple #2
0
    public UserDataInGame(MessageReceiving _mess, short _newSessionId = -1, sbyte _index = -1)
    {
        _sessionId     = _newSessionId;
        index          = _index;
        databaseId     = (UserData.DatabaseType)_mess.readByte();
        userId         = _mess.readLong();
        avatarid       = _mess.readByte();
        gold           = _mess.readLong();
        nameShowInGame = _mess.readString();
        if (string.IsNullOrEmpty(nameShowInGame))
        {
            nameShowInGame = "Unknown";
        }
        win  = _mess.readInt();
        tie  = _mess.readInt();
        lose = _mess.readInt();

        // Debug.Log(win + " - " + tie + " - " + lose);

        if (databaseId == UserData.DatabaseType.DATABASEID_FACEBOOK)
        {
            facebookId = _mess.readLong();
        }
        else
        {
            facebookId = -1;
        }
    }
    public void InitDataWhenGetTableInfo(MessageReceiving _mess)
    {
        InitListOtherUserDataInGame(_mess);
        InitListOnChair(_mess);

        totalBet   = 0;
        sumCardGet = 0;
        betDefault = _mess.readLong();
        currentBet = _mess.readLong();
        timeDurringChangeCircle = _mess.readInt();
        timeDurringPlayGame     = _mess.readInt();
        currentGameState        = (GameState)_mess.readByte();

        indexCircleBeSkipped = -1;

        if (currentGameState == GameState.STATUS_WAIT_FOR_PLAYER)
        {
            long _timeLeftToStartGame = _mess.readLong(); // thời gian đếm ngược để start game (nếu dương)
            if (_timeLeftToStartGame > 0)
            {
                nextTimeToStartGame = System.DateTime.Now.AddMilliseconds(_timeLeftToStartGame);
            }
            else
            {
                nextTimeToStartGame = System.DateTime.Now;
            }
            lastCardPut        = -1;
            currentColor       = GetBackgroundColor(lastCardPut);
            nextTimeToStopGame = System.DateTime.MinValue;
        }
        else
        {
            nextTimeToStartGame = System.DateTime.Now;

            long _timeLeftToStopGame = _mess.readLong();
            nextTimeToStopGame = System.DateTime.Now.AddMilliseconds(_timeLeftToStopGame);

            lastCardPut = _mess.readByte();
            globalCards.Add(lastCardPut);

            bool _direction = _mess.readBoolean();
            turnDirection = _direction ? TurnDirection.ClockWise : TurnDirection.CounterClockWise;

            currentCircle = _mess.readByte();
            sbyte _circleLength = _mess.readByte();
            for (int i = 0; i < _circleLength; i++)
            {
                Uno_PlayerPlayingData _tmpData = new Uno_PlayerPlayingData(_mess, listSessionIdGlobalPlayer);
                _tmpData.totalBet = currentBet;
                listPlayerPlayingData.Add(_tmpData);
                listSessionIdPlaying.Add(_tmpData.userData.sessionId);
                totalBet += currentBet;
            }
            long _timeLeftToChangeCircle = _mess.readLong();
            nextTimeToChangeCircle = System.DateTime.Now.AddMilliseconds(_timeLeftToChangeCircle);

            currentColor = GetBackgroundColor(lastCardPut);
        }
        hasLoadTableInfo = true;
    }
Exemple #4
0
    public void SetDataTableInfo(MessageReceiving message)
    {
        InitListOtherUserDataInGame(message);
        bet = message.readLong();
        BOL_Manager.instance.betDefault        = bet;
        BolNetworkReceiving.instance.betSetup  = bet;
        BOL_ChoiceHero.instance.betInGame.text = bet.ToString();
        long betProcess = message.readLong();

        mapid     = message.readShort();
        TIME_PLAY = message.readLong();
        status    = message.readByte();
        Debugs.LogRed("bet " + bet + "betProcess" + betProcess + " |mapid|" + mapid + "  |Time_play|" + TIME_PLAY + " |status|" + status);
        if (status == 0)
        {
            BOL_Main_Controller.instance.ChairPosition = Constant.CHAIR_PLAYER;
            ReceiveWaitingGame(message);
        }
        else
        {
            BOL_Main_Controller.instance.ChairPosition = Constant.CHAIR_VIEWER;
            ReceivePlayingGame(message);
        }
        hasLoadTableInfo = true;
    }
Exemple #5
0
    public void InitDataWhenGetTableInfo(MessageReceiving _mess)
    {
        DataManager.instance.userData.AddNewTotalBetInGameInfo(IMiniGameInfo.Type.DragonTigerCasino);

        winAchievement  = _mess.readInt();
        tieAchievement  = _mess.readInt();
        loseAchievement = _mess.readInt();

        int _timeLeft = _mess.readInt();

        duringTime           = _mess.readInt();
        nextTimeToShowResult = System.DateTime.Now.AddMilliseconds(_timeLeft);

        sbyte buffer_History = _mess.readByte();

        listHistory = new List <sbyte>();
        for (int i = 0; i < buffer_History; i++)
        {
            listHistory.Add(_mess.readByte());
        }
        tableCountDragon     = _mess.readShort();
        tableGlobalBetDragon = _mess.readLong();
        tableCountTie        = _mess.readShort();
        tableGlobalBetTie    = _mess.readLong();
        tableCountTiger      = _mess.readShort();
        tableGlobalBetTiger  = _mess.readLong();

        tableMyBetDragon = 0;
        tableMyBetTie    = 0;
        tableMyBetTiger  = 0;

        hasLoadGameInfo = true;
    }
Exemple #6
0
        public Koprok_MeAddBet_Data(MessageReceiving _mess)
        {
            isAddOk    = _mess.readBoolean();
            tableMyBet = new List <long>();
            if (isAddOk)
            {
                indexBet  = _mess.readByte();
                chipIndex = _mess.readShort();
                goldAdd   = _mess.readLong();
                myBet     = _mess.readLong();
                countBet  = _mess.readShort();
                globalBet = _mess.readLong();

                myGOLD     = _mess.readLong();
                myTotalBet = _mess.readLong();
            }
            else
            {
                indexBet  = _mess.readByte();
                chipIndex = _mess.readShort();
                goldAdd   = _mess.readLong();

                for (int i = 0; i < 6; i++)
                {
                    tableMyBet.Add(_mess.readLong());
                }

                myGOLD     = _mess.readLong();
                myTotalBet = _mess.readLong();
            }
        }
 public MeSitDownFail_Data(MessageReceiving _mess)
 {
     isSuccess = _mess.readBoolean();
     if (!isSuccess)
     {
         chairId        = _mess.readByte();
         currentChairId = _mess.readByte();
         totalBet       = _mess.readLong();
         myGold         = _mess.readLong();
     }
 }
        public AnimalRacing_PlayerAddBet_Data(MessageReceiving _mess)
        {
            sessionid = _mess.readShort();
            indexBet  = _mess.readByte();
            chipIndex = _mess.readShort();
            goldAdd   = _mess.readLong(); // biến dư
            playerBet = _mess.readLong(); // số gold tại vị trí đặt cược (gold của người chơi đặt cược)
            globalBet = _mess.readLong(); // số gold tại vị trí đặt cược (gold global)

            myGOLD   = _mess.readLong();  // số gold trước khi cược (không cần lắm)
            totalBet = _mess.readLong();
            // Debug.Log(goldAdd + " - " + playerBet + " - " + globalBet + " - " + goldPlayerCurrent + " - " + totalBet + " - " + goldPlayerRemain);
        }
    public void SetPlayerInfo(MessageReceiving message)
    {
        databaseid = message.readByte();
        switch (databaseid)
        {
        case (sbyte)Constant.Databaseid.DATABASEID_DEVICE:
            deviceString = message.readString();
            deviceModel  = message.readString();
            break;

        case (sbyte)Constant.Databaseid.DATABASEID_BIGXU:
            username = message.readString();
            break;

        case (sbyte)Constant.Databaseid.DATABASEID_FACEBOOK:
            facebookid    = message.readLong();
            facebooktoken = message.readString();
            break;
        }
        userid              = message.readLong();
        nameShow            = message.readString();;
        avatarid            = message.readByte();
        gold                = message.readLong();
        gem                 = message.readLong();
        gold_debt           = message.readLong();
        gem_debt            = message.readLong();
        time_create_account = message.readLong();
        lastTimePlay        = message.readLong();
    }
 public void SetPlayerInGame(MessageReceiving message)
 {
     databaseid = message.readByte();
     userid     = message.readLong();
     avatarid   = message.readByte();
     gold       = message.readLong();
     nameShow   = message.readString();
     win        = message.readInt();
     tie        = message.readInt();
     lose       = message.readInt();
     if (databaseid == (sbyte)Constant.Databaseid.DATABASEID_FACEBOOK)
     {
         facebookid = message.readLong();
     }
 }
        public SubGame_PlayerChat_Data(MessageReceiving _mess)
        {
            databaseid = (UserData.DatabaseType)_mess.readByte();
            userid     = _mess.readLong();
            avatarid   = _mess.readByte();
            nameShow   = _mess.readString();
            fbId       = -1;
            if (databaseid == UserData.DatabaseType.DATABASEID_FACEBOOK)
            {
                fbId = _mess.readLong();
            }
            contentChat = _mess.readString();

            userData = new UserDataInGame(databaseid, userid, fbId, avatarid, nameShow);
        }
Exemple #12
0
 public TemporaryServerDetail(MessageReceiving _messageReceiving)
 {
     roomId      = _messageReceiving.readInt();
     version     = _messageReceiving.readLong();
     gameId      = _messageReceiving.readShort();
     subServerId = _messageReceiving.readInt();
 }
Exemple #13
0
 public DragonTiger_UpdateTableBet_Data(MessageReceiving _mess)
 {
     indexBet   = _mess.readByte();
     tableCount = _mess.readShort();
     tableBet   = _mess.readLong();
     // Debug.Log(">>> " + _indexBet + " - " + _tableCount + " - " + _tableBet);
 }
Exemple #14
0
    public IAPProductDetail(MessageReceiving _mess)
    {
        id             = _mess.readInt();
        productId      = _mess.readString();
        goldBuy        = _mess.readLong();
        discount_title = _mess.readString();

        long _deltaTimeDiscount = _mess.readLong();

        System.DateTime _start = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
        long            _currentMillisecondsDiscountFinish = MyConstant.currentTimeMilliseconds + _deltaTimeDiscount;

        discount_time_finish = _start.AddMilliseconds(_currentMillisecondsDiscountFinish).ToLocalTime();

        discount_gold = _mess.readLong();
    }
Exemple #15
0
    public SubServerDetail(MessageReceiving _mess)
    {
        listIpDetail   = new List <IpDetail>();
        listRoomDetail = new List <RoomDetail>();

        subServerId   = _mess.readInt();
        version       = _mess.readLong();
        subServerName = _mess.readString();
        countryCode   = _mess.readString();

        short      _numberRoomDetail = _mess.readShort();
        RoomDetail _tmpNewRoomDetail = null;

        for (int i = 0; i < _numberRoomDetail; i++)
        {
            _tmpNewRoomDetail = new RoomDetail(_mess);
            listRoomDetail.Add(_tmpNewRoomDetail);
        }

        short    _numberIpDetail = _mess.readShort();
        IpDetail _tmpIpDetail    = null;

        for (int i = 0; i < _numberIpDetail; i++)
        {
            _tmpIpDetail = new IpDetail(_mess);
            listIpDetail.Add(_tmpIpDetail);
        }
    }
        public Uno_FinishGame_Data(MessageReceiving _mess, UnoGamePlayData _unoGamePlayData)
        {
            id           = MyConstant.currentTimeMilliseconds;
            reasonFinish = (Reason)_mess.readByte();
            goldWin      = _mess.readLong();
            sbyte _numberWin = _mess.readByte();

            if (_numberWin <= 0)
            {
                                #if TEST
                Debug.LogError(">>> Bug Server FinishGame (0): " + _numberWin);
                                #endif
            }
            listPlayersData = new List <Player_Data>();
            for (sbyte i = 0; i < _numberWin; i++)
            {
                Player_Data _player = new Player_Data(_mess, true);
                listPlayersData.Add(_player);
            }

            sbyte _numberLose = _mess.readByte();
            if (_numberLose <= 0)
            {
                                #if TEST
                Debug.LogError(">>> Bug Server FinishGame (1): " + _numberLose);
                                #endif
            }
            List <Player_Data> _listLoser = new List <Player_Data>();
            for (sbyte i = 0; i < _numberLose; i++)
            {
                Player_Data _player = new Player_Data(_mess, false);
                _listLoser.Add(_player);
            }
            _listLoser.Sort(delegate(Player_Data _x, Player_Data _y)
            {
                if (_x.totalPoint > _y.totalPoint)
                {
                    return(1);
                }
                else if (_x.totalPoint == _y.totalPoint)
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            });
            for (int i = 0; i < _listLoser.Count; i++)
            {
                listPlayersData.Add(_listLoser[i]);
            }
            if (listPlayersData.Count > _unoGamePlayData.listPlayerPlayingData.Count)
            {
                                #if TEST
                Debug.LogError(">>> Bug Server FinishGame (2): " + listPlayersData.Count + " - " + _unoGamePlayData.listPlayerPlayingData.Count);
                                #endif
            }
        }
Exemple #17
0
 public RoomDetail(MessageReceiving _mess)
 {
     roomId      = _mess.readInt();
     roomName    = _mess.readString();
     versionRoom = _mess.readLong();
     gameId      = _mess.readShort();
     numberTable = _mess.readShort();
 }
 public AnimalRacing_UpdateTableBet_Data(MessageReceiving _mess)
 {
     listGlobalBet = new List <long>();
     for (int i = 0; i < 9; i++)
     {
         listGlobalBet.Add(_mess.readLong());
     }
 }
        public Uno_StartGame_Data(MessageReceiving _mess, UnoGamePlayData _unoGamePlayData)
        {
            turnDirection = TurnDirection.ClockWise;
            sbyte _numCard = 7;

            sbyte[] _myCards = new sbyte[_numCard];
            for (int i = 0; i < _myCards.Length; i++)
            {
                _myCards[i] = _mess.readByte();
            }
            currentBet = _mess.readLong();
            sbyte _circleLength = _mess.readByte();

            totalBet             = 0;
            listPlayerPlaying    = new List <Uno_PlayerPlayingData>();
            listSessionIdPlaying = new List <short>();
            Uno_PlayerPlayingData _tmpPlayerPlaying = null;

            for (int i = 0; i < _circleLength; i++)
            {
                _tmpPlayerPlaying = new Uno_PlayerPlayingData();
                short _sessionId = _mess.readShort();
                _tmpPlayerPlaying.indexChair = _mess.readByte();
                _tmpPlayerPlaying.userData   = new UserDataInGame(_mess, _sessionId, -1);

                if (_unoGamePlayData.CheckIfIsMe(_sessionId))
                {
                    _tmpPlayerPlaying.isMe = true;
                    for (int j = 0; j < _numCard; j++)
                    {
                        _tmpPlayerPlaying.ownCards.Add(_myCards[j]);
                    }
                }
                else
                {
                    _tmpPlayerPlaying.isMe = false;
                    for (int j = 0; j < _numCard; j++)
                    {
                        _tmpPlayerPlaying.ownCards.Add(-1);
                    }
                }

                _tmpPlayerPlaying.totalBet = currentBet;
                totalBet += currentBet;

                listPlayerPlaying.Add(_tmpPlayerPlaying);
                listSessionIdPlaying.Add(_sessionId);
            }

            long _timeLeftToChangeCircle = _unoGamePlayData.timeDurringChangeCircle;

            nextTimeToChangeCircle = System.DateTime.Now.AddMilliseconds(_timeLeftToChangeCircle);

            long _timeLeftToStopGame = _unoGamePlayData.timeDurringPlayGame;

            nextTimeToStopGame = System.DateTime.Now.AddMilliseconds(_timeLeftToStopGame);
            // Debug.Log(">>> " + timeLeftToChangeCircle + " -- " + nextTimeToChangeCircle);
        }
        public AnimalRacing_MeAddBet_Data(MessageReceiving _mess)
        {
            caseCheck = _mess.readBoolean(); // false thì đọc tiếp
            if (!caseCheck)
            {
                indexBet  = _mess.readByte();
                chipIndex = _mess.readShort();
                goldAdd   = _mess.readLong(); // biến dư

                listGlobalBet = new List <long>();
                for (int i = 0; i < 9; i++)
                {
                    listGlobalBet.Add(_mess.readLong());
                }
                myGOLD   = _mess.readLong(); // số gold trước khi cược (không cần lắm)
                totalBet = _mess.readLong();
            }
        }
Exemple #21
0
    // public Coroutine SetCheckAfterGetFirstData(){
    //     return StartCoroutine(DoActionCheckAfterGetFirstData());
    // }

    // IEnumerator DoActionCheckAfterGetFirstData(){
    //     IAPManager.instance.CheckWhenLogin();
    //     yield return Yielders.Get(1f);
    //     ShowAnnouncement();
    // }

    /*/IEnumerator DoActionGetFirstData(){
     #if TEST
     *  Debug.Log(">>> Get Sub Server Detail!");
     #endif
     *  bool _isFinished = false;
     *  bool _canTestSubSv = false;
     *
     *  OneHitAPI.GetSubServerDetailAndData((_messageReceiving, _error) =>
     *  {
     *      if (_messageReceiving != null)
     *      {
     *          long _featureVersion = _messageReceiving.readLong(); // nhỏ hơn giá trị này --> thông báo update
     #if TEST
     *          Debug.Log(">>> Version: " + _featureVersion + " - " + MyConstant.featureVersionCore);
     #endif
     *          if (MyConstant.featureVersionCore < _featureVersion)
     *          {
     *              DataManager.instance.haveNewVersion = true;
     *          }
     *          DataManager.instance.announcement = _messageReceiving.readString();
     *
     *          // ------------- GoldDaily ------------- //
     *          sbyte _numberGoldDaily = _messageReceiving.readByte();
     *          List<RewardDetail> _tmpListRewards = new List<RewardDetail>();
     *          for (int i = 0; i < _numberGoldDaily; i++)
     *          {
     *              long _goldDaily = _messageReceiving.readLong();
     *              RewardDetail _reward = new RewardDetail(IItemInfo.ItemType.Gold, _goldDaily);
     *              _tmpListRewards.Add(_reward);
     *          }
     *          DataManager.instance.dailyRewardData.listRewards = _tmpListRewards;
     *          // ------------------------------------- //
     *
     *          // ------------- Leaderboard ------------- //
     *          long _currentMilisecondTimeUpdateTop = _messageReceiving.readLong();
     *          sbyte _numberTop = _messageReceiving.readByte();
     *          List<UserData> _listTopGold = new List<UserData>();
     *          for(int i = 0; i < _numberTop; i ++){
     *              UserData _userData = new UserData();
     *              _userData.InitData();
     *              _userData.GetMoreUserData(_messageReceiving);
     *              _listTopGold.Add(_userData);
     *          }
     *          System.DateTime _start = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
     *                  DataManager.instance.leaderboardData.lastTimeUpdateTop = _start.AddMilliseconds(_currentMilisecondTimeUpdateTop).ToLocalTime();
     *          DataManager.instance.leaderboardData.topGold = _listTopGold;
     *          DataManager.instance.leaderboardData.SortListTopGoldAgain();
     *          // --------------------------------------- //
     *
     *          // ------------- List Sub Server ------------- //
     *          short _numberSubServer = _messageReceiving.readShort();
     *          List<SubServerDetail> _tmpListSubSv = new List<SubServerDetail>();
     *          if (_numberSubServer > 0){
     *              for (int i = 0; i < _numberSubServer; i++){
     *                  SubServerDetail _tmpSubSvDetail = new SubServerDetail(_messageReceiving);
     *                  _tmpListSubSv.Add(_tmpSubSvDetail);
     *              }
     *          }
     *          DataManager.instance.subServerData.LoadDataFromSv(_tmpListSubSv);
     *          // --------------------------------------- //
     *
     *          // ------------- RoomDetail ------------- //
     *          List<TemporaryServerDetail> _tmpListTemporaryServerDetail = new List<TemporaryServerDetail>();
     *          short _numberRoomDetail = _messageReceiving.readShort();
     *          for(int i = 0; i < _numberRoomDetail; i ++){
     *              TemporaryServerDetail _tmpServerDetail = new TemporaryServerDetail(_messageReceiving);
     *              _tmpListTemporaryServerDetail.Add(_tmpServerDetail);
     *          }
     *          DataManager.instance.temporaryServerData.listDetail = _tmpListTemporaryServerDetail;
     *
     *          for(int i = 0; i < DataManager.instance.miniGameData.listMiniGameDetail.Count; i++){
     *              MiniGameDetail _gameDetail = DataManager.instance.miniGameData.listMiniGameDetail[i];
     *              if(!_gameDetail.myInfo.isSubGame){
     *                  // _gameDetail.SetUpRoomDataAgain();
     *              }
     *          }
     *          // --------------------------------------- //
     *          _canTestSubSv = true;
     *      }
     *      else
     *      {
     #if TEST
     *          Debug.LogError(">>> GetSubServerDetailAndData Error Code: " + _error);
     #endif
     *
     *          // for(int i = 0; i < DataManager.instance.miniGameData.listMiniGameDetail.Count; i++){
     *          //     MiniGameDetail _gameDetail = DataManager.instance.miniGameData.listMiniGameDetail[i];
     *          //     if(!_gameDetail.myInfo.isSubGame
     *          //         && _gameDetail.roomData.listRoomServerDetail.Count == 0){
     *          //         _gameDetail.SetUpRoomDataAgain();
     *          //     }
     *          // }
     *      }
     *      _isFinished = true;
     *  });
     *  yield return new WaitUntil(() => _isFinished);
     *
     *  if(_canTestSubSv){
     *      NetworkGlobal.instance.TestSub(DataManager.instance.subServerData.listSubServerDetail, ()=>{
     *          DataManager.instance.subServerData.SortListSubServerAgain();
     *          if(HomeManager.instance != null){
     *              if (!string.IsNullOrEmpty(DataManager.instance.announcement)){
     *                  List<string> _listAnnouncement = new List<string>();
     *                  _listAnnouncement.Add(DataManager.instance.announcement);
     *                  HomeManager.instance.announcement.InitData(_listAnnouncement);
     *                  HomeManager.instance.announcement.Show();
     *              }
     *              if (DataManager.instance.userData.userId != 0){
     *                  HomeManager.instance.LoadDataGoldGemFromServer();
     *              }
     *          }
     *          IAPManager.instance.CheckWhenLogin();
     *      });
     *  }else{
     *      DataManager.instance.subServerData.SortListSubServerAgain();
     *      if(CoreGameManager.instance.currentSceneManager != null
     *          && CoreGameManager.instance.currentSceneManager.mySceneType == IMySceneManager.Type.Home){
     *          if (!string.IsNullOrEmpty(DataManager.instance.announcement)){
     *              List<string> _listAnnouncement = new List<string>();
     *              _listAnnouncement.Add(DataManager.instance.announcement);
     *              announcement.InitData(_listAnnouncement);
     *              announcement.Show();
     *          }
     *      }
     *  }
     * }*/

    void InitGoldDailyData(MessageReceiving _mess)
    {
        sbyte _numberGoldDaily = _mess.readByte();
        List <RewardDetail> _tmpListRewards = new List <RewardDetail>();

        for (int i = 0; i < _numberGoldDaily; i++)
        {
            long         _goldDaily = _mess.readLong();
            RewardDetail _reward    = new RewardDetail(IItemInfo.ItemType.Gold, _goldDaily);
            _tmpListRewards.Add(_reward);
        }
        DataManager.instance.dailyRewardData.listRewards = _tmpListRewards;
    }
Exemple #22
0
    public void GetMoreUserData(MessageReceiving _messageReceiving)
    {
        databaseId = (DatabaseType)_messageReceiving.readByte();
        switch (databaseId)
        {
        case UserData.DatabaseType.DATABASEID_DEVICE:
            deviceId = _messageReceiving.readString();
            string _device_model = _messageReceiving.readString();
            break;

        case UserData.DatabaseType.DATABASEID_BIGXU:
            username = _messageReceiving.readString();
            break;

        case UserData.DatabaseType.DATABASEID_FACEBOOK:
            facebookId          = _messageReceiving.readLong();
            tokenFBIdOfBusiness = _messageReceiving.readString();
            break;

        case UserData.DatabaseType.DATABASEID_GOOGLE:
            googleData_mail       = _messageReceiving.readString();
            googleData_linkAvatar = _messageReceiving.readString();
            break;
        }

        userId         = _messageReceiving.readLong();
        nameShowInGame = _messageReceiving.readString();
        if (string.IsNullOrEmpty(nameShowInGame))
        {
            nameShowInGame = "Unknown";
        }
        avatarid          = _messageReceiving.readByte();
        gold              = _messageReceiving.readLong();
        timeCreateAccount = _messageReceiving.readLong();
        lastTimePlay      = _messageReceiving.readLong();
    }
Exemple #23
0
        public Koprok_Result_Data(MessageReceiving _mess, KoprokData _koprokData)
        {
            dice = new List <Koprok_GamePlay_Manager.IndexBet>();
            for (int i = 0; i < 3; i++)
            {
                dice.Add((Koprok_GamePlay_Manager.IndexBet)_mess.readByte());
            }
            caseCheck = _mess.readByte();
            switch (caseCheck)
            {
            case 1:             // xử lý game thành công
                gold_Limit  = _mess.readLong();
                goldProcess = _mess.readLong();
                long goldAdd = _mess.readLong();
                GOLD        = _mess.readLong();
                achievement = _mess.readInt();
                betUnit     = gold_Limit + goldProcess;
                                #if TEST
                Debug.Log(">>> " + gold_Limit + "|" + goldProcess + "|" + goldAdd + "|" + GOLD + "|" + achievement + "|" + betUnit);
                                #endif
                break;

            case 69:             // không đặt cược
                                #if TEST
                Debug.LogError("Người chơi đang không đặt cược");
                                #endif
                GOLD = DataManager.instance.userData.gold;
                break;

            case -99:             // lỗi serverGold
                                #if TEST
                Debug.LogError("Lỗi serverGold");
                                #endif
                GOLD = DataManager.instance.userData.gold;
                break;

            case -88:             // lỗi không đủ tiền cược khi cược đồng thời ở 2 thiết bị khác nhau, ở 2 sv khác nhau
                                #if TEST
                Debug.LogError("lỗi không đủ tiền cược khi cược đồng thời ở 2 thiết bị khác nhau, ở 2 sv khác nhau.");
                                #endif
                gold_Limit = _mess.readLong();
                GOLD       = _mess.readLong();
                break;

            default:
                                #if TEST
                Debug.LogError("Lỗi không xác định : " + caseCheck);
                                #endif
                GOLD = DataManager.instance.userData.gold;
                break;
            }
            nextTimeToShowResult = System.DateTime.Now.AddMilliseconds(_koprokData.duringTime);
        }
            public Player_Data(MessageReceiving _mess, bool _isWin)
            {
                isWin       = _isWin;
                indexCircle = _mess.readByte();
                goldLast    = _mess.readLong();
                if (_isWin)
                {
                    achievementWinUpdate  = _mess.readInt();
                    achievementLoseUpdate = -1;
                }
                else
                {
                    achievementWinUpdate  = -1;
                    achievementLoseUpdate = _mess.readInt();
                }
                ownCards = new List <sbyte>();
                sbyte _numberCard = _mess.readByte();

                if (_numberCard < 0)
                {
                                        #if TEST
                    Debug.LogError(">>> Bug Server (Player_Data " + _isWin + "): " + _numberCard);
                                        #endif
                }
                totalPoint = 0;
                for (sbyte i = 0; i < _numberCard; i++)
                {
                    sbyte _cardValue = _mess.readByte();
                    ownCards.Add(_cardValue);
                    if (_cardValue >= 52)
                    {
                        totalPoint += 50;
                    }
                    else
                    {
                        int _tmpPoint = _cardValue % 13;
                        if (_tmpPoint >= 10)
                        {
                            _tmpPoint = 10;
                        }
                        totalPoint += _tmpPoint;
                    }
                }
                // Debug.Log(">>>> " + indexCircle + " -- " + totalPoint);
            }
    public void InitDataWhenGetTableInfo(MessageReceiving _mess)
    {
        DataManager.instance.userData.AddNewTotalBetInGameInfo(IMiniGameInfo.Type.AnimalRacing);

        InitListOtherUserDataInGame(_mess);

        duringTime = _mess.readInt();
        int _timeLeft = _mess.readInt();

        nextTimeToShowResult = System.DateTime.Now.AddMilliseconds(_timeLeft);

        numberhistory = _mess.readByte();

        listHistoryData.Clear();
        HistoryData _tmpHistoryData = null;

        for (int i = 0; i < numberhistory; i++)
        {
            _tmpHistoryData            = new HistoryData();
            _tmpHistoryData.animalType = (AnimalRacing_AnimalController.AnimalType)_mess.readByte();
            _tmpHistoryData.score      = _mess.readShort();

            listHistoryData.Add(_tmpHistoryData);
        }

        listCurrentScore.Clear();
        for (int i = 0; i < 9; i++)
        {
            listCurrentScore.Add(_mess.readShort());
        }

        listGlobalBets.Clear();
        for (int i = 0; i < 9; i++)
        {
            listGlobalBets.Add(_mess.readLong());
        }

        listMyBets.Clear();
        for (int i = 0; i < 9; i++)
        {
            listMyBets.Add(0);
        }
        hasLoadTableInfo = true;
    }
Exemple #26
0
    public void InitDataWhenGetTableInfo(MessageReceiving _mess)
    {
        DataManager.instance.userData.AddNewTotalBetInGameInfo(IMiniGameInfo.Type.Koprok);

        winAchievement  = _mess.readInt();
        tieAchievement  = _mess.readInt();
        loseAchievement = _mess.readInt();

        int _timeLeft = _mess.readInt();

        duringTime           = _mess.readInt();
        nextTimeToShowResult = System.DateTime.Now.AddMilliseconds(_timeLeft);

        sbyte buffer_History = _mess.readByte();

        listHistory = new List <Koprok_History_Data>();
        for (int i = 0; i < buffer_History; i++)
        {
            Koprok_GamePlay_Manager.IndexBet _slot1 = (Koprok_GamePlay_Manager.IndexBet)_mess.readByte();
            Koprok_GamePlay_Manager.IndexBet _slot2 = (Koprok_GamePlay_Manager.IndexBet)_mess.readByte();
            Koprok_GamePlay_Manager.IndexBet _slot3 = (Koprok_GamePlay_Manager.IndexBet)_mess.readByte();
            listHistory.Add(new Koprok_History_Data(_slot1, _slot2, _slot3));
        }

        tableCount     = new List <short>();
        tableGlobalBet = new List <long>();
        tableMyBet     = new List <long>();

        for (int i = 0; i < 6; i++)
        {
            tableCount.Add(_mess.readShort());
        }

        for (int i = 0; i < 6; i++)
        {
            tableGlobalBet.Add(_mess.readLong());
            tableMyBet.Add(0);
        }

        myIndexBet = new List <Koprok_GamePlay_Manager.IndexBet>();

        hasLoadGameInfo = true;
    }
Exemple #27
0
    public InstallAppDetail(MessageReceiving _mess)
    {
        int _id = _mess.readInt();

        packageName   = _mess.readString();
        textkeySearch = _mess.readString();
        int count_install     = _mess.readInt();
        int sum_install       = _mess.readInt();
        int money_pay_to_user = _mess.readInt();

        isRating        = _mess.readBoolean();
        textTitle       = _mess.readString();
        textDescription = _mess.readString();
        linkIcon        = _mess.readString();
        timeKeep        = _mess.readLong();
        linkReport      = _mess.readString();

        currentState      = State.None;
        timeToGetReward   = DateTime.MinValue;
        reward            = new RewardDetail(IItemInfo.ItemType.Gold, money_pay_to_user);
        messRecieveReward = null;
    }
        public GoldUpdateData(MessageReceiving _mess)
        {
            sessionId = _mess.readShort();
            caseCheck = _mess.readByte();
            switch (caseCheck)
            {
            case 1: // xử lý tiền thành công
                gold_Limit  = _mess.readLong();
                goldProcess = _mess.readLong();
                goldAdd     = _mess.readLong();
                GOLD        = _mess.readLong();
                achievement = _mess.readInt();
                betUnit     = gold_Limit + goldProcess;
                #if TEST
                if (DataManager.instance.userData.sessionId == sessionId)
                {
                    Debug.Log(">>> " + gold_Limit + "|" + goldProcess + "|" + goldAdd + "|" + GOLD + "|" + achievement + "|" + betUnit);
                }
                                #endif
                break;

            case -55: // lỗi databasePlayer
                #if TEST
                Debug.Log(">>> lỗi databasePlayer: " + sessionId);
                                #endif
                break;

            case -88: // lỗi không đủ tiền
                #if TEST
                Debug.Log(">>> lỗi không đủ tiền: " + sessionId);
                                #endif
                gold_Limit = _mess.readLong();
                GOLD       = _mess.readLong();
                break;

            default:
                #if TEST
                Debug.Log(">>> Lỗi không xác định: " + caseCheck + " - " + sessionId);
                                #endif
                break;
            }
        }
Exemple #29
0
    void SetUpTableData(bool _isGetAll, SubServerDetail _serverDetail, MessageReceiving _messageReceiving, int _error, System.Action _onSuccess = null, System.Action <int> _onError = null)
    {
        if (_messageReceiving != null)
        {
            bool _checkCase = _messageReceiving.readBoolean();
            if (_checkCase)
            {
                long       _versionRoom = _messageReceiving.readLong();
                RoomDetail _roomDetail  = null;
                for (int i = 0; i < _serverDetail.listRoomDetail.Count; i++)
                {
                    if (_serverDetail.listRoomDetail[i].gameId == DataManager.instance.miniGameData.currentMiniGameDetail.myInfo.gameId)
                    {
                        _roomDetail = _serverDetail.listRoomDetail[i];
                        break;
                    }
                }
                if (_roomDetail == null)
                {
                                        #if TEST
                    Debug.LogError("_roomDetail is null: " + DataManager.instance.miniGameData.currentMiniGameDetail.myInfo.gameType.ToString());
                                        #endif
                }
                else
                {
                    _roomDetail.versionRoom = _versionRoom;
                }
                // if(_roomDetail.myOriginalDetail != null){
                //  _roomDetail.myOriginalDetail.versionServer = _versionServer;
                // }

                TableData _tableData       = new TableData();
                string    _gameNameRecieve = _messageReceiving.readString();
                short     _maxNumberTable  = _messageReceiving.readShort();
                _tableData.numberPlaying = _messageReceiving.readInt();                 //số người đang chơi
                _tableData.maxViewer     = _messageReceiving.readByte();
                _tableData.maxPlayer     = _messageReceiving.readByte();
                short _numberTableGet = _messageReceiving.readShort();
                // GAMEID_UNO|59|0|8|4|20
                // Debug.Log(_gameNameRecieve + "|" + _maxNumberTable + "|" + _tableData.numberPlaying + "|" + _tableData.maxViewer + "|" + _tableData.maxPlayer + "|" + _numberTableGet);
                List <TableDetail> _listTableDetail = new List <TableDetail>();
                for (int i = 0; i < _numberTableGet; i++)
                {
                    TableDetail _tableDetail = new TableDetail();
                    _tableDetail.tableId      = _messageReceiving.readShort();
                    _tableDetail.isLockByPass = _messageReceiving.readBoolean();
                    _tableDetail.status       = _messageReceiving.readByte();
                    _tableDetail.bet          = _messageReceiving.readLong();
                    _tableDetail.countViewer  = _messageReceiving.readByte();
                    _tableDetail.countPlaying = _messageReceiving.readByte();
                    _listTableDetail.Add(_tableDetail);
                }

                if (DataManager.instance.miniGameData.currentMiniGameDetail.myInfo.versionFeature < _versionRoom)
                {
                    _serverDetail.beingError = false;
                    if (currentState == State.Show)
                    {
                        if (_onError != null)
                        {
                            _onError(-98);                             // RoomOutOfDate
                        }
                    }
                }
                else
                {
                    if (_isGetAll)
                    {
                        List <TableDetail> _tableDetailCollection = new List <TableDetail>();
                        for (int i = 0; i < _listTableDetail.Count; i++)
                        {
                            if (_tableData.CanTableBeEnable(_listTableDetail[i]))
                            {
                                _tableDetailCollection.Add(_listTableDetail[i]);
                                if (_tableDetailCollection.Count >= numTableDefault)
                                {
                                    break;
                                }
                            }
                        }
                        _tableData.listTableDetail = _tableDetailCollection;
                    }
                    else
                    {
                        _tableData.listTableDetail = _listTableDetail;
                    }
                    DataManager.instance.miniGameData.currentMiniGameDetail.tableData = _tableData;
                    _serverDetail.beingError = false;
                    if (currentState == State.Show)
                    {
                        panelListTable.InitDataAgain();
                        if (_onSuccess != null)
                        {
                            _onSuccess();
                        }
                    }
                }
            }
            else
            {
                                #if TEST
                Debug.LogError("Lỗi sever trả về rỗng");
                                #endif
                _serverDetail.beingError = true;
                _serverDetail.countConnectionError++;
                if (currentState == State.Show)
                {
                    if (_onError != null)
                    {
                        _onError(-99);                         // RoomIsNotAvailable
                    }
                }
            }
        }
        else
        {
                        #if TEST
            Debug.LogError("Room is not available");
                        #endif
            _serverDetail.beingError = true;
            _serverDetail.countConnectionError++;
            if (currentState == State.Show)
            {
                if (_onError != null)
                {
                    _onError(_error);
                }
            }
        }
    }
Exemple #30
0
    void CallbackGetBetWin(MessageReceiving _mess, int _error)
    {
        if (_mess != null)
        {
            sbyte _caseCheck = _mess.readByte();
            short _indexWin  = _mess.readShort();
            long  _goldAdd   = 0;
            bool  _getReward = false;
            switch (_caseCheck)
            {
            case 0:             // lỗi server gold
                DataManager.instance.userData.gold = realMyGold;
                RefreshMyGoldInfo();

                PopupManager.Instance.CreatePopupMessage(MyLocalize.GetString(MyLocalize.kWarning)
                                                         , MyLocalize.GetString("Error/ConnectionError")
                                                         , _caseCheck.ToString()
                                                         , MyLocalize.GetString(MyLocalize.kOk));
                break;

            case -2:             // ko đủ tiền cược
                realMyGold = _mess.readLong();
                DataManager.instance.userData.gold = realMyGold;
                RefreshMyGoldInfo();

                PopupManager.Instance.CreatePopupMessage(MyLocalize.GetString(MyLocalize.kWarning)
                                                         , MyLocalize.GetString("Global/NotEnoughMoney")
                                                         , _caseCheck.ToString()
                                                         , MyLocalize.GetString(MyLocalize.kOk));
                break;

            case 1:             // xử lý thành công
                _getReward = true;
                _goldAdd   = _mess.readLong();
                realMyGold = _mess.readLong();
                DataManager.instance.userData.gold = realMyGold;
                                #if TEST
                Debug.Log(">>> BetToWin: " + _indexWin + "|" + _goldAdd + "|" + realMyGold);
                                #endif
                break;

            default:
                DataManager.instance.userData.gold = realMyGold;
                RefreshMyGoldInfo();
                                #if TEST
                Debug.LogError("BUG Logic (1): " + _caseCheck);
                                #endif
                break;
            }

            if (_getReward)
            {
                int        _idWinOriginal = GameInformation.instance.luckyWheelInfo.listDetail[_indexWin].id;
                List <int> _listIndex     = new List <int>();
                for (int i = 0; i < listMyBetWinInfo.Count; i++)
                {
                    if (listMyBetWinInfo[i].idBetToWinValueDetail == _idWinOriginal)
                    {
                        _listIndex.Add(i);
                    }
                }

                if (_listIndex.Count == 0)
                {
                                        #if TEST
                    Debug.LogError("BUG Logic (0)");
                                        #endif
                    RefreshMyGoldInfo();

                    float _TotalAngle;
                    GetRandomElement(ref mForceReward, out _TotalAngle);

                    StartCoroutine(DoPlay(mForceReward, _TotalAngle));
                    mForceReward = -1;
                }
                else
                {
                    // RewardDetail _rewardDetail = new RewardDetail(IItemInfo.ItemType.Gold, listBetWinValue[_indexWin]);

                    mForceReward = _listIndex[Random.Range(0, _listIndex.Count)];
                    float _TotalAngle;
                    GetRandomElement(ref mForceReward, out _TotalAngle);

                    StartCoroutine(DoPlay(mForceReward, _TotalAngle, listBetWinValue[_indexWin]));
                    mForceReward = -1;
                }
            }
            else
            {
                float _TotalAngle;
                GetRandomElement(ref mForceReward, out _TotalAngle);

                StartCoroutine(DoPlay(mForceReward, _TotalAngle));
                mForceReward = -1;
            }
        }
        else
        {
            DataManager.instance.userData.gold = realMyGold;
            RefreshMyGoldInfo();

            PopupManager.Instance.CreatePopupMessage(MyLocalize.GetString(MyLocalize.kError)
                                                     , MyLocalize.GetString("Error/ConnectionError")
                                                     , _error.ToString()
                                                     , MyLocalize.GetString(MyLocalize.kOk));

            float _TotalAngle;
            GetRandomElement(ref mForceReward, out _TotalAngle);

            StartCoroutine(DoPlay(mForceReward, _TotalAngle));
            mForceReward = -1;
        }
    }