예제 #1
0
        // Adds a client to the list of clients that are downloading
        public void AddClient(GameClient client)
        {
            if (_clientStatus.ContainsKey(client))
            {
                Debug.LogError("Cannot add a client to the station download list twice.");
                return;
            }

            client.SetStatus(GameClientStatus.Downloading);
            _clientStatus.Add(client, 0);
            _clientWaiting.Add(client, true); // Start out waiting for the client to repsond to the message sent after this
            _clientFails.Add(client, 0);

            NetOutgoingMessage mes = _netManager.CreateMessage();
            mes.WriteOpcode(NetOpcodes.StationSend);
            mes.Write(_stationData.Count);
            mes.Write(_totalLength);
            mes.Write(_checksum);
            _netManager.SendToClient(mes, client.NetConnection);

            Debug.LogSys("Sending station files to " + client.NetConnection.RemoteEndPoint.Address.ToString());
        }
예제 #2
0
        // Remove the client (this should only be done if they disconnect while downloading)
        public void RemoveClient(GameClient client)
        {
            if (!_clientStatus.ContainsKey(client))
                return;

            _clientStatus.Remove(client);
            _clientWaiting.Remove(client);
            _clientFails.Remove(client);

            Debug.LogWarning("Prematurely stopping download of station files to " + client.NetConnection.RemoteEndPoint.Address.ToString());
        }