mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 02:17:20 +02:00
feat: tank tree helper
This commit is contained in:
1 parent
d3989a1096
commit
5fe3c458e1
3 files changed
+43
-37
No files matched your search
@@ -1,4 +1,5 @@
|
||||
using WotBlitzStatisticsPro.Blazor.Model;
|
||||
using System;
|
||||
using WotBlitzStatisticsPro.Blazor.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Blazor
|
||||
{
|
||||
@@ -44,9 +45,48 @@ namespace WotBlitzStatisticsPro.Blazor
|
||||
|
||||
public const string LoginInfoLocalStorageKey = "login_info";
|
||||
|
||||
/*
|
||||
* Mongo express filter:
|
||||
* {"NationId": "germany", "IsPremium": false, "Tier": 9}
|
||||
* Projection:
|
||||
* {"Tier" : true,"Name": { $slice: 1 }}
|
||||
*/
|
||||
[Obsolete("Do this as the dictionary in the DB, to make possibility to change it in the future")]
|
||||
public static TankTreeRowMap[] TanksTreeHelper = new TankTreeRowMap[]
|
||||
{
|
||||
new TankTreeRowMap(2065,2)
|
||||
// Germany
|
||||
new TankTreeRowMap(2065, 2), // First tank in a tree
|
||||
new TankTreeRowMap(1809, 1), // Hetzer (4)
|
||||
new TankTreeRowMap(17425, 3), // Pz.Kpfw. IV Ausf. D (4)
|
||||
|
||||
new TankTreeRowMap(17, 3), // Pz.Kpfw. IV Ausf. G (5)
|
||||
new TankTreeRowMap(5393, 7), // VK 16.02 Leopard (5)
|
||||
|
||||
new TankTreeRowMap(1553, 1), // Jagdpanzer IV (6)
|
||||
new TankTreeRowMap(2321, 5), // VK 36.01 (H) (6)
|
||||
new TankTreeRowMap(7185, 3), // VK 30.01 (P) 6)
|
||||
new TankTreeRowMap(10001, 8), // VK 28.01 (6)
|
||||
new TankTreeRowMap(11793, 0), // Nashorn (6)
|
||||
new TankTreeRowMap(14097, 6), // VK 30.01 (D) (6)
|
||||
|
||||
new TankTreeRowMap(1297, 6), // Panther I (7)
|
||||
new TankTreeRowMap(3857, 1), // Jagdpanther (7)
|
||||
new TankTreeRowMap(4113, 7), // VK 30.02 (D) 7)
|
||||
new TankTreeRowMap(11025, 0), // Sturer Emil (7)
|
||||
|
||||
new TankTreeRowMap(5137, 5), // Tiger II (8)
|
||||
new TankTreeRowMap(7697, 2), // Ferdinand (8)
|
||||
new TankTreeRowMap(8465, 6), // Panther II (8)
|
||||
new TankTreeRowMap(10513, 3), // VK 45.02 (P) Ausf. A (8)
|
||||
new TankTreeRowMap(11537, 1), // Jagdpanther II (8)
|
||||
new TankTreeRowMap(13841, 7), // Indien-Panzer (8)
|
||||
new TankTreeRowMap(18449, 8), // Ru 251 (8)
|
||||
new TankTreeRowMap(20497, 4), // VK 100.01 (P) (8)
|
||||
|
||||
new TankTreeRowMap(7953, 1), // Jagdtiger (9)
|
||||
new TankTreeRowMap(14865, 7), // Leopard Prototyp A (9)
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@
|
||||
<image x="7" y="@(CardHeigth - 26)" width="20" height="20" href="@tank.MarkOfMastery.Value.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">
|
||||
<text x="32" y="40" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-weight="bold" font-size="12">
|
||||
@(tank.WinRate.Value.ToString("N0"))%
|
||||
</text>
|
||||
<line x1="8" y1="60" x2="58" y2="60" style="@($"stroke:{tank.WinRate.Value.ScaleColor()};stroke-width:3")"/>
|
||||
|
||||
@@ -107,9 +107,6 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
}
|
||||
}
|
||||
|
||||
// var firstTank = vehiclesTree.First(v => v.Tier == 1);
|
||||
// TreeItems.AddRange(BuildTree(firstTank, 0, vehiclesTree));
|
||||
|
||||
int maxNonPremTreeRow = GetMaxRowNumber(TreeItems);
|
||||
|
||||
// TODO: build matrix and connections
|
||||
@@ -199,37 +196,6 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
return currentRow;
|
||||
}
|
||||
|
||||
[Obsolete]
|
||||
private List<TankTreeItem> BuildTree(IDictionary_Vehicles firstTank, int rowNumber, List<IDictionary_Vehicles> vehiclesTree)
|
||||
{
|
||||
var result = new List<TankTreeItem>();
|
||||
result.Add(BuildNonPremTreeItem(firstTank, rowNumber));
|
||||
|
||||
var nextTierTanks = vehiclesTree.Where(
|
||||
v => firstTank.NexTanksInTree != null && firstTank.NexTanksInTree.Contains(v.TankId)).ToList();
|
||||
|
||||
if (nextTierTanks.Count == 1)
|
||||
{
|
||||
result.AddRange(BuildTree(nextTierTanks[0], rowNumber, vehiclesTree));
|
||||
return result;
|
||||
}
|
||||
|
||||
// If more than one, sort them AT first, Heavy, Middle and light
|
||||
int nextRow = rowNumber;
|
||||
string[] tankTypes = { "AT-SPG", "heavyTank", "mediumTank", "lightTank" };
|
||||
foreach (var tankType in tankTypes)
|
||||
{
|
||||
foreach (var nextTierTank in nextTierTanks.Where(t => t.TypeId == tankType))
|
||||
{
|
||||
var branch = BuildTree(nextTierTank, nextRow, vehiclesTree);
|
||||
result.AddRange(branch);
|
||||
nextRow += GetMaxRowNumber(branch);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private TankTreeItem BuildNonPremTreeItem(IDictionary_Vehicles vehicleFromDictionary, int row)
|
||||
{
|
||||
var treeItem = new TankTreeItem
|
||||
|
||||
Reference in new issue
Block a user