-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #119 from mongodb-developer/feature/add-qr-code
Show json data per similar recording
- Loading branch information
Showing
4 changed files
with
170 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,54 +102,61 @@ | |
else | ||
{ | ||
<h4 class="card-title mt-3 text-center">Similar Players</h4> | ||
foreach (SimilarRecording rec in Similar) | ||
{ | ||
string chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); | ||
<center> | ||
<h5>@rec.Name</h5> | ||
<table style="width:60%;"> | ||
<tr> | ||
<td>Score</td> | ||
<td>@rec.SessionStatisticsPlain.Score</td> | ||
</tr> | ||
<tr> | ||
<td>DamageDone</td> | ||
<td>@rec.SessionStatisticsPlain.DamageDone</td> | ||
</tr> | ||
<tr> | ||
<td>BulletsFired</td> | ||
<td>@rec.SessionStatisticsPlain.BulletsFired</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedLarge</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedLarge</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedMedium</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedMedium</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedSmall</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedSmall</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpBulletDamageCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpBulletSpeedCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpPlayerSpeedCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected</td> | ||
</tr> | ||
</table> | ||
<iframe style="background: #FFFFFF;border: none;border-radius: 2px;box-shadow: 0 2px 10px 0 rgba(70, 76, 79, .2);" width="440" height="480" src=@chartUrl></iframe> | ||
</center> | ||
} | ||
} | ||
foreach (SimilarRecording rec in Similar) | ||
{ | ||
string chartUrl = ChartsUrl.CreateSimilarUrl(_atlasChartIdSimilar, rec.Id); | ||
<center> | ||
<h5>@rec.Name</h5> | ||
<table style="width:60%;"> | ||
<tr> | ||
<td>Score</td> | ||
<td>@rec.SessionStatisticsPlain.Score</td> | ||
</tr> | ||
<tr> | ||
<td>DamageDone</td> | ||
<td>@rec.SessionStatisticsPlain.DamageDone</td> | ||
</tr> | ||
<tr> | ||
<td>BulletsFired</td> | ||
<td>@rec.SessionStatisticsPlain.BulletsFired</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedLarge</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedLarge</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedMedium</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedMedium</td> | ||
</tr> | ||
<tr> | ||
<td>PelletsDestroyedSmall</td> | ||
<td>@rec.SessionStatisticsPlain.PelletsDestroyedSmall</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpBulletDamageCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpBulletDamageCollected</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpBulletSpeedCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpBulletSpeedCollected</td> | ||
</tr> | ||
<tr> | ||
<td>PowerUpPlayerSpeedCollected</td> | ||
<td>@rec.SessionStatisticsPlain.PowerUpPlayerSpeedCollected</td> | ||
</tr> | ||
</table> | ||
<iframe style="background: #FFFFFF;border: none;border-radius: 2px;box-shadow: 0 2px 10px 0 rgba(70, 76, 79, .2);" width="440" height="480" src=@chartUrl></iframe> | ||
<div class="card" style="max-width: 400px; background:#00ed64; text-align: center"> | ||
<div style="display:inline"> | ||
| ||
<a target="_blank" href="/playerSimilar_json/?EventId=@_eventId&[email protected]">View JSON data</a> | ||
| ||
</div> | ||
</div> | ||
</center> | ||
} | ||
} | ||
} | ||
</div> | ||
|
||
|
||
|
@@ -187,10 +194,10 @@ | |
var players = await _restClient.GetJsonAsync<List<Player>>(playersUrlWithQuery); | ||
Player = players.First(); | ||
|
||
//string similarBySpeedUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointSimilarBySpeed, playerFilter); | ||
//string similarBySpeedUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilarBySpeed, playerFilter); | ||
//SimilarBySpeed = await _restClient.GetJsonAsync<List<SimilarRecording>>(similarBySpeedUrlWithQuery); | ||
string similarUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointSimilar, playerFilter); | ||
string similarUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordingsSimilar, playerFilter); | ||
Similar = await _restClient.GetJsonAsync<List<SimilarRecording>>(similarUrlWithQuery); | ||
|
||
//TO-DO: Revisit acceleration | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
@page "/playerSimilar_json" | ||
@using RestSharp | ||
@using website.Utils | ||
@using dotenv.net | ||
|
||
@inject NavigationManager NavigationManager | ||
@inject Blazored.LocalStorage.ILocalStorageService localStore | ||
@inject IJSRuntime JSRuntime | ||
|
||
<style> | ||
/* this in inside the body tag */ | ||
body { | ||
background-color: #023430; | ||
} | ||
.atlascharts_iframe { | ||
/*background: #21313C; */ | ||
border: none; | ||
border-radius: 2px; | ||
/* box-shadow: 0 2px 10px 0 rgba(70, 76, 79, .2); */ | ||
width: 100%; | ||
height: 200vh; | ||
margin: auto; | ||
} | ||
</style> | ||
|
||
<a href="\?EventId=@_eventId"> | ||
|
||
<img src="\mongodb-logo-green-bg.jpg" class="rounded mx-auto d-block" alt="logo"> | ||
</a> | ||
|
||
<div class="card" style="max-width:400px;background:yellow;text-align:center"> | ||
<div style="display:inline"> | ||
<a href="https://www.mongodb.com/solutions/solutions-library/gaming-player-profiles-solution" target="_blank">Solution</a> | ||
| | ||
<a href="https://www.mongodb.com/use-cases/gaming" target="_blank">MDB for Gaming</a> | ||
| | ||
<a href="https://github.com/mongodb-developer/leafsteroids" target="_blank">GitHub</a> | ||
</div> | ||
</div> | ||
|
||
<div class="bg-white"> | ||
@if (recordingAsString == string.Empty) | ||
if (_errorMessage != string.Empty) | ||
{ | ||
<p>@_errorMessage</p> | ||
} | ||
else | ||
{ | ||
<p><em>Loading... [@_recordingId]</em></p> | ||
} | ||
else | ||
{ | ||
@recordingAsString | ||
} | ||
</div> | ||
|
||
|
||
@code { | ||
|
||
private string _eventId = string.Empty; | ||
private string _recordingId = string.Empty; | ||
|
||
private string recordingAsString = string.Empty; | ||
private string _errorMessage = string.Empty; | ||
private readonly RestClient _restClient = RestServiceClient.Create(); | ||
|
||
private string chartFilter = string.Empty; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
try | ||
{ | ||
var queryParameters = UrlHelper.GetParameters(NavigationManager.Uri); | ||
|
||
_eventId = queryParameters[Constants.QueryParameterEventId]; | ||
_recordingId = queryParameters[Constants.QueryParameterRecordingId].ToString(); | ||
|
||
var recordingFilter = new Dictionary<string, string> | ||
{ | ||
{ "id", _recordingId } | ||
}; | ||
|
||
string recordingUrlWithQuery = UrlHelper.BuildUrlWithQuery(Constants.RestServiceEndpointRecordings, recordingFilter); | ||
recordingAsString = await _restClient.GetJsonAsync<string>(recordingUrlWithQuery); | ||
|
||
DotEnv.Load(); | ||
var envVars = DotEnv.Read(); | ||
} | ||
catch (Exception e) | ||
{ | ||
Console.WriteLine(e.Message); | ||
Console.WriteLine(e.StackTrace); | ||
_errorMessage = "EXCEPTION: " + e.Message + e.StackTrace; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters