mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 02:17:20 +02:00
chore: some tanks tree refactoring
This commit is contained in:
1 parent
dd4dedd787
commit
d1dbceb04b
2 files changed
+33
-27
No files matched your search
@@ -53,7 +53,7 @@
|
||||
<!--TankImage-->
|
||||
<image x="@((CardWidth - 95) / 2)" y="@((CardHeigth - 70) / 2)" width="95" height="70" href="@tank.PreviewImage"/>
|
||||
<!--TankName-->
|
||||
<text x="33" y="@(CardHeigth - 25)" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
<text x="33" y="@(CardHeigth - 25)" fill="@(tank.IsPremium ? Constants.ClanTagColor : "white")" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="14">
|
||||
@tank.Name
|
||||
</text>
|
||||
|
||||
@@ -80,8 +80,8 @@
|
||||
@tank.Battles.Value.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">
|
||||
<image x="8" y="@(CardHeigth - 50)" width="16" height="16" href="icons/calendar.scale-200.png"/>
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@tank.LastBattleTime.Value.ToString("d")
|
||||
</text>
|
||||
</g>
|
||||
@@ -91,8 +91,8 @@
|
||||
{
|
||||
<g>
|
||||
<!--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">
|
||||
<image x="8" y="@(CardHeigth - 50)" width="20" height="20" href="icons/encyclopedia.vehicle.credits.scale-200.png"/>
|
||||
<text x="32" y="@(CardHeigth - 50)" fill="white" text-anchor="start" alignment-baseline="before-edge" font-family="Segoe UI" font-size="12">
|
||||
@((tank.PriceCredit / 1000).ToString("N0")) K
|
||||
</text>
|
||||
</g>
|
||||
|
||||
@@ -86,28 +86,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
int row = 0;
|
||||
foreach (var vehicleFromDictionary in vehiclesByTier)
|
||||
{
|
||||
var treeItem = new TankTreeItem
|
||||
{
|
||||
Tier = tier,
|
||||
TankId = vehicleFromDictionary.TankId,
|
||||
Name = vehicleFromDictionary.Name,
|
||||
PriceCredit = vehicleFromDictionary.PriceCredit,
|
||||
PreviewImage = vehicleFromDictionary.PreviewImage,
|
||||
TankTypeId = vehicleFromDictionary.TypeId,
|
||||
IsPremium = false,
|
||||
Row = row
|
||||
};
|
||||
var researched = TanksList.FirstOrDefault(t => t.TankId == treeItem.TankId);
|
||||
treeItem.IsResearched = researched != null;
|
||||
if (researched != null)
|
||||
{
|
||||
treeItem.MarkOfMastery = researched.MarkOfMastery;
|
||||
treeItem.WinRate = researched.WinRate;
|
||||
treeItem.AvgDamage = researched.AvgDamage;
|
||||
treeItem.Battles = researched.Battles;
|
||||
treeItem.LastBattleTime = researched.LastBattleTime;
|
||||
}
|
||||
|
||||
var treeItem = BuildNonPremTreeItem(tier, vehicleFromDictionary, row);
|
||||
TreeItems.Add(treeItem);
|
||||
row++;
|
||||
}
|
||||
@@ -136,5 +115,32 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private TankTreeItem BuildNonPremTreeItem(int tier, IDictionary_Vehicles vehicleFromDictionary, int row)
|
||||
{
|
||||
var treeItem = new TankTreeItem
|
||||
{
|
||||
Tier = tier,
|
||||
TankId = vehicleFromDictionary.TankId,
|
||||
Name = vehicleFromDictionary.Name,
|
||||
PriceCredit = vehicleFromDictionary.PriceCredit,
|
||||
PreviewImage = vehicleFromDictionary.PreviewImage,
|
||||
TankTypeId = vehicleFromDictionary.TypeId,
|
||||
IsPremium = false,
|
||||
Row = row
|
||||
};
|
||||
var researched = TanksList.FirstOrDefault(t => t.TankId == treeItem.TankId);
|
||||
treeItem.IsResearched = researched != null;
|
||||
if (researched != null)
|
||||
{
|
||||
treeItem.MarkOfMastery = researched.MarkOfMastery;
|
||||
treeItem.WinRate = researched.WinRate;
|
||||
treeItem.AvgDamage = researched.AvgDamage;
|
||||
treeItem.Battles = researched.Battles;
|
||||
treeItem.LastBattleTime = researched.LastBattleTime;
|
||||
}
|
||||
|
||||
return treeItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user