private void OnUserInfo(cmdGAME_ANSWER_USER_INFO d) { if(d.GetAck() == 1){ WebLog.Log(d); model.GAUI_userinfo = d; proxy.LobbyCharInfo(d.avatar_no); } else { /// todo fix error } }
public static void DeserializeGAME_ANSWER_USER_INFO (byte[] bytes) { cmdGAME_ANSWER_USER_INFO pk = new cmdGAME_ANSWER_USER_INFO (); pk.Make (bytes [0], bytes [1]); if (pk.GetAck () == 0) { } else if (pk.GetAck () == 1) { //初始化偏移 int ReadOffset = 2; pk.ukey = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); byte[] chinese=new byte [(Constant.MAX_NICKNAME_LEN + 1)]; Array.Copy (bytes, ReadOffset, chinese, 0, (Constant.MAX_NICKNAME_LEN + 1)); string str=System.Text.Encoding.Unicode.GetString(chinese); pk.nickname=str.ToCharArray(); ReadOffset += (Constant.MAX_NICKNAME_LEN + 1) * sizeof(char); pk.level = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.avatar_no = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.exp = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); pk.money = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); pk.tutorial = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); pk.tutorial_try = bytes [ReadOffset]; ReadOffset += sizeof(byte); for (int i=0; i<Constant.MAX_MISSION_CHAPTER; i++) { pk.mission [i] = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); } pk.emblem.emblemNo = System.BitConverter.ToUInt16 (bytes, ReadOffset); ReadOffset += sizeof(short); for (int i=0; i<Command.Constant.MAX_EMBLEMS; i++) { pk.emblem.cnt [i] = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); } byte[] clubname = new byte [(Constant.MAX_CLUB_NAME_LEN + 1)]; Array.Copy (bytes, ReadOffset, clubname, 0, (Constant.MAX_CLUB_NAME_LEN + 1)); string strClubName =System.Text.Encoding.Unicode.GetString(clubname); pk.clubname = strClubName.ToCharArray(); ReadOffset += (Constant.MAX_CLUB_NAME_LEN + 1) * sizeof(char); pk.clubId = System.BitConverter.ToUInt32 (bytes, ReadOffset); ReadOffset += sizeof(uint); pk.clubEmblemNo = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.clubSubEmblemNo = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.guide_number = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.achievement_point = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); pk.achievement_total = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); pk.bySex = bytes [ReadOffset]; ReadOffset += sizeof(byte); pk.byItemModeClick = bytes [ReadOffset]; ReadOffset += sizeof(byte); byte[] Privilege = new byte[4 * sizeof(char)]; Array.Copy (bytes, ReadOffset, Privilege, 0, 4); pk.Privilege = System.Text.Encoding.Default.GetString (Privilege); ReadOffset += 4; for (int i=0; i<3; i++) { pk.PrivilegePercent [i] = System.BitConverter.ToInt32 (bytes, ReadOffset); ReadOffset += sizeof(int); } } OnRecDta<cmdGAME_ANSWER_USER_INFO> dlg = Singletons.GET<LobbyService> ().OnLobbyUserInfo; if (dlg != null) { dlg (pk); } }