//状态 private void OnSocketSubUserStatus(byte[] data, int dataSize) { if (dataSize < Marshal.SizeOf(typeof(CMD_GR_UserStatus))) { return; } CMD_GR_UserStatus pUserStatus = NetUtil.BytesToStruct <CMD_GR_UserStatus>(data); MyDebug.Log("=========" + pUserStatus.dwUserID + "==" + pUserStatus.UserStatus.wChairID + "==" + pUserStatus.UserStatus.wTableID); PlayerStateVO state = new PlayerStateVO { userId = (int)pUserStatus.dwUserID, chairState = pUserStatus.UserStatus.cbUserStatus }; MyDebug.Log("UserStatus.cbUserStatus:" + pUserStatus.UserStatus.cbUserStatus); if (pUserStatus.UserStatus.cbUserStatus == Define.US_NULL) { //删除用户 } else if (pUserStatus.UserStatus.cbUserStatus == Define.US_FREE) { //退出房间 SetClientResponse(APIS.OUT_ROOM_RESPONSE, NetUtil.ObjToJson(state)); } }
//==================================客户端发送请求==================================// //用户状态 private void SuerStatus(byte[] buffer, int size) { MyDebug.Log("Set User Statue!!!!!!"); CMD_GR_UserStatus userStatus = NetUtil.BytesToStruct <CMD_GR_UserStatus>(buffer); if (GlobalDataScript.Instance.isExitGame) { return; } if (userStatus.UserStatus.cbUserStatus == 1 && myStatue != userStatus.UserStatus.cbUserStatus) //站立 { PlayerGameRoomInfo info = new PlayerGameRoomInfo(); info.userID = (int)userStatus.dwUserID; SocketEventHandle.Instance.SetClientResponse(APIS.OUT_ROOM_RESPONSE, NetUtil.ObjToJson(info)); for (int i = 0; i < GlobalDataScript.Instance.playerInfos.Count; i++) { if (GlobalDataScript.Instance.playerInfos[i].userID == (int)userStatus.dwUserID) { GlobalDataScript.Instance.playerInfos.RemoveAt(i); } } return; } if (userStatus.dwUserID != GlobalDataScript.userData.dwUserID) { return; } tableId = userStatus.UserStatus.wTableID; chairId = userStatus.UserStatus.wChairID; CMD_GR_ChairUserInfoReq chairInfo = new CMD_GR_ChairUserInfoReq(); chairInfo.wChairID = (byte)chairId; chairInfo.wTableID = (byte)tableId; SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GR_USER, (int)MDM_GR_USER.SUB_GR_USER_CHAIR_INFO_REQ, NetUtil.StructToBytes(chairInfo), Marshal.SizeOf(chairInfo)); byte[] bytes = new byte[10]; SocketEngine.Instance.SendScoketData((int)GameServer.MDM_GF_FRAME, (int)SUB_GF_GAME_STATUS.SUB_GF_GAME_OPTION, bytes, 10); myStatue = userStatus.UserStatus.cbUserStatus; }