-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
208 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System; | ||
using System.IO; | ||
using System.Windows.Data; | ||
using System.Windows.Media; | ||
|
||
namespace Unverum.UI | ||
{ | ||
public class FileNameConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return Path.GetFileNameWithoutExtension((string)value); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return null; | ||
} | ||
} | ||
public class PathNameConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return ((string)value).Replace($@"{Global.assemblyLocation}{Global.s}Mods{Global.s}{Global.config.CurrentGame}", "..."); | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) | ||
{ | ||
return null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<Window x:Class="Unverum.UI.ConfigurePaksWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Unverum.UI" | ||
xmlns:fa5="http://schemas.fontawesome.com/icons/" | ||
mc:Ignorable="d" | ||
Title="Unverum" WindowStartupLocation="CenterScreen" | ||
ResizeMode="NoResize" MinWidth="400" MaxWidth="750" | ||
Background="#202020" ShowActivated="True" SizeToContent="WidthAndHeight"> | ||
<Window.Resources> | ||
<local:FileNameConverter x:Key="FileNameConverter"/> | ||
<local:PathNameConverter x:Key="PathNameConverter"/> | ||
<Style x:Key="ToggleButtonStyle" TargetType="{x:Type ToggleButton}"> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ToggleButton}"> | ||
<Border x:Name="border" Background="#353535"> | ||
<ContentPresenter/> | ||
</Border> | ||
<ControlTemplate.Triggers> | ||
<Trigger Property="IsChecked" Value="true"> | ||
<Setter Property="Background" TargetName="border" Value="#006ac1"/> | ||
</Trigger> | ||
</ControlTemplate.Triggers> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
<DataTemplate x:Key="PakTemplate"> | ||
<ToggleButton Click="ToggleButton_Click" IsChecked="{Binding Value, Mode=OneWay}" Margin="5" HorizontalContentAlignment="Stretch" Background="#494949" Style="{StaticResource ToggleButtonStyle}"> | ||
<ToggleButton.Resources> | ||
<Style TargetType="{x:Type Border}"> | ||
<Setter Property="CornerRadius" Value="2"/> | ||
</Style> | ||
</ToggleButton.Resources> | ||
<Grid VerticalAlignment="Center" x:Name="GridItem" Margin="3"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<TextBlock Name="PakText" Grid.Row="0" TextTrimming="CharacterEllipsis" FontSize="18" FontWeight="SemiBold" Foreground="#f2f2f2" Text="{Binding Key, Mode=OneWay, Converter={StaticResource FileNameConverter}}"/> | ||
<TextBlock Name="PathText" Grid.Row="1" TextTrimming="CharacterEllipsis" FontSize="13" TextWrapping="WrapWithOverflow" Foreground="#a2a2a2" Text="{Binding Key, Mode=OneWay, Converter={StaticResource PathNameConverter}}"/> | ||
</Grid> | ||
</ToggleButton> | ||
</DataTemplate> | ||
</Window.Resources> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto"/> | ||
<RowDefinition Height="Auto"/> | ||
</Grid.RowDefinitions> | ||
<ListView MaxHeight="500" Style="{StaticResource ListviewStyle}" Name="PakList" Grid.Row="0" Background="Transparent" BorderThickness="0" ItemTemplate="{StaticResource PakTemplate}"> | ||
<ListView.ItemContainerStyle> | ||
<Style TargetType="{x:Type ListViewItem}"> | ||
<Setter Property="HorizontalContentAlignment" Value="Stretch"/> | ||
<Setter Property="Focusable" Value="false"/> | ||
<Setter Property="Background" Value="Transparent" /> | ||
<Setter Property="Template"> | ||
<Setter.Value> | ||
<ControlTemplate TargetType="{x:Type ListViewItem}"> | ||
<ContentPresenter /> | ||
</ControlTemplate> | ||
</Setter.Value> | ||
</Setter> | ||
</Style> | ||
</ListView.ItemContainerStyle> | ||
</ListView> | ||
<Button Grid.Row="1" HorizontalContentAlignment="Stretch" Margin="5" Name="CloseButton" Content=" Close" FontSize="18" FontWeight="SemiBold" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="40" Background="#494949" Foreground="#f2f2f2" Click="CloseButton_Click"> | ||
<Button.Resources> | ||
<Style TargetType="{x:Type Border}"> | ||
<Setter Property="CornerRadius" Value="2"/> | ||
</Style> | ||
</Button.Resources> | ||
</Button> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Windows.Input; | ||
using System.Windows.Controls.Primitives; | ||
using System.Collections.ObjectModel; | ||
|
||
namespace Unverum.UI | ||
{ | ||
/// <summary> | ||
/// Interaction logic for ConfigurePaksWindow.xaml | ||
/// </summary> | ||
public partial class ConfigurePaksWindow : Window | ||
{ | ||
public Mod _mod; | ||
public ConfigurePaksWindow(Mod mod) | ||
{ | ||
InitializeComponent(); | ||
if (mod != null) | ||
{ | ||
_mod = mod; | ||
PakList.ItemsSource = new ObservableCollection<KeyValuePair<string, bool>>(_mod.paks); | ||
Title = $"Configure Paks for {_mod.name}"; | ||
} | ||
} | ||
|
||
private void CloseButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
private void ToggleButton_Click(object sender, RoutedEventArgs e) | ||
{ | ||
ToggleButton button = sender as ToggleButton; | ||
var item = button.DataContext as KeyValuePair<string, bool>?; | ||
_mod.paks[item.Value.Key] = (bool)button.IsChecked; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters