コード例 #1
0
ファイル: Client.cs プロジェクト: corefan/SlimNet
        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);
        }
コード例 #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);
        }