From 4b74b713a16b4baf7d1d077b6408c2403dfb7471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sig=20Narv=C3=A1ez?= Date: Wed, 20 Mar 2024 06:42:50 -0700 Subject: [PATCH 1/2] json black background --- website/Pages/PlayerSimilar_json.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/Pages/PlayerSimilar_json.razor b/website/Pages/PlayerSimilar_json.razor index 9b8c66b..1308e22 100644 --- a/website/Pages/PlayerSimilar_json.razor +++ b/website/Pages/PlayerSimilar_json.razor @@ -39,7 +39,7 @@ -
+
@if (recordingAsString == string.Empty) if (_errorMessage != string.Empty) { From 5fbcf2e2c353ae46d010c9c1ccbe43e5c9afc6fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sig=20Narv=C3=A1ez?= Date: Wed, 20 Mar 2024 07:44:56 -0700 Subject: [PATCH 2/2] Show top players by different similarities --- website/Pages/PlayerSimilar.razor | 287 ++++++++++++++++++++++-------- 1 file changed, 215 insertions(+), 72 deletions(-) diff --git a/website/Pages/PlayerSimilar.razor b/website/Pages/PlayerSimilar.razor index e1a0d02..2f93c51 100644 --- a/website/Pages/PlayerSimilar.razor +++ b/website/Pages/PlayerSimilar.razor @@ -38,14 +38,14 @@
- @if (Player == null) + @if (!ready) {

Loading...

- } - else - { + } + else + {

Player Dashboard

@@ -72,7 +72,7 @@

+ disabled>
@@ -87,13 +87,13 @@ - } + }
- @if (Player == null) + @if (!ready) {

Loading... @@ -101,60 +101,193 @@ } else { -

Similar Players

- foreach (SimilarRecording rec in Similar) - { - string chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); -
-
@rec.Name
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Score@rec.SessionStatisticsPlain.Score
DamageDone@rec.SessionStatisticsPlain.DamageDone
BulletsFired@rec.SessionStatisticsPlain.BulletsFired
PelletsDestroyedLarge@rec.SessionStatisticsPlain.PelletsDestroyedLarge
PelletsDestroyedMedium@rec.SessionStatisticsPlain.PelletsDestroyedMedium
PelletsDestroyedSmall@rec.SessionStatisticsPlain.PelletsDestroyedSmall
PowerUpBulletDamageCollected@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected
PowerUpBulletSpeedCollected@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected
PowerUpPlayerSpeedCollected@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected
- -
-
-     - View JSON data -     -
-
-
- } + rec = Similar.First(); // this player + chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); +

Your Best Run

+
+
@rec.Name
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Score@rec.SessionStatisticsPlain.Score
DamageDone@rec.SessionStatisticsPlain.DamageDone
BulletsFired@rec.SessionStatisticsPlain.BulletsFired
PelletsDestroyedLarge@rec.SessionStatisticsPlain.PelletsDestroyedLarge
PelletsDestroyedMedium@rec.SessionStatisticsPlain.PelletsDestroyedMedium
PelletsDestroyedSmall@rec.SessionStatisticsPlain.PelletsDestroyedSmall
PowerUpBulletDamageCollected@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected
PowerUpBulletSpeedCollected@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected
PowerUpPlayerSpeedCollected@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected
+ +
+
+     + View JSON data +     +
+
+
+ + rec = Similar[1]; + chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); +

Top Similar Player OVERALL

+
+
@rec.Name
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Score@rec.SessionStatisticsPlain.Score
DamageDone@rec.SessionStatisticsPlain.DamageDone
BulletsFired@rec.SessionStatisticsPlain.BulletsFired
PelletsDestroyedLarge@rec.SessionStatisticsPlain.PelletsDestroyedLarge
PelletsDestroyedMedium@rec.SessionStatisticsPlain.PelletsDestroyedMedium
PelletsDestroyedSmall@rec.SessionStatisticsPlain.PelletsDestroyedSmall
PowerUpBulletDamageCollected@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected
PowerUpBulletSpeedCollected@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected
PowerUpPlayerSpeedCollected@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected
+ +
+
+     + View JSON data +     +
+
+
+ + rec = SimilarBySpeed[1]; // 0 is this player + chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); +

Top Similar Player BY SPEED

+
+
@rec.Name
+ +
+
+     + View JSON data +     +
+
+
+ + rec = SimilarByAccel[1]; // 0 is this player + chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); +

Top Similar Player BY ACCELERATION

+
+
@rec.Name
+ +
+
+     + View JSON data +     +
+
+
+ + rec = SimilarByStats[1]; + chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); +

Top Similar Player BY STATS

+
+
@rec.Name
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Score@rec.SessionStatisticsPlain.Score
DamageDone@rec.SessionStatisticsPlain.DamageDone
BulletsFired@rec.SessionStatisticsPlain.BulletsFired
PelletsDestroyedLarge@rec.SessionStatisticsPlain.PelletsDestroyedLarge
PelletsDestroyedMedium@rec.SessionStatisticsPlain.PelletsDestroyedMedium
PelletsDestroyedSmall@rec.SessionStatisticsPlain.PelletsDestroyedSmall
PowerUpBulletDamageCollected@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected
PowerUpBulletSpeedCollected@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected
PowerUpPlayerSpeedCollected@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected
+
+
+     + View JSON data +     +
+
+
} }
@@ -164,10 +297,15 @@ private string _eventId = string.Empty; - private Player Player { get; set; } = new(); - private List Similar { get; set; } = new(); - private List SimilarBySpeed { get; set; } = new(); - private List SimilarByAccel { get; set; } = new(); + private Player? Player { get; set; } = new(); + private List? Similar { get; set; } = new(); + private List? SimilarByStats { get; set; } = new(); + private List? SimilarBySpeed { get; set; } = new(); + private List? SimilarByAccel { get; set; } = new(); + + private SimilarRecording? rec; + private string chartUrl = string.Empty; + private bool ready = false; private string _name = string.Empty; private string _atlasChartIdSimilar = string.Empty; @@ -186,7 +324,7 @@ _name = queryParameters[Constants.QueryParameterName]; _eventId = queryParameters[Constants.QueryParameterEventId]; var playerFilter = new Dictionary - { + { { "name", _name } }; @@ -194,15 +332,20 @@ var players = await _restClient.GetJsonAsync>(playersUrlWithQuery); Player = players.First(); - //string similarBySpeedUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilarBySpeed, playerFilter); - //SimilarBySpeed = await _restClient.GetJsonAsync>(similarBySpeedUrlWithQuery); - + // overall similarity string similarUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilar, playerFilter); Similar = await _restClient.GetJsonAsync>(similarUrlWithQuery); + // by speed + string similarBySpeedUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilarBySpeed, playerFilter); + SimilarBySpeed = await _restClient.GetJsonAsync>(similarBySpeedUrlWithQuery); + // by stats + string similarByStatsUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilarByStats, playerFilter); + SimilarByStats = await _restClient.GetJsonAsync>(similarByStatsUrlWithQuery); + // by acceleration + string similarByAccelUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilarByAccel, playerFilter); + SimilarByAccel = await _restClient.GetJsonAsync>(similarByAccelUrlWithQuery); - //TO-DO: Revisit acceleration - //string similarByAccelUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointSimilarByAccel, playerFilter); - //SimilarByAccel = await _restClient.GetJsonAsync>(similarByAccelUrlWithQuery); + ready = Player != null && Similar != null && SimilarByStats != null && SimilarBySpeed != null && SimilarByAccel != null; DotEnv.Load(); var envVars = DotEnv.Read();