Ejemplo n.º 1
0
 private static void ClientsideConnect(UnityEngine.Networking.NetworkConnection connection)
 {
     try {
         ModListMessage msg = new ModListMessage(localModList, false);
         connection.SendByChannel(messageIndex, msg, QosChannelIndex.defaultReliable.intVal);
         MessageWaitClientAsync(connection, messageWaitTimeClient);
     } catch (Exception e) {
         Fail(e, "ClientsideConnect");
     }
 }
Ejemplo n.º 2
0
 private static void ClientSideConnect(NetworkConnection connection)
 {
     try {
         var msg = new ModListMessage(_localModList, new CSteamID(Client.Instance.SteamId));
         connection.SendByChannel(MessageIndex, msg, 4);
         MessageWaitClientAsync(connection, MessageWaitTimeClient);
     }
     catch (Exception e) {
         Fail(e, "ClientSideConnect");
     }
 }
Ejemplo n.º 3
0
 private static void ServerSideConnect(NetworkConnection connection)
 {
     try {
         var msg = new ModListMessage(_localModList, CSteamID.nil, true);
         connection.SendByChannel(MessageIndex, msg, 4);
         MessageWaitServerAsync(connection, MessageWaitTimeServer);
     }
     catch (Exception e) {
         Fail(e, "ServerSideConnect");
     }
 }
Ejemplo n.º 4
0
        private static void HandleModListMessage(NetworkMessage netMsg)
        {
            ModListMessage modInfo = netMsg.ReadMessage <ModListMessage>();

            if (modInfo == null)
            {
                R2API.Logger.LogError("Invalid message sent to message index: " + messageIndex);
                return;
            }
            if (modInfo.fromServer)
            {
                tempServerModList = modInfo.mods;
            }
            else
            {
                tempConnectionInfo[netMsg.conn] = modInfo.mods;
            }
        }
Ejemplo n.º 5
0
        private static void HandleModListMessage(NetworkMessage netMsg)
        {
            ModListMessage modListMessage = null;

            try {
                modListMessage = netMsg.ReadMessage <ModListMessage>();
            }
            catch (Exception e) {
                R2API.Logger.LogError("Could not deserialize the ModListMessage:");
                R2API.Logger.LogError(e.ToString());
            }

            if (modListMessage == null)
            {
                R2API.Logger.LogError("Invalid message sent to message index: " + MessageIndex);
                return;
            }

            if (modListMessage.FromServer)
            {
                _tempServerModList = modListMessage.Mods;
            }
            else
            {
                if (!modListMessage.SteamId.isValid)
                {
                    R2API.Logger.LogWarning("Server received message with invalid SteamID");
                }
                if (!ConnectedClientMods.ContainsKey(netMsg.conn))
                {
                    ConnectedClientMods.Add(netMsg.conn, modListMessage.Mods);
                    R2API.Logger.LogInfo("Adding this connection as a modded client: " + netMsg.conn);
                }
                else
                {
                    R2API.Logger.LogWarning("HandleModListMessage tried to add a NetworkConnection that was already added: " + netMsg.conn);
                }
            }
        }