public static byte[] GetBytes(BossStateMessage p) { byte[] newBytes = new byte[8]; BitConverter.GetBytes((int)p.moveState).CopyTo(newBytes, 0); BitConverter.GetBytes((int)p.atkState).CopyTo(newBytes, 4); return(newBytes); }
/// <summary> /// Boss的状态信息 /// </summary> /// <param name="state"></param> /// <param name="id"></param> /// <param name="listNum"></param> public void SendBossStateMsg(BossState state, BossAtkState s, int id) { byte[] by = BossStateMessage.GetBytes( new BossStateMessage(state, s)); NetworkMessage message = new NetworkMessage(71, NetworkTools.GetLocalIP(), by); byte[] bytes = NetworkMessage.GetBytes(message); SendMsg(RoomSingle.roomIP, NetworkConstent.UDPServerPort, bytes); }