Beispiel #1
0
 public virtual void FleetDied(Player killer, Player victim, Fleet fleet)
 {
     RemoteEventLog.SendEvent(new AuditEventDeath
     {
         Killer = killer?.ToAuditModelPlayer(),
         Victim = victim?.ToAuditModelPlayer()
     }, fleet.World);
 }
Beispiel #2
0
        public void Configure(
            IApplicationBuilder app,
            IHostingEnvironment env,
            IServiceProvider provider,
            GameConfiguration config,
            RegistryClient registryClient
            )
        {
            JsonConvert.DefaultSettings = () =>
            {
                return(new JsonSerializerSettings()
                {
                    Formatting = Formatting.Indented,
                    NullValueHandling = NullValueHandling.Ignore,
                    ReferenceLoopHandling = ReferenceLoopHandling.Serialize
                });
            };

            app.UseAuthentication();

            app.UseMvc();

            if (config.ForceHTTPS)
            {
                app.UseHttpsRedirection();
            }

            if (config.AllowCORS)
            {
                app.UseCors();
            }

            app.UseDefaultFiles();
            app.UseStaticFiles(new StaticFileOptions
            {
                ServeUnknownFileTypes = true,
                DefaultContentType    = "text/plain",
                OnPrepareResponse     = context =>
                {
                    if (context.File.Name == "index.html")
                    {
                        context.Context.Response.Headers.Add("Cache-Control", "no-cache, no-store");
                        context.Context.Response.Headers.Add("Expires", "-1");
                    }
                }
            });
            app.UseAcmeChallengeHandler();

            app.UseWebSockets(new WebSocketOptions
            {
                KeepAliveInterval = TimeSpan.FromMilliseconds(10000)
            });
            app.UseGameWebsocketHandler();

            RemoteEventLog.Initialize(config, registryClient);
            Worlds.Initialize(config);

            if (config.RegistryEnabled)
            {
                Console.WriteLine("Registry reporting is enabled");
                provider.GetService <RegistryHandling>();
            }
        }