Skip to content

Commit

Permalink
feat: add data templates for quest log options
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Jan 18, 2023
1 parent ca62ec2 commit 484354b
Show file tree
Hide file tree
Showing 22 changed files with 283 additions and 23 deletions.
4 changes: 4 additions & 0 deletions MHFZ_Overlay/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@
<BooleanToVisibilityConverter x:Key="BoolToVis" />
<FontFamily x:Key="Source Code Pro">pack://application:,,,UI/Fonts/#Source Code Pro</FontFamily>
<FontFamily x:Key="Source Code Pro Bold">pack://application:,,,UI/Fonts/#Source Code Pro Bold</FontFamily>
<FontFamily x:Key="Open Sans">pack://application:,,,UI/Fonts/#Open Sans Regular</FontFamily>
<FontFamily x:Key="Open Sans Bold">pack://application:,,,UI/Fonts/#Open Sans Bold</FontFamily>
<FontFamily x:Key="Open Sans Italic">pack://application:,,,UI/Fonts/#Open Sans Italic</FontFamily>

<!--<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml"/>
</ResourceDictionary.MergedDictionaries>
Expand Down
154 changes: 131 additions & 23 deletions MHFZ_Overlay/ConfigWindow.xaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions MHFZ_Overlay/ConfigWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
using System.Collections.ObjectModel;
using MHFZ_Overlay.controls;
using Newtonsoft.Json.Linq;
using static System.Windows.Forms.Design.AxImporter;
using ComboBox = System.Windows.Controls.ComboBox;

namespace MHFZ_Overlay
{
Expand Down
24 changes: 24 additions & 0 deletions MHFZ_Overlay/MHFZ_Overlay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@
<None Remove="UI\Background\6.png" />
<None Remove="UI\Background\7.png" />
<None Remove="UI\Background\8.png" />
<None Remove="UI\Fonts\OpenSans-Bold.ttf" />
<None Remove="UI\Fonts\OpenSans-BoldItalic.ttf" />
<None Remove="UI\Fonts\OpenSans-ExtraBold.ttf" />
<None Remove="UI\Fonts\OpenSans-ExtraBoldItalic.ttf" />
<None Remove="UI\Fonts\OpenSans-Italic.ttf" />
<None Remove="UI\Fonts\OpenSans-Light.ttf" />
<None Remove="UI\Fonts\OpenSans-LightItalic.ttf" />
<None Remove="UI\Fonts\OpenSans-Medium.ttf" />
<None Remove="UI\Fonts\OpenSans-MediumItalic.ttf" />
<None Remove="UI\Fonts\OpenSans-Regular.ttf" />
<None Remove="UI\Fonts\OpenSans-SemiBold.ttf" />
<None Remove="UI\Fonts\OpenSans-SemiBoldItalic.ttf" />
<None Remove="UI\Fonts\SourceCodePro-Black.ttf" />
<None Remove="UI\Fonts\SourceCodePro-BlackItalic.ttf" />
<None Remove="UI\Fonts\SourceCodePro-Bold.ttf" />
Expand Down Expand Up @@ -259,6 +271,18 @@
<ItemGroup>
<AdditionalFiles Include="..\.sonarlint\dorielrivalet_mhfz_overlay\CSharp\SonarLint.xml" Link="SonarLint.xml" />
<Content Include="mhfzoverlayicon256.ico" />
<Resource Include="UI\Fonts\OpenSans-Bold.ttf" />
<Resource Include="UI\Fonts\OpenSans-BoldItalic.ttf" />
<Resource Include="UI\Fonts\OpenSans-ExtraBold.ttf" />
<Resource Include="UI\Fonts\OpenSans-ExtraBoldItalic.ttf" />
<Resource Include="UI\Fonts\OpenSans-Italic.ttf" />
<Resource Include="UI\Fonts\OpenSans-Light.ttf" />
<Resource Include="UI\Fonts\OpenSans-LightItalic.ttf" />
<Resource Include="UI\Fonts\OpenSans-Medium.ttf" />
<Resource Include="UI\Fonts\OpenSans-MediumItalic.ttf" />
<Resource Include="UI\Fonts\OpenSans-Regular.ttf" />
<Resource Include="UI\Fonts\OpenSans-SemiBold.ttf" />
<Resource Include="UI\Fonts\OpenSans-SemiBoldItalic.ttf" />
<Resource Include="UI\Icons\bar_chart_FILL0_wght400_GRAD0_opsz48.xaml" />
<Resource Include="UI\Icons\database_FILL0_wght400_GRAD0_opsz48.xaml" />
<Resource Include="UI\Icons\leaderboard_FILL0_wght400_GRAD0_opsz48.xaml" />
Expand Down
33 changes: 33 additions & 0 deletions MHFZ_Overlay/UI/Class/Converter/OptionToTemplateConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;

namespace MHFZ_Overlay
{
public class OptionToTemplateConverter : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
var option = item as Option;
if (option == null)
return null;

if (option.Name == "Gear")
return (DataTemplate)((FrameworkElement)container).FindResource("GearTemplate");
else if (option.Name == "Top 20")
return (DataTemplate)((FrameworkElement)container).FindResource("Top20Template");
else if (option.Name == "Weapon Usage")
return (DataTemplate)((FrameworkElement)container).FindResource("WeaponUsageTemplate");
else if (option.Name == "Most Recent")
return (DataTemplate)((FrameworkElement)container).FindResource("MostRecentTemplate");
else if (option.Name == "YouTube")
return (DataTemplate)((FrameworkElement)container).FindResource("YouTubeTemplate");
else
return (DataTemplate)((FrameworkElement)container).FindResource("DefaultTemplate");
}
}
}
35 changes: 35 additions & 0 deletions MHFZ_Overlay/UI/Class/Converter/OptionToVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows;

namespace MHFZ_Overlay
{
public class OptionToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string selectedOption = value as string;
string targetOption = parameter as string;

if (selectedOption == targetOption)
{
return Visibility.Visible;
}
else
{
return Visibility.Collapsed;
}
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}

}
14 changes: 14 additions & 0 deletions MHFZ_Overlay/UI/Class/Option.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MHFZ_Overlay
{
public class Option
{
public string Name { get; set; }
public bool IsSelected { get; set; }
}
}
28 changes: 28 additions & 0 deletions MHFZ_Overlay/UI/Class/Template/OptionTemplateSelector.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;

namespace MHFZ_Overlay
{
public class OptionTemplateSelector : DataTemplateSelector
{
public override DataTemplate SelectTemplate(object item, DependencyObject container)
{
var selectedOption = item as string;
if (selectedOption != null)
{
FrameworkElement element = container as FrameworkElement;
if (element != null)
{
return element.FindResource(selectedOption) as DataTemplate;
}
}
return null;
}
}

}
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-Bold.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-BoldItalic.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-ExtraBold.ttf
Binary file not shown.
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-Italic.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-Light.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-LightItalic.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-Medium.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-MediumItalic.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file added MHFZ_Overlay/UI/Fonts/OpenSans-SemiBold.ttf
Binary file not shown.
Binary file not shown.
12 changes: 12 additions & 0 deletions MHFZ_Overlay/addresses/AddressModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10146,6 +10146,18 @@ public string QuestIDBind
}
}

public ObservableCollection<Option> QuestLogsSearchOption { get; set; } = new ObservableCollection<Option>()
{
new Option{Name = "Gear", IsSelected = false},
new Option{Name = "Top 20", IsSelected = false},
new Option{Name = "Weapon Usage", IsSelected = false},
new Option{Name = "Most Recent", IsSelected = false},
new Option{Name = "YouTube", IsSelected = false}
};


public Option SelectedOption { get; set; } = new Option { Name = "Weapon Usage", IsSelected = true};

public event PropertyChangedEventHandler? PropertyChanged;

/// <summary>
Expand Down

0 comments on commit 484354b

Please sign in to comment.