Compare commits

...
4 Commits
18 changed files with 317 additions and 28 deletions

No files matched your search

+23 -23
View File
@@ -3,28 +3,28 @@
"documents": "**/*.graphql",
"extensions": {
"strawberryShake": {
"name": "WotBlitzStatisticsProClient",
"namespace": "WotBlitzStatisticsPro.Blazor.GraphQl",
"url": "https://localhost:5001/graphql/",
"dependencyInjection": true,
"strictSchemaValidation": true,
"hashAlgorithm": "md5",
"useSingleFile": false,
"requestStrategy": "Default",
"outputDirectoryName": "Generated",
"noStore": false,
"emitGeneratedCode": true,
"razorComponents": false,
"records": {
"inputs": false,
"entities": false
},
"transportProfiles": [
{
"default": "Http",
"subscription": "WebSocket"
}
]
"name": "WotBlitzStatisticsProClient",
"namespace": "WotBlitzStatisticsPro.Blazor.GraphQl",
"url": "https://localhost:6001/graphql/",
"dependencyInjection": true,
"strictSchemaValidation": true,
"hashAlgorithm": "md5",
"useSingleFile": false,
"requestStrategy": "Default",
"outputDirectoryName": "Generated",
"noStore": false,
"emitGeneratedCode": true,
"razorComponents": false,
"records": {
"inputs": false,
"entities": false
},
"transportProfiles": [
{
"default": "Http",
"subscription": "WebSocket"
}
]
}
}
}
}
@@ -23,6 +23,7 @@ namespace Microsoft.Extensions.DependencyInjection
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingOpenIdAuthenticationMutation>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WargamingPlayersMutation>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.UpdatePlayerMutation>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.DictionaryQuery>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWotBlitzStatisticsProClient>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<ClientServiceProvider>(sp)));
return new global::StrawberryShake.ClientBuilder<global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientStoreAccessor>("WotBlitzStatisticsProClient", services, serviceCollection);
@@ -113,6 +114,13 @@ namespace Microsoft.Extensions.DependencyInjection
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationExecutor<global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult>>(services, sp => new global::StrawberryShake.OperationExecutor<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.Http.IHttpConnection>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerResult>>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(sp), strategy));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.UpdatePlayerMutation>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.UpdatePlayerMutation>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.DictionaryResultFactory>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultDataFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultDataFactory<global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationRequestFactory>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.DictionaryBuilder>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IOperationExecutor<global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>>(services, sp => new global::StrawberryShake.OperationExecutor<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>(global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.Transport.Http.IHttpConnection>(sp), () => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationResultBuilder<global::System.Text.Json.JsonDocument, global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryResult>>(sp), global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::StrawberryShake.IOperationStore>(sp), strategy));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.DictionaryQuery>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.DictionaryQuery>(sp));
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::StrawberryShake.IEntityIdSerializer, global::WotBlitzStatisticsPro.Blazor.GraphQl.State.WotBlitzStatisticsProClientEntityIdFactory>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(services);
global::Microsoft.Extensions.DependencyInjection.ServiceCollectionServiceExtensions.AddSingleton<global::WotBlitzStatisticsPro.Blazor.GraphQl.IWotBlitzStatisticsProClient>(services, sp => global::Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService<global::WotBlitzStatisticsPro.Blazor.GraphQl.WotBlitzStatisticsProClient>(sp));
@@ -24,5 +24,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation WargamingPlayers { get; }
global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation UpdatePlayer { get; }
global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery Dictionary { get; }
}
}
@@ -17,7 +17,8 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation _wargamingOpenIdAuthentication;
private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation _wargamingPlayers;
private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation _updatePlayer;
public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery findClans, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery findPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery wargamingAuthenticationQuery, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation wargamingOpenId, global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery player, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation wargamingOpenIdAuthentication, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation wargamingPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation updatePlayer)
private readonly global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery _dictionary;
public WotBlitzStatisticsProClient(global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindClansQuery findClans, global::WotBlitzStatisticsPro.Blazor.GraphQl.IFindPlayersQuery findPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingAuthenticationQueryQuery wargamingAuthenticationQuery, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdMutation wargamingOpenId, global::WotBlitzStatisticsPro.Blazor.GraphQl.IPlayerQuery player, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation wargamingOpenIdAuthentication, global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation wargamingPlayers, global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation updatePlayer, global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery dictionary)
{
_findClans = findClans ?? throw new global::System.ArgumentNullException(nameof(findClans));
_findPlayers = findPlayers ?? throw new global::System.ArgumentNullException(nameof(findPlayers));
@@ -27,6 +28,7 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
_wargamingOpenIdAuthentication = wargamingOpenIdAuthentication ?? throw new global::System.ArgumentNullException(nameof(wargamingOpenIdAuthentication));
_wargamingPlayers = wargamingPlayers ?? throw new global::System.ArgumentNullException(nameof(wargamingPlayers));
_updatePlayer = updatePlayer ?? throw new global::System.ArgumentNullException(nameof(updatePlayer));
_dictionary = dictionary ?? throw new global::System.ArgumentNullException(nameof(dictionary));
}
public static global::System.String ClientName => "WotBlitzStatisticsProClient";
@@ -38,5 +40,6 @@ namespace WotBlitzStatisticsPro.Blazor.GraphQl
public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingOpenIdAuthenticationMutation WargamingOpenIdAuthentication => _wargamingOpenIdAuthentication;
public global::WotBlitzStatisticsPro.Blazor.GraphQl.IWargamingPlayersMutation WargamingPlayers => _wargamingPlayers;
public global::WotBlitzStatisticsPro.Blazor.GraphQl.IUpdatePlayerMutation UpdatePlayer => _updatePlayer;
public global::WotBlitzStatisticsPro.Blazor.GraphQl.IDictionaryQuery Dictionary => _dictionary;
}
}
@@ -0,0 +1,8 @@
namespace WotBlitzStatisticsPro.Blazor.Model
{
public class ElementDimensions
{
public int Width { get; set; }
public int Height { get; set; }
}
}
@@ -30,7 +30,7 @@
<!--Tank type-->
<image x="7" y="7" width="25" height="25" href="@TanksList.ToArray()[i].TankTypeId.TankTypeAsset(i == 2)"/>
<!--Tank tier-->
<text x="33" y="7" fill="@(i == 2 ? @Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="19">
<text x="33" y="4" fill="@(i == 2 ? @Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="19">
@TanksList.ToArray()[i].Tier.RomanNumber()
</text>
<!--TankImage-->
@@ -40,9 +40,51 @@
@TanksList.ToArray()[i].Name
</text>
<!--TODO: Split for researched and unresearched info-->
<!--Researched: Mastery, Winrate, Wn7, Battles, LastBattle-->
<!--Researched: Mastery, Winrate, AvgDmg, Battles, LastBattle-->
@if(i == 0 || i == 2)
{
<g>
<!--Mastery-->
<image x="7" y="@(CardHeigth - 26)" width="20" height="20" href="@TanksList.ToArray()[i].MarkOfMastery.IconAsset()"/>
<!--Winrate-->
<image x="7" y="40" width="20" height="20" href="icons/details.wins.scale-200.png"/>
<text x="32" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
@(TanksList.ToArray()[i].WinRate.ToString("N0"))%
</text>
<line x1="8" y1="60" x2="58" y2="60" style="@($"stroke:{TanksList.ToArray()[i].WinRate.ScaleColor()};stroke-width:3")" />
<!--AvgDmg-->
<image x="@(CardWidth - 62)" y="40" width="20" height="20" href="icons/damage.scale-200.png"/>
<text x="@(CardWidth - 37)" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
@TanksList.ToArray()[i].AvgDamage.ToString("N0")
</text>
<!--Battles-->
<image x="@(CardWidth - 62)" y="9" width="20" height="20" href="icons/details.battles.scale-200.png"/>
<text x="@(CardWidth - 37)" y="9" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
@TanksList.ToArray()[i].Battles.ToString("N0")
</text>
<!--Last battle-->
<image x="@(CardWidth - 83)" y="@(CardHeigth - 23)" width="16" height="16" href="icons/calendar.scale-200.png"/>
<text x="@(CardWidth - 60)" y="@(CardHeigth - 23)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
@TanksList.ToArray()[i].LastBattleTime.ToString("d")
</text>
</g>
}
<!--Unresearched: XP, Credits-->
@if(i == 1)
{
<g>
<!--XP-->
<image x="@(CardWidth - 84)" y="9" width="20" height="20" href="icons/xp.avg.scale-200.png"/>
<text x="@(CardWidth - 60)" y="9" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
203.5 K
</text>
<!--Credits-->
<image x="@(CardWidth - 84)" y="@(CardHeigth - 23)" width="20" height="20" href="icons/encyclopedia.vehicle.credits.scale-200.png"/>
<text x="@(CardWidth - 60)" y="@(CardHeigth - 23)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
8 500 K
</text>
</g>
}
</g>
</svg>
}
@@ -3,8 +3,10 @@ using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Blazor.GraphQl;
using WotBlitzStatisticsPro.Blazor.Model;
using WotBlitzStatisticsPro.Blazor.Services;
namespace WotBlitzStatisticsPro.Blazor.Pages
@@ -23,11 +25,17 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
[Inject]
public IMediaQueriesService MediaQueriesService { get; set; }
[Inject]
public ISvgHelper SvgHelper { get; set; }
public int FrameHeigth { get; set; }
public int CardWidth { get; } = 200;
public int CardHeigth { get; } = 120;
//[Obsolete("Just temporary. In the future, add this into tankTree DTO")]
//public ElementDimensions[] BattlesTextSize { get; set; }
public string FrameStyle
{
get
@@ -43,8 +51,22 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
//FrameWidth = Convert.ToInt32(((decimal)screenWidth) * 0.94m);
FrameHeigth = screenHeight - 390;
// TODO: This is temporary
//var dd = new List<ElementDimensions>();
//var tt = TanksList.ToArray();
//for (int i = 0; i < 3; i++)
//{
// var d = await SvgHelper.CalculateTextBlockSizeAsync(tt[i].Battles.ToString("N0"), "Segoe UI", 12);
// dd.Add(d);
//}
//BattlesTextSize = dd.ToArray();
//---
}
public int GetTextWidth(string text, string fontFace, int fontSize)
{
return SvgHelper.CalculateTextBlockSize(text, fontFace, fontSize).Width;
}
}
}
+1
View File
@@ -33,6 +33,7 @@ namespace WotBlitzStatisticsPro.Blazor
builder.Services.AddScoped<IMediaQueriesService, MediaQueriesService>();
builder.Services.AddScoped<ITankStatisticDialogService, TankStatisticDialogService>();
builder.Services.AddScoped<IMedalDialogService, MedalDialogService>();
builder.Services.AddScoped<ISvgHelper, SvgHelper>();
builder.Services.AddMediatR(typeof(Program));
@@ -0,0 +1,10 @@
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Blazor.Model;
namespace WotBlitzStatisticsPro.Blazor.Services
{
public interface ISvgHelper
{
ElementDimensions CalculateTextBlockSize(string text, string fontFace, int fontSize);
}
}
@@ -0,0 +1,28 @@
using Microsoft.JSInterop;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Blazor.Model;
using System.Text.Json;
namespace WotBlitzStatisticsPro.Blazor.Services
{
public class SvgHelper : ISvgHelper
{
private readonly IJSRuntime _jsRuntime;
public SvgHelper(IJSRuntime jsRuntime)
{
_jsRuntime = jsRuntime;
}
public ElementDimensions CalculateTextBlockSize(string text, string fontFace, int fontSize)
{
var jsInProcess = (IJSInProcessRuntime)_jsRuntime;
return jsInProcess.Invoke<ElementDimensions>("svgHelper.CalculateTextBlockDimensions", new
{
Text = text,
Font = fontFace,
Size = fontSize
});
}
}
}
@@ -0,0 +1,16 @@
query dictionary($nationId: String!, $requestLanguage: RequestLanguage!) {
vehicles(nationId: $nationId, language: $requestLanguage) {
tankId
name
description
isPremium
typeId
nationId
tier
previewImage
normalImage
priceCredit
priceGold
nexTanksInTree
}
}
@@ -20,6 +20,8 @@ type Query {
tankMedals("AccountId" accountId: Long! "Account tank Id" tankId: Long! "Account region" realmType: RealmType "Request language" requestLanguage: RequestLanguage): AccountAchievementsResponse!
"Returns authentication URL accourding Realm"
loginUrl("Wargaming Realm." realmType: RealmType!): String!
"Returns a list of all vehicles of one nation\n\n\n**Returns:**\nA list of vehicles"
vehicles("Nation" nationId: String! "Request language" language: RequestLanguage): [VehicleResponse!]!
}
type Mutation {
@@ -377,6 +379,34 @@ type UpdateDictionariesResponseItem {
description: String
}
"Response for vehicle dictionary query"
type VehicleResponse {
"VehicleId"
tankId: Long!
"Vehicle name"
name: String!
"Vehicle description"
description: String!
"Is vehicle premium"
isPremium: Boolean!
"Vehicle type id"
typeId: String!
"Vehicle nationId"
nationId: String!
"Vehicle tier"
tier: Int!
"Vehicle preview image"
previewImage: String!
"Vehicle normal image"
normalImage: String!
"Vehicle price in credits"
priceCredit: Decimal!
"Vehicle price in gold"
priceGold: Decimal!
"Ids of nex tanks and their cost in XP"
nexTanksInTree: [Long!]
}
"Represents information about player's achievements"
type AccountAchievementsResponse {
"Player Id"
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -27,6 +27,7 @@
<script src="echarts/echarts.js"></script>
<script src="echarts/echarts-interop.js"></script>
<script src="media-queries.js"></script>
<script src="svg-helper.js"></script>
<script>navigator.serviceWorker.register('service-worker.js');</script>
</body>
@@ -0,0 +1,23 @@
var svgHelper = svgHelper || {};
svgHelper.CalculateTextBlockDimensions = function (textParams) {
const svg = `
<svg xmlns="http://www.w3.org/2000/svg">
<text
x="0"
y="0"
text-anchor="start"
alignment-baseline="before-edge"
font-family="${textParams.Font}"
font-size="${textParams.Size}">
${textParams.Text}
</text>
</svg>`;
const el = document.createElement("div");
el.innerHTML = svg;
document.body.appendChild(el);
const svgText = el.querySelector('text').getBBox();
el.remove();
const result = { Height: Math.round(svgText.height), Width: Math.round(svgText.width) };
return result;
};
@@ -0,0 +1,70 @@
using System.Collections.Generic;
namespace WotBlitzStatisticsPro.Common.Model
{
/// <summary>
/// Response for vehicle dictionary query
/// </summary>
public class VehicleResponse
{
///<summary>
/// VehicleId
///</summary>
public long TankId { get; set; }
///<summary>
/// Vehicle name
///</summary>
public string Name { get; set; } = string.Empty;
///<summary>
/// Vehicle description
///</summary>
public string Description { get; set; } = string.Empty;
///<summary>
/// Is vehicle premium
///</summary>
public bool IsPremium { get; set; }
///<summary>
/// Vehicle type id
///</summary>
public string TypeId { get; set; } = string.Empty;
///<summary>
/// Vehicle nationId
///</summary>
public string NationId { get; set; } = string.Empty;
///<summary>
/// Vehicle tier
///</summary>
public int Tier { get; set; }
/// <summary>
/// Vehicle preview image
/// </summary>
public string PreviewImage { get; set; } = string.Empty;
/// <summary>
/// Vehicle normal image
/// </summary>
public string NormalImage { get; set; } = string.Empty;
/// <summary>
/// Vehicle price in credits
/// </summary>
public decimal PriceCredit { get; set; }
/// <summary>
/// Vehicle price in gold
/// </summary>
public decimal PriceGold { get; set; }
/// <summary>
/// Ids of nex tanks and their cost in XP
/// </summary>
public List<long>? NexTanksInTree { get; set; }
}
}
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using HotChocolate.Types;
using WotBlitzStatisticsPro.Common.Model;
using WotBlitzStatisticsPro.Logic;
namespace WotBlitzStatisticsPro.GraphQl.Query
{
[ExtendObjectType(Name = "Query")]
public class VehiclesQuery
{
/// <summary>
/// Returns a list of all vehicles of one nation
/// </summary>
/// <param name="nationId">Nation</param>
/// <param name="language">Request language</param>
/// <returns>A list of vehicles</returns>
public async Task<List<VehicleResponse>> GetVehicles(string nationId, RequestLanguage? language)
{
return new List<VehicleResponse>();
}
}
}
+1
View File
@@ -91,6 +91,7 @@ namespace WotBlitzStatisticsPro.GraphQl
.AddType<WotBlitzAchievementsQuery>()
.AddType<TankInfoResponseType>()
.AddType<WargamingAuthQuery>()
.AddType<VehiclesQuery>()
.AddMutationType(d => d.Name("Mutation"))
.AddType<WotBlitzStatisticsMutation>()
.AddType<AuthenticationMutation>()