Add skybox system: admin management + client 3D application
- SkyboxDefinition entity (catalog schema) with static/animated support - EF migration: catalog.skybox_definitions table - content.get_skybox_config handler returns active skybox definition - SkyboxManagerPage.razor: full CRUD admin UI with inline editing, activate/deactivate, and animated frame config - NavMenu.razor: Skyboxes link under Content section - game_screen.gd: fetches active skybox on ready; applies as PanoramaSkyMaterial on WorldEnvironment; animated skyboxes cycle frames via Timer; procedural sky kept as fallback when none active Also fixes inverted camera pan (delta.x / -delta.y signs corrected). Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
namespace SOR.Content.Handlers;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SOR.Database.Contexts;
|
||||
using SOR.Networking.Abstractions.Messaging;
|
||||
using SOR.Networking.Abstractions.Transport;
|
||||
using SOR.Shared.Networking;
|
||||
|
||||
/// <summary>
|
||||
/// content.get_skybox_config — returns the currently active skybox definition, or null if none.
|
||||
/// The client applies it to the WorldEnvironment in the gameplay scene.
|
||||
/// </summary>
|
||||
internal sealed class ContentGetSkyboxConfigHandler : IMessageHandler
|
||||
{
|
||||
private readonly CatalogDbContext _catalogDb;
|
||||
|
||||
public ContentGetSkyboxConfigHandler(CatalogDbContext catalogDb)
|
||||
{
|
||||
_catalogDb = catalogDb;
|
||||
}
|
||||
|
||||
public string MessageType => "content.get_skybox_config";
|
||||
|
||||
public async Task<IServerMessage?> HandleAsync(
|
||||
IClientMessage message,
|
||||
AuthenticatedConnection connection,
|
||||
CancellationToken ct)
|
||||
{
|
||||
var skybox = await _catalogDb.SkyboxDefinitions
|
||||
.AsNoTracking()
|
||||
.Where(s => s.IsActive)
|
||||
.OrderByDescending(s => s.CreatedAt)
|
||||
.Select(s => new SkyboxDefinitionDto(s.Id, s.Name, s.IsAnimated, s.CdnPath, s.FrameCount, s.Fps))
|
||||
.FirstOrDefaultAsync(ct);
|
||||
|
||||
return ServerMessage.Reply("content.get_skybox_config.ack", message.Seq,
|
||||
new GetSkyboxConfigResponse(skybox));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user