예제 #1
0
        public void Initialize(IServiceCollection serviceCollection)
        {
            if (serviceCollection == null)
            {
                throw new ArgumentNullException(nameof(serviceCollection));
            }

            _gameBridge = GameBridge.CreateBridge(BridgeDataReceiver);

            serviceCollection.AddSingleton <IBridge>(_gameBridge);

            serviceCollection.AddSingleton(this);

            //Expose as both to get the implementation
            serviceCollection.AddSingleton <ClientNetworking>();
            serviceCollection.AddSingleton <IClientNetworking>(provider => provider.GetRequiredService <ClientNetworking>());
            serviceCollection.AddSingleton <ClientEntities>();
        }