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();