コード例 #1
0
 /// <summary>
 /// Creates a new instance of <see cref="ClientProperties"/> based on the values of an already existent instance.
 /// </summary>
 /// <param name="other">Other <see cref="ClientProperties"/> instace.</param>
 public ClientProperties(ClientProperties other)
 {
     this.MaxMessageSize                = other.MaxMessageSize;
     this.ImportantMessageTimeout       = other.ImportantMessageTimeout;
     this.ConnectionEstablishingTimeout = other.ConnectionEstablishingTimeout;
     this.MaxServerBlackoutTime         = other.MaxServerBlackoutTime;
     this.MaxImportantMessageRetries    = other.MaxImportantMessageRetries;
     this.EnableLog            = other.EnableLog;
     this.FieldSimulationLogic = other.FieldSimulationLogic;
 }
コード例 #2
0
ファイル: LiNGSClient.cs プロジェクト: valterc/lings
        /// <summary>
        /// Constructor of LiNGS Client. Creates a new instance of <see cref="LiNGSClient"/>.
        /// </summary>
        /// <exception cref="ArgumentNullException">When any of the params is null.</exception>
        /// <param name="properties">Properties of the client. These properties cannot be changed after the server is running.</param>
        /// <param name="serverInfo">Information used to connect to the server.</param>
        /// <param name="networkedClient">Game logic to receive callbacks and manage game objects.</param>
        public LiNGSClient(ClientProperties properties, ServerInfo serverInfo, INetworkedClient networkedClient)
        {
            if (properties == null)
            {
                throw new ArgumentNullException("The client properties cannot be null.");
            }

            if (serverInfo == null)
            {
                throw new ArgumentNullException("The server information cannot be null.");
            }

            if (networkedClient == null)
            {
                throw new ArgumentNullException("The networkedClient cannot be null.");
            }

            this.UpdateManager    = new UpdateManager();
            this.ClientProperties = new ClientProperties(properties);
            this.ServerInfo       = new ServerInfo(serverInfo);

            NetworkManager          = new NetworkManager(this, ServerInfo.IP, ServerInfo.Port);
            Router                  = new Router(this);
            MessageAggregator       = new MessageAggregator(this);
            Manager                 = new Manager(this);
            Analyzer                = new Analyzer(this);
            ClientLogicProcessor    = new ClientLogicProcessor(this);
            Simulator               = new Simulator(this);
            Synchronizer            = new Synchronizer(this);
            ClientStatus            = new ClientStatus(this);
            NetworkedClientInstance = networkedClient;

            this.UpdateManager.AddUpdatable(MessageAggregator);
            this.UpdateManager.AddUpdatable(Manager);
            this.UpdateManager.AddUpdatable(Analyzer);
            this.UpdateManager.AddUpdatable(ClientLogicProcessor);
            this.UpdateManager.AddUpdatable(Simulator);
            this.UpdateManager.AddUpdatable(Synchronizer);
        }