コード例 #1
0
        public ClientWorldHost()
        {
            var services = new ServiceCollection();

            services.AddLogging(builder =>
            {
                builder.AddConsole();
                builder.SetMinimumLevel(LogLevel.Trace);
            });

            var commandType = typeof(GameCommand);
            IEnumerable <Type> eventTypes = new List <Type>
            {
                typeof(GameActionEvent),
            };
            IEnumerable <KeyValuePair <Type, Type> > entityTypes = new Dictionary <Type, Type>
            {
                [typeof(ClientControlledEntity)] = typeof(MyState),
                [typeof(ClientDummyEntity)]      = typeof(DummyEntityState),
                [typeof(ClientMimicEntity)]      = typeof(MyState),
            };
            var pools   = new ClientPools(commandType, eventTypes, entityTypes);
            var manager = new ClientWorld(new ClientProtocol(pools), pools);

            //var manager = new ClientWorld(new MessagePackClientPacketProtocol(), pools);
            services.AddSingleton(manager);

            ServiceProvider = services.BuildServiceProvider();

            InitializeCommon();
            Initialize();
        }
コード例 #2
0
 public ClientProtocol(ClientPools pools) : base(pools)
 {
 }