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; }
public Uno_PlayerPlayingData(MessageReceiving _mess, List <short> _listSessionIdGlobalPlayer) { short _sessionId = _mess.readShort(); indexChair = _mess.readByte(); sbyte _numberCardInHand = _mess.readByte(); sbyte _indexGlobal = (sbyte)_listSessionIdGlobalPlayer.IndexOf(_sessionId); userData = new UserDataInGame(_mess, _sessionId, _indexGlobal); if (_indexGlobal < 0) { #if TEST Debug.Log(userData.nameShowInGame + " đã rời bàn trước đó"); #endif } if (_sessionId == DataManager.instance.userData.sessionId) { isMe = true; } else { isMe = false; } // Debug.LogError(userData.nameShowInGame + " _numberCardInHand : " + _numberCardInHand); ownCards = new List <sbyte>(); for (int i = 0; i < _numberCardInHand; i++) { ownCards.Add(-1); } }
public Uno_Player_ChangeTurn_Data(MessageReceiving _mess, UnoGamePlayData _unoGamePlayData) { nextCircleIndex = _mess.readByte(); int _timeLeftToChangeCircle = _unoGamePlayData.timeDurringChangeCircle; nextTimeToChangeCircle = System.DateTime.Now.AddMilliseconds(_timeLeftToChangeCircle); }
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; }
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; } }
private void onReceive(byte[] data) { if (!isRunning) { return; } IActionProcessMessage[] listProcess = NetworkGlobal.instance.listProcess; MessageReceiving messageReceiving = new MessageReceiving(data); if (messageReceiving.getCMD() == -4) { monoBehaviour.StartCoroutine(release()); return; } int BUFFER_PROCESS = listProcess.Length; for (int i = 0; i < BUFFER_PROCESS; i++) { if (listProcess[i].cmd == messageReceiving.getCMD()) { listProcess[i].functionProcess(messageReceiving); if (messageReceiving.avaiable() > 0) { Debug.Log("**********Chua doc het CMD : " + messageReceiving.getCMDName()); } else { Debug.Log("**********Receive CMD : " + messageReceiving.getCMDName()); } return; } } Debug.Log("**********Chưa setup CMD : " + messageReceiving.getCMDName()); }
public PlayerAddGold_Data(MessageReceiving _mess) { sessionId = _mess.readShort(); reason = _mess.readInt(); goldAdd = _mess.readLong(); goldLast = _mess.readLong(); }
public DragonTiger_MeAddBet_Data(MessageReceiving _mess) { isAddOk = _mess.readBoolean(); myGOLD = 0; 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(); betDragon = _mess.readLong(); betTie = _mess.readLong(); betTiger = _mess.readLong(); myGOLD = _mess.readLong(); myTotalBet = _mess.readLong(); } }
public DragonTiger_UpdateTableBet_Data(MessageReceiving _mess) { indexBet = _mess.readByte(); tableCount = _mess.readShort(); tableBet = _mess.readLong(); // Debug.Log(">>> " + _indexBet + " - " + _tableCount + " - " + _tableBet); }
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 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; }
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 TemporaryServerDetail(MessageReceiving _messageReceiving) { roomId = _messageReceiving.readInt(); version = _messageReceiving.readLong(); gameId = _messageReceiving.readShort(); subServerId = _messageReceiving.readInt(); }
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 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 } }
public AnimalRacing_UpdateTableBet_Data(MessageReceiving _mess) { listGlobalBet = new List <long>(); for (int i = 0; i < 9; i++) { listGlobalBet.Add(_mess.readLong()); } }
/// <summary> /// Raises <see cref="MessageReceiving"/> event. /// </summary> protected virtual void OnMessageReceiving(ResponseMessage message) { if (MessageReceiving != null) { var e = new MessageEventArgs(message); MessageReceiving?.Invoke(this, e); } }
public virtual Task OnMessageReceivingAsync(MessageReceivingEventArgs e, CancellationToken cancellationToken = default(CancellationToken)) { return(Task.Run(async() => { await MessageReceiving?.Invoke(this, e); }, cancellationToken)); }
public RoomDetail(MessageReceiving _mess) { roomId = _mess.readInt(); roomName = _mess.readString(); versionRoom = _mess.readLong(); gameId = _mess.readShort(); numberTable = _mess.readShort(); }
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 Uno_OtherPlayer_AtkUno_Me_Data(MessageReceiving _mess) { indexPlayingAttackMe = _mess.readByte(); cardsDraw = new List <sbyte>(); for (int i = 0; i < 2; i++) { sbyte _card = _mess.readByte(); cardsDraw.Add(_card); } }
public void InitListOtherUserDataInGame(MessageReceiving _mess) { listOtherPlayerData = new List <UserDataInGame>(); UserDataInGame _usedata = null; sbyte _maxViewer = _mess.readByte(); for (int i = 0; i < (int)_maxViewer; i++) { sbyte _caseCheck = _mess.readByte(); //(nếu giá trị -1 thì không đọc data dưới --> tiếp tục vòng for) if (_caseCheck >= 0) { short _sessionId = _mess.readShort(); _usedata = new UserDataInGame(_mess, _sessionId, (sbyte)i); BOL_ShowPlayer_Manager.instance.InitUserInroom(_usedata); if (_usedata.sessionId != DataManager.instance.userData.sessionId) { listOtherPlayerData.Add(_usedata); } else { DataManager.instance.userData.CastToUserDataInGame().index = (sbyte)i; AchievementDetail _achievementDetail = DataManager.instance.achievementData.GetAchievementDetail(IMiniGameInfo.Type.BattleOfLegend); if (_achievementDetail != null) { _achievementDetail.countWin = _usedata.win; _achievementDetail.countDraw = _usedata.tie; _achievementDetail.countLose = _usedata.lose; // Debug.Log(_usedata.win + " - " + _usedata.tie + " - " + _usedata.lose); } else { Debug.LogError(">>> _achievementDetail is null"); } } } else { _usedata = new UserDataInGame(); listOtherPlayerData.Add(_usedata); } //Debug.LogError(_usedata.sessionId + " - " + DataManager.instance.userData.sessionId); } sbyte numberChairs = _mess.readByte(); for (int i = 0; i < numberChairs; i++) { sbyte checkCase = _mess.readByte(); if (checkCase >= 0) { short sessionIds = _mess.readShort(); } } }
public MeSitDownFail_Data(MessageReceiving _mess) { isSuccess = _mess.readBoolean(); if (!isSuccess) { chairId = _mess.readByte(); currentChairId = _mess.readByte(); totalBet = _mess.readLong(); myGold = _mess.readLong(); } }
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 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; }
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 Uno_Me_GetCard_Data(MessageReceiving _mess) { myCardsValue = new List <sbyte>(); numberCardGet = _mess.readByte(); for (int i = 0; i < numberCardGet; i++) { sbyte _cardValue = _mess.readByte(); myCardsValue.Add(_cardValue); } countCard = _mess.readByte(); // #if TEST // Debug.Log(">>> (MeGetCard) Mình còn " + _countCard + " lá bài, (" + _numberCardGet + ")"); // #endif }
public Uno_OtherPlayer_GetCard_Data(MessageReceiving _mess) { indexCircle = _mess.readByte(); numberCardGet = _mess.readByte(); cardsValue = new List <sbyte>(); for (int i = 0; i < numberCardGet; i++) { cardsValue.Add(-1); } countCard = _mess.readByte(); // #if TEST // Debug.Log(">>> (OtherPlayerGetCard) PlayerPlaying " + indexCircle +" còn " + _countCard + " lá bài, (" + _sumCardGet + ")"); // #endif }
public void InitListOtherUserDataInGame(MessageReceiving _mess) { listGlobalPlayerData = new List <UserDataInGame>(); listSessionIdGlobalPlayer = new List <short>(); UserDataInGame _userdata = null; sbyte _maxViewer = _mess.readByte(); for (int i = 0; i < (int)_maxViewer; i++) { sbyte _caseCheck = _mess.readByte(); //(nếu giá trị -1 thì không đọc data dưới --> tiếp tục vòng for) if (_caseCheck != -1) { short _sessionId = _mess.readShort(); _userdata = new UserDataInGame(_mess, _sessionId, (sbyte)i); if (CheckIfIsMe(_userdata.sessionId)) { int _countWin = _userdata.win; int _countTie = _userdata.tie; int _countLose = _userdata.lose; _userdata = DataManager.instance.userData.CastToUserDataInGame(); _userdata.index = (sbyte)i; _userdata.win = _countWin; _userdata.tie = _countTie; _userdata.lose = _countLose; AchievementDetail _achievementDetail = DataManager.instance.achievementData.GetAchievementDetail(IMiniGameInfo.Type.Uno); if (_achievementDetail != null) { _achievementDetail.countWin = _userdata.win; _achievementDetail.countDraw = _userdata.tie; _achievementDetail.countLose = _userdata.lose; // Debug.Log(_usedata.win + " - " + _usedata.tie + " - " + _usedata.lose); } else { Debug.LogError(">>> _achievementDetail is null"); } } listGlobalPlayerData.Add(_userdata); listSessionIdGlobalPlayer.Add(_sessionId); } else { _userdata = new UserDataInGame(); listGlobalPlayerData.Add(_userdata); listSessionIdGlobalPlayer.Add(-1); } // Debug.LogError(_usedata.sessionId + " - " + DataManager.instance.userData.sessionId); } }
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); }