/// <summary> /// Called once we have connected to the server, /// at this point we want to send a connect request packet /// to the server /// </summary> private void ListenerOnPeerConnectedEvent(NetPeer peer) { // Build the connection request var connectionRequest = new ConnectionRequestCommand { GameVersion = BuildConfig.applicationVersion, ModCount = PluginManager.instance.modCount, ModVersion = Assembly.GetAssembly(typeof(Client)).GetName().Version.ToString(), Password = _clientConfig.Password, Username = _clientConfig.Username }; Command.SendToServer(connectionRequest); }
/// <summary> /// Called once we have connected to the server, /// at this point we want to send a connect request packet /// to the server /// </summary> private void ListenerOnPeerConnectedEvent(NetPeer peer) { // Build the connection request var connectionRequest = new ConnectionRequestCommand { GameVersion = CSM.IsUnity ? BuildConfig.applicationVersion : "1.0.0", ModCount = CSM.IsUnity ? PluginManager.instance.modCount : 0, ModVersion = Assembly.GetAssembly(typeof(Client)).GetName().Version.ToString(), Password = _clientConfig.Password, Username = _clientConfig.Username }; // Send the message peer.Send(ArrayHelpers.PrependByte(CommandBase.ConnectionRequestCommandId, connectionRequest.Serialize()), SendOptions.ReliableOrdered); }
/// <summary> /// Called once we have connected to the server, /// at this point we want to send a connect request packet /// to the server /// </summary> private void ListenerOnPeerConnectedEvent(NetPeer peer) { // Get the major.minor version var version = Assembly.GetAssembly(typeof(Client)).GetName().Version; var versionString = $"{version.Major}.{version.Minor}"; // Build the connection request var connectionRequest = new ConnectionRequestCommand { GameVersion = BuildConfig.applicationVersion, ModCount = PluginManager.instance.modCount, ModVersion = versionString, Password = Config.Password, Username = Config.Username }; _logger.Info("Sending connection request to server..."); Command.SendToServer(connectionRequest); }