Example #1
0
        protected Client(ClientConfiguration configuration)
        {
            // Verify and set configuraiton
            Assert.NotNull(configuration, "configuration");

            Configuration = configuration;

            // Set log level
            Log.SetLevel(configuration.LogLevel);

            // Create context and plugin
            ContextPlugin = CreateContextPlugin(typeof(ClientContextPluginAttribute));
            Context = new Context(this);

            // Network
            NetworkPeer = networkClient = new Network.LidgrenClient(this);

            // Event handlers
            Context.PlayerEventHandler.RegisterReceiver<Events.Hello>(onHello);
            Context.PlayerEventHandler.RegisterReceiver<Events.Spawn>(onSpawn);
            Context.PlayerEventHandler.RegisterReceiver<Events.Despawn>(onDespawn);
            Context.ActorEventHandler.RegisterReceiver<Events.ChangeOwner>(onChangeOwner);
        }
Example #2
0
        protected Client(ClientConfiguration configuration)
        {
            // Verify and set configuraiton
            Assert.NotNull(configuration, "configuration");

            Configuration = configuration;

            // Set log level
            Log.SetLevel(configuration.LogLevel);

            // Create context and plugin
            ContextPlugin = CreateContextPlugin(typeof(ClientContextPluginAttribute));
            Context       = new Context(this);

            // Network
            NetworkPeer = networkClient = new Network.LidgrenClient(this);

            // Event handlers
            Context.PlayerEventHandler.RegisterReceiver <Events.Hello>(onHello);
            Context.PlayerEventHandler.RegisterReceiver <Events.Spawn>(onSpawn);
            Context.PlayerEventHandler.RegisterReceiver <Events.Despawn>(onDespawn);
            Context.ActorEventHandler.RegisterReceiver <Events.ChangeOwner>(onChangeOwner);
        }