public void build(byte[] data) { ByteBuffer buf = ByteBuffer.wrap(data); for (int i = 0; i < this.__flag.Length; i++) { this.__flag[i] = buf.get(); } if (this.hasPos()) { this.pos = buf.getInt(); } if (this.hasSeatStatus()) { this.seat_status = (SEAT_STATUS)buf.get(); } }
public void SetSeat(JY_SEAT prSeat) { if (prSeat.hasPlayerId()) { PlayerId = prSeat.playerId; //ID } if (prSeat.hasNickname()) { Nickname = prSeat.nickname; //昵称 } if (prSeat.hasAvatar()) { Avatar = prSeat.avatar; //头像 } if (prSeat.hasGender()) { Gender = prSeat.gender; //性别 } if (prSeat.hasIsBanker()) { IsBanker = prSeat.isBanker; //庄 } //if (prSeat.hasIsWiner()) Winner = prSeat.isWiner;//是否是胜利者 //if (prSeat.has()) IsOwner = prSeat.isOwner;//是否是房主 if (prSeat.hasPos()) { Pos = prSeat.pos; //位置(服务器) } if (prSeat.hasGold()) { Gold = prSeat.gold; //金币 } if (prSeat.hasPour()) { Pour = prSeat.pour; //下注分 } if (prSeat.hasStatus()) { seatStatus = prSeat.status; //座位状态 } if (prSeat.hasEarnings()) { Earnings = prSeat.earnings; //本次收益 } if (prSeat.hasLoopEarnings()) { loopEarnings = prSeat.loopEarnings; //本局收益 } //if (prSeat.hasLoopEarnings()) LoopEarnings = prSeat.loopEarnings;//-------------------------------------------本局收益 //if (prSeat.hasTotalEarnings()) TotalEarnings = prSeat.totalEarnings;//总收益(已有筹码) if (prSeat.hasIsDismiss()) { isDismiss = prSeat.isDismiss; //是否同意解散 } //if (prSeat.has()) isOnLine = prSeat.;//是否在线 if (prSeat.hasIsReady()) { isReady = prSeat.isReady; //是否同意解散 } if (prSeat.hasIsJoinGame()) { isJoinGame = prSeat.isJoinGame; //是否参加过游戏 } //具体手牌 List <JY_POKER> prPokerList = prSeat.getPokerListList(); if (prPokerList != null && prPokerList.Count > 0) { for (int j = 0; j < prPokerList.Count; j++) { if (PokerList.Count <= j) { break; } if (prPokerList[j] != null && prPokerList[j].hasIndex() && prPokerList[j].index != 0) { //手牌是否有这张牌 if (PokerList[j] != null) { PokerList[j].SetPoker(prPokerList[j]); } } } } //已经出过的牌 if (prSeat.hasHistoryPokerList()) { List <JY_POKER> prTablePokerList = prSeat.getHistoryPokerListList(); //int countGap = prTablePokerList.Count - TablePokerList.Count; //if (countGap > 0) //{ // for (int i = 0; i < countGap; i++) // { // TablePokerList.Add(new Poker()); // } //} //for (int j = 0; j < prTablePokerList.Count; j++) //{ // //打过的是否有这张牌 // if (TablePokerList[j] != null) TablePokerList[j].SetPoker(prTablePokerList[j]); //} if (prTablePokerList != null && prTablePokerList.Count > 0) { for (int j = 0; j < prTablePokerList.Count; j++) { if (prTablePokerList[j] != null) { if (TablePokerList.Count < (j + 1)) { AppDebug.Log(string.Format("添加已出过的牌:index{0} ,size{1},type{2}", prTablePokerList[j].index, prTablePokerList[j].size, prTablePokerList[j].type)); TablePokerList.Add(new Poker()); } //打过的是否有这张牌 if (TablePokerList[j] != null) { TablePokerList[j].SetPoker(prTablePokerList[j]); } } } } } }
public void SetSeat(PAIGOW_SEAT prSeat) { if (prSeat.hasPlayerId()) { PlayerId = prSeat.playerId; //ID } if (prSeat.hasNickname()) { Nickname = prSeat.nickname; //昵称 } if (prSeat.hasAvatar()) { Avatar = prSeat.avatar; //头像 } if (prSeat.hasGender()) { Gender = prSeat.gender; //性别 } if (prSeat.hasIsBanker()) { IsBanker = prSeat.isBanker; //庄 } if (prSeat.hasIsWiner()) { Winner = prSeat.isWiner; //是否是胜利者 } //if (prSeat.has()) IsOwner = prSeat.isOwner;//是否是房主 if (prSeat.hasPos()) { Pos = prSeat.pos; //位置(服务器) } if (prSeat.hasPour()) { Pour = prSeat.pour; //下注分 } if (prSeat.hasSeatStatus()) { seatStatus = prSeat.seat_status; //座位状态(是否准备) } if (prSeat.hasEarnings()) { Earnings = prSeat.earnings; //本次收益 } if (prSeat.hasLoopEarnings()) { LoopEarnings = prSeat.loopEarnings; //本局收益 } if (prSeat.hasTotalEarnings()) { TotalEarnings = prSeat.totalEarnings; //总收益(已有筹码) } if (prSeat.hasIsGrabBanker()) { isGrabBanker = prSeat.isGrabBanker; //是否抢庄 } if (prSeat.hasIsCutPoker()) { isCutPoker = (CutPoker)prSeat.isCutPoker; //是否切牌 } if (prSeat.hasGold()) { Gold = prSeat.gold; //金币 } if (prSeat.hasIsCutPan()) { isCutGuo = prSeat.isCutPan; //是否能切锅 } //具体手牌 List <PAIGOW_MAHJONG> prPokerList = prSeat.getPaigowMahjongList(); if (prPokerList != null && prPokerList.Count > 0) { for (int j = 0; j < prPokerList.Count; j++) { if (PokerList.Count <= j) { break; } if (prPokerList[j] != null && prPokerList[j].hasIndex() && prPokerList[j].index != 0) { //手牌是否有这张牌 if (PokerList[j] != null) { PokerList[j].SetPoker(prPokerList[j]); } } } } //如果有牌 //已经出过的牌 if (prSeat.hasHistoryPoker()) { List <PAIGOW_MAHJONG> prTablePokerList = prSeat.getHistoryPokerList(); //int countGap = prTablePokerList.Count - TablePokerList.Count; //if (countGap > 0) //{ // for (int i = 0; i < countGap; i++) // { // TablePokerList.Add(new Poker()); // } //} //for (int j = 0; j < prTablePokerList.Count; j++) //{ // //打过的是否有这张牌 // if (TablePokerList[j] != null) TablePokerList[j].SetPoker(prTablePokerList[j]); //} if (prTablePokerList != null && prTablePokerList.Count > 0) { for (int j = 0; j < prTablePokerList.Count; j++) { if (prTablePokerList[j] != null) { if (TablePokerList.Count < (j + 1)) { AppDebug.Log(string.Format("添加已出过的牌:index{0} ,size{1},type{2}", prTablePokerList[j].index, prTablePokerList[j].size, prTablePokerList[j].type)); TablePokerList.Add(new Poker()); } //打过的是否有这张牌 if (TablePokerList[j] != null) { TablePokerList[j].SetPoker(prTablePokerList[j]); } } } } } }
public void build(byte[] data) { ByteBuffer buf = ByteBuffer.wrap(data); for (int i = 0; i < this.__flag.Length; i++) { this.__flag[i] = buf.get(); } if (this.hasPlayerId()) { this.playerId = buf.getInt(); } if (this.hasNickname()) { byte[] bytes = new byte[buf.getShort()]; buf.get(ref bytes, 0, bytes.Length); this.nickname = System.Text.Encoding.UTF8.GetString(bytes); } if (this.hasAvatar()) { byte[] bytes = new byte[buf.getShort()]; buf.get(ref bytes, 0, bytes.Length); this.avatar = System.Text.Encoding.UTF8.GetString(bytes); } if (this.hasGold()) { this.gold = buf.getInt(); } if (this.hasLongitude()) { this.longitude = buf.getFloat(); } if (this.hasLatitude()) { this.latitude = buf.getFloat(); } if (this.hasIpaddr()) { byte[] bytes = new byte[buf.getShort()]; buf.get(ref bytes, 0, bytes.Length); this.ipaddr = System.Text.Encoding.UTF8.GetString(bytes); } if (this.hasFirstPokerInfo()) { int size = buf.getShort(); for (int i = 0; i < size; i++) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.firstPokerInfo.Add(FIRST_POKER_INFO.decode(bytes)); } } if (this.hasSecondPokerInfo()) { int size = buf.getShort(); for (int i = 0; i < size; i++) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.secondPokerInfo.Add(SECOND_POKER_INFO.decode(bytes)); } } if (this.hasThirdPokerInfo()) { int size = buf.getShort(); for (int i = 0; i < size; i++) { byte[] bytes = new byte[buf.getInt()]; buf.get(ref bytes, 0, bytes.Length); this.thirdPokerInfo.Add(THIRD_POKER_INFO.decode(bytes)); } } if (this.hasIsDismiss()) { if (buf.get() == 1) { this.isDismiss = true; } else { this.isDismiss = false; } } if (this.hasGender()) { this.gender = buf.get(); } if (this.hasPos()) { this.pos = buf.getInt(); } if (this.hasSeatStatus()) { this.seatStatus = (SEAT_STATUS)buf.get(); } }