mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-26 20:00:05 +01: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
@@ -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