Skip to content

Commit

Permalink
Merge pull request #2 from adri1wcrow/beautify
Browse files Browse the repository at this point in the history
Beautify
  • Loading branch information
adri1wcrow authored Apr 14, 2018
2 parents 25423a0 + 820d9f7 commit 388b8e0
Show file tree
Hide file tree
Showing 14 changed files with 55 additions and 11 deletions.
3 changes: 3 additions & 0 deletions TankInspector/Design/NationalFlagConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public object Convert(object value, Type targetType, object parameter, System.Gl
case "poland":
prefix = "Poland";
break;
case "italy":
prefix = "Italy";
break;
default:
return null;
}
Expand Down
38 changes: 38 additions & 0 deletions TankInspector/Design/TankColorIconConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using Smellyriver.TankInspector.Modeling;
using Smellyriver.TankInspector.UIComponents;
using System;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace Smellyriver.TankInspector.Design
{
internal class TankColorIconConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (value == null)
return null;

if (value == null)
return null;

string prefix="";

if (value is TankViewModel)
{
var tankVm = (TankViewModel)value;
}
else
{
prefix = value.ToString();
}

return new BitmapImage(new Uri($"/Resources/Images/TankIcons/Classes/{prefix}Color.png", UriKind.Relative));
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
9 changes: 1 addition & 8 deletions TankInspector/Modeling/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,7 @@ public void FullyLoad()
var scriptEntries = PackageStream.GetFileEntries(Path.Combine(RootPath, ScriptsPackageFile));


var nationEntries =
scriptEntries.Where(s => s.StartsWith(VehiclesFolderInPackage))
.Select(
s =>
s.Substring(VehiclesFolderInPackage.Length,
s.IndexOf("/", VehiclesFolderInPackage.Length, StringComparison.InvariantCulture) -
VehiclesFolderInPackage.Length))
.Distinct();
var nationEntries = scriptEntries.Where(s => s.StartsWith(VehiclesFolderInPackage)&&s.Length>VehiclesFolderInPackage.Length).Select( s => s.Substring(VehiclesFolderInPackage.Length, s.IndexOf("/", VehiclesFolderInPackage.Length, StringComparison.InvariantCulture) - VehiclesFolderInPackage.Length)).Distinct();

foreach (var nationName in nationEntries)
{
Expand Down
2 changes: 1 addition & 1 deletion TankInspector/Modeling/PackageDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private void BuildPackageIndices()
var packageRoot = Path.Combine(this.Database.RootPath, "res/packages");

var paths = XElement.Load(Path.Combine(this.Database.RootPath, "paths.xml"));
var packageFiles = paths.Descendants("Path").Select(p => p.Value)
var packageFiles = paths.Descendants("Package").Select(p => p.Value)
.Where(p => p.EndsWith(".pkg"))
.Select(p => Path.Combine(this.Database.RootPath, p));

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions TankInspector/TankInspector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
<Compile Include="Design\RatioToSolidColorBrushConverter.cs" />
<Compile Include="Design\RomanNumber.cs" />
<Compile Include="Design\RomanNumberService.cs" />
<Compile Include="Design\TankColorIconConverter.cs" />
<Compile Include="Graphics\ModelTexture.cs" />
<Compile Include="Graphics\ModelTextureManager.cs" />
<Compile Include="Graphics\Scene\CollisionModelHitTestResult.cs" />
Expand Down Expand Up @@ -1167,6 +1168,13 @@
<Content Include="Additional\Camouflage.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Resource Include="Resources\Images\Flags\ItalyLargeBlurred.png" />
<Resource Include="Resources\Images\Flags\ItalySmall.bmp" />
<Resource Include="Resources\Images\TankIcons\Classes\HeavyTankColor.png" />
<Resource Include="Resources\Images\TankIcons\Classes\LightTankColor.png" />
<Resource Include="Resources\Images\TankIcons\Classes\MediumTankColor.png" />
<Resource Include="Resources\Images\TankIcons\Classes\SelfPropelledGunColor.png" />
<Resource Include="Resources\Images\TankIcons\Classes\TankDestroyerColor.png" />
<Resource Include="Resources\Images\Flags\PolandLargeBlurred.png" />
<Resource Include="Resources\Images\Flags\PolandSmall.bmp" />
<Resource Include="Resources\Images\Flags\SwedenLargeBlurred.png" />
Expand Down
6 changes: 4 additions & 2 deletions TankInspector/themes/TechTree.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:system="clr-namespace:System;assembly=mscorlib">

<design:TankIconConverter x:Key="TankSmallIconConverter" Type="Small" />
<design:TankColorIconConverter x:Key="TankColorIconConverter" />

<Thickness x:Key="NodeButtonPadding">6,3,6,9</Thickness>
<Thickness x:Key="NodeButtonMarginInTechTree">15,5</Thickness>
Expand Down Expand Up @@ -40,12 +41,13 @@
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>

<Image Source="pack://application:,,,/Smellyriver.TankInspector;component/Resources/Images/UIElements/TechTreeNodeBackground.png" />
<Image Source="{Binding Tank.Class, Converter={StaticResource TankColorIconConverter}}"/>
<Image Source="pack://application:,,,/Smellyriver.TankInspector;component/Resources/Images/UIElements/TechTreePremiumTankMask.png"
Visibility="{Binding Tank.IsPremiumTank, Converter={StaticResource BoolToVisibleHiddenConverter}}"/>
<Image Source="pack://application:,,,/Smellyriver.TankInspector;component/Resources/Images/UIElements/TechTreeObsoletedTankMask.png"
Visibility="{Binding Tank.IsObsoleted, Converter={StaticResource BoolToVisibleHiddenConverter}}"/>
Visibility="{Binding Tank.IsObsoleted, Converter={StaticResource BoolToVisibleHiddenConverter}}"/>
<Grid Margin="{StaticResource NodeButtonPadding}">
<Image Source="{Binding Tank, Converter={StaticResource TankSmallIconConverter}}" Stretch="None" HorizontalAlignment="Left" />
<Viewbox Margin="83,4,3,4" HorizontalAlignment="Center" VerticalAlignment="Center" Width="87" StretchDirection="DownOnly">
Expand Down

0 comments on commit 388b8e0

Please sign in to comment.