mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-23 19:30:06 +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-->
|
<!--TankImage-->
|
||||||
<image x="@((CardWidth - 95) / 2)" y="@((CardHeigth - 70) / 2)" width="95" height="70" href="@tank.PreviewImage"/>
|
<image x="@((CardWidth - 95) / 2)" y="@((CardHeigth - 70) / 2)" width="95" height="70" href="@tank.PreviewImage"/>
|
||||||
<!--TankName-->
|
<!--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
|
@tank.Name
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
@@ -80,8 +80,8 @@
|
|||||||
@tank.Battles.Value.ToString("N0")
|
@tank.Battles.Value.ToString("N0")
|
||||||
</text>
|
</text>
|
||||||
<!--Last battle-->
|
<!--Last battle-->
|
||||||
<image x="@(CardWidth - 83)" y="@(CardHeigth - 23)" width="16" height="16" href="icons/calendar.scale-200.png"/>
|
<image x="8" y="@(CardHeigth - 50)" 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">
|
<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")
|
@tank.LastBattleTime.Value.ToString("d")
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
@@ -91,8 +91,8 @@
|
|||||||
{
|
{
|
||||||
<g>
|
<g>
|
||||||
<!--Credits-->
|
<!--Credits-->
|
||||||
<image x="@(CardWidth - 84)" y="@(CardHeigth - 23)" width="20" height="20" href="icons/encyclopedia.vehicle.credits.scale-200.png"/>
|
<image x="8" y="@(CardHeigth - 50)" 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">
|
<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
|
@((tank.PriceCredit / 1000).ToString("N0")) K
|
||||||
</text>
|
</text>
|
||||||
</g>
|
</g>
|
||||||
|
|||||||
@@ -86,28 +86,7 @@ namespace WotBlitzStatisticsPro.Blazor.Pages
|
|||||||
int row = 0;
|
int row = 0;
|
||||||
foreach (var vehicleFromDictionary in vehiclesByTier)
|
foreach (var vehicleFromDictionary in vehiclesByTier)
|
||||||
{
|
{
|
||||||
var treeItem = new TankTreeItem
|
var treeItem = BuildNonPremTreeItem(tier, vehicleFromDictionary, row);
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
TreeItems.Add(treeItem);
|
TreeItems.Add(treeItem);
|
||||||
row++;
|
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