Implement portrait generation and retrieval for people in the school system. Added new API endpoints for generating and fetching portraits, including support for avatar and full-body images. Updated the client-side to handle portrait states and display options. Enhanced the person card UI to include tabs for overview and portrait, with appropriate localization strings. Updated solution files to include new test projects. Adjusted server configuration for SwarmUI integration.
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
using System.Net.WebSockets;
|
||||
using HSchool.Server;
|
||||
using HSchool.Server.Api;
|
||||
using HSchool.Server.Game;
|
||||
using HSchool.Server.Net;
|
||||
using HSchool.Simulation;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
@@ -34,6 +36,9 @@ builder.Services.AddSingleton<ModContent>();
|
||||
builder.Services.AddSingleton<GameSocketHandler>();
|
||||
builder.Services.AddSingleton<GameLoopService>();
|
||||
builder.Services.AddHostedService(sp => sp.GetRequiredService<GameLoopService>());
|
||||
builder.Services.AddSwarmUi(builder.Configuration);
|
||||
builder.Services.AddSingleton(sp => SwarmUiSettings.Load(sp.GetRequiredService<IHostEnvironment>(), sp.GetRequiredService<ILoggerFactory>().CreateLogger("SwarmUiSettings")));
|
||||
builder.Services.AddSingleton<PortraitService>();
|
||||
|
||||
builder.Services.AddOpenTelemetry().WithMetrics(metrics => metrics.AddMeter(GameMetrics.MeterName));
|
||||
|
||||
@@ -55,10 +60,16 @@ app.MapSchoolEndpoints();
|
||||
app.MapTimetableEndpoints();
|
||||
app.MapModEndpoints();
|
||||
|
||||
app.MapGet("/api/status", (GameLoopService loop, ClientRegistry clients) =>
|
||||
app.MapGet("/api/status", (GameLoopService loop, ClientRegistry clients, IOptions<SwarmUiOptions> swarm) =>
|
||||
{
|
||||
var state = loop.SchoolsState;
|
||||
return new GameStatusResponse(loop.CurrentTick, loop.Options.TickRate, state.Schools.Count, state.MaxSchools, clients.Count);
|
||||
return new GameStatusResponse(
|
||||
loop.CurrentTick,
|
||||
loop.Options.TickRate,
|
||||
state.Schools.Count,
|
||||
state.MaxSchools,
|
||||
clients.Count,
|
||||
!string.IsNullOrWhiteSpace(swarm.Value.BaseUrl));
|
||||
})
|
||||
.WithName("GetGameStatus");
|
||||
|
||||
@@ -102,7 +113,13 @@ app.UseFileServer();
|
||||
app.Run();
|
||||
|
||||
/// <summary>Loop health for dashboards and integration tests.</summary>
|
||||
internal sealed record GameStatusResponse(uint Tick, int TickRate, int Schools, int MaxSchools, int Connections);
|
||||
internal sealed record GameStatusResponse(
|
||||
uint Tick,
|
||||
int TickRate,
|
||||
int Schools,
|
||||
int MaxSchools,
|
||||
int Connections,
|
||||
bool SwarmUiConfigured);
|
||||
|
||||
/// <summary>Exposed so <c>WebApplicationFactory</c>-style tests can reference the entry point.</summary>
|
||||
public partial class Program;
|
||||
|
||||
Reference in New Issue
Block a user