From dc46534141e9111302211863cc5472670059cdc2 Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 16 Jan 2022 17:48:20 -0500 Subject: [PATCH] Add room visualizer debug page --- .../Pages/Debug/RoomVisualizerPage.cshtml | 28 +++++++++++++++++++ .../Pages/Debug/RoomVisualizerPage.cshtml.cs | 21 ++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml create mode 100644 ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml.cs diff --git a/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml b/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml new file mode 100644 index 00000000..919417da --- /dev/null +++ b/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml @@ -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"; +} + + @* Refresh page every second *@ + +

The page will automatically refresh once a second.

+

@RoomHelper.Rooms.Count rooms

+ +@foreach (Room room in RoomHelper.Rooms) +{ +
+

Room @room.RoomId

+

@room.Players.Count players, State is @room.State

+

Slot type: @room.Slot.SlotType, slot id: @room.Slot.SlotId

+ @foreach (User player in room.Players) + { +
@player.Username
+ } +
+} \ No newline at end of file diff --git a/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml.cs b/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml.cs new file mode 100644 index 00000000..3966e460 --- /dev/null +++ b/ProjectLighthouse/Pages/Debug/RoomVisualizerPage.cshtml.cs @@ -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 OnGet() + { + #if !DEBUG + return this.NotFound(); + #else + return this.Page(); + #endif + } +} \ No newline at end of file