public void Logout(LogoutMessage message) { SendMessage(PacketType.Logout, LogoutMessage.Serialize(message), message.GetDestinataires()); }
public static string Serialize(LogoutMessage message) { return(JsonConvert.SerializeObject(message)); }
private void Data(NetIncomingMessage inc) { var packageType = (PacketType)inc.ReadByte(); switch (packageType) { case PacketType.Login: var messageLogin = LoginMessage.Deserialize(inc.ReadString()); messageLogin.SetSource(inc.SenderConnection); if (OnLogin != null) { OnLogin(this, messageLogin); } break; case PacketType.Logout: var messageLogout = LogoutMessage.Deserialize(inc.ReadString()); messageLogout.SetSource(inc.SenderConnection); if (OnLogout != null) { OnLogout(this, messageLogout); } break; case PacketType.Disconnect: var messageDisconnect = DisconnectMessage.Deserialize(inc.ReadString()); messageDisconnect.SetSource(inc.SenderConnection); if (OnDisconnect != null) { OnDisconnect(this, messageDisconnect); } break; case PacketType.GetCharacters: var messageGetCharacters = GetCharactersMessage.Deserialize(inc.ReadString()); messageGetCharacters.SetSource(inc.SenderConnection); if (OnGetCharacters != null) { OnGetCharacters(this, messageGetCharacters); } break; case PacketType.GetCharacter: var messageGetCharacter = GetCharacterMessage.Deserialize(inc.ReadString()); messageGetCharacter.SetSource(inc.SenderConnection); if (OnGetCharacter != null) { OnGetCharacter(this, messageGetCharacter); } break; case PacketType.CharacterCreation: var messageCharacterCreation = CreateCharacterMessage.Deserialize(inc.ReadString()); messageCharacterCreation.SetSource(inc.SenderConnection); if (OnCreateCharacter != null) { OnCreateCharacter(this, messageCharacterCreation); } break; case PacketType.CharacterDelete: var messageCharacterDelete = DeleteCharacterMessage.Deserialize(inc.ReadString()); messageCharacterDelete.SetSource(inc.SenderConnection); if (OnDeleteCharacter != null) { OnDeleteCharacter(this, messageCharacterDelete); } break; case PacketType.JoinHub: break; case PacketType.PlayerJoinHub: break; case PacketType.PlayerQuitHub: break; } }