Add room visualizer debug page

This commit is contained in:
jvyden 2022-01-16 17:48:20 -05:00
commit dc46534141
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
2 changed files with 49 additions and 0 deletions

View file

@ -0,0 +1,28 @@
@page "/debug/roomVisualizer"
@using LBPUnion.ProjectLighthouse.Helpers
@using LBPUnion.ProjectLighthouse.Types
@using LBPUnion.ProjectLighthouse.Types.Match
@model LBPUnion.ProjectLighthouse.Pages.Debug.RoomVisualizerPage
@{
Layout = "Layouts/BaseLayout";
Model.Title = "Debug - Room Visualizer";
}
<meta http-equiv="refresh" content="1"> @* Refresh page every second *@
<p>The page will automatically refresh once a second.</p>
<p>@RoomHelper.Rooms.Count rooms</p>
@foreach (Room room in RoomHelper.Rooms)
{
<div class="ui blue inverted segment">
<h2>Room @room.RoomId</h2>
<p>@room.Players.Count players, State is @room.State</p>
<p>Slot type: @room.Slot.SlotType, slot id: @room.Slot.SlotId</p>
@foreach (User player in room.Players)
{
<div class="ui segment">@player.Username</div>
}
</div>
}

View file

@ -0,0 +1,21 @@
using System.Threading.Tasks;
using JetBrains.Annotations;
using LBPUnion.ProjectLighthouse.Pages.Layouts;
using Microsoft.AspNetCore.Mvc;
namespace LBPUnion.ProjectLighthouse.Pages.Debug;
public class RoomVisualizerPage : BaseLayout
{
public RoomVisualizerPage([NotNull] Database database) : base(database)
{}
public async Task<IActionResult> OnGet()
{
#if !DEBUG
return this.NotFound();
#else
return this.Page();
#endif
}
}