示例#1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // TODO: Restore if visualisation will be added
            // services.AddSingleton<TcpSocketManager<BackendMessage>>();
            services.AddSingleton <ISocketClient <Message, Message>, TcpSocketClient <Message, Message> >();
            services.AddSingleton <BufferBlock <Message> >();
            services.AddSingleton <WebSocketManager <ClientMessage> >();

            GameConfiguration conf = GameConfiguration.GetConfiguration(Configuration);

            services.AddSingleton(conf);

            services.AddSpaStaticFiles(configuration =>
            {
                configuration.RootPath = "ClientApp/build";
            });

            services.TryAddSingleton <ILogger>(GetLogger(conf.Verbose ??
                                                         Configuration.GetValue <bool>("DefaultGameConfig:Verbose")));

            services.AddSingleton <GM>();
            services.AddHostedService <SocketService>();
            services.AddHostedService <GMService>();
        }
示例#2
0
    private void ConfigureGame()
    {
        var difficultyConfig = gameConfiguration.GetConfiguration(difficulty);

        gameCamera.orthographicSize   = difficultyConfig.cameraSize;
        gameCamera.transform.position = new Vector3(difficultyConfig.cameraX, difficultyConfig.cameraY, -10);
    }