Skip to content

Commit

Permalink
Added an option for game books to override when mod has none
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex4SSB committed Jun 19, 2021
1 parent dc0c0e6 commit cfeed56
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 5 deletions.
3 changes: 2 additions & 1 deletion EU4-PCP/Models/General.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public enum General
ShowIllegalProv,
IgnoreIllegal,
InC,
DateFormat
DateFormat,
OverrideBooks
}
}
2 changes: 1 addition & 1 deletion EU4-PCP/Models/PCP_Implementations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1496,7 +1496,7 @@ public static bool FetchFiles(FileType scope)
catch (Exception)
{
// If no mod files were found - just use the game files (except bookmarks)
if (scope != FileType.Bookmark)
if (scope != FileType.Bookmark || Storage.RetrieveBool(General.OverrideBooks))
filesList.AddRange(baseFiles.Select(f => new FileObj(f)));

return false;
Expand Down
1 change: 1 addition & 0 deletions EU4-PCP/Properties/Names.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public static class Names
{ "ColorPickerDefault", "0" },
{ "PersonalizationDefault", "0" },
{ "AboutDefault", "1" },
{ "OverrideBooksDefault", "1" },
{ "MaxProvPositive", "Amount of provinces is within the limit." },
{ "MaxProvNegative", "Amount of provinces exceeds the limit." },
{ "ModProvNegative", "The game has more provinces, so name conflicts may occur." }
Expand Down
18 changes: 18 additions & 0 deletions EU4-PCP/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions EU4-PCP/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<data name="AutoLoad" xml:space="preserve">
<value>Auto-Load</value>
</data>
<data name="Bookmarks" xml:space="preserve">
<value>Bookmarks</value>
</data>
<data name="Change" xml:space="preserve">
<value>Change</value>
</data>
Expand Down Expand Up @@ -180,6 +183,9 @@
<data name="ModPath" xml:space="preserve">
<value>Mod Path</value>
</data>
<data name="OverrideModBooks" xml:space="preserve">
<value>Show Game Bookmarks When Mod Has None</value>
</data>
<data name="ProvinceFiltering" xml:space="preserve">
<value>Filtering</value>
</data>
Expand Down
1 change: 1 addition & 0 deletions EU4-PCP/Views/ColorPickerPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@
</StackPanel>
<Separator Margin="0,10,0,0" />
<TextBlock
x:Name="BookmarkBlock"
Margin="4"
HorizontalAlignment="Center"
FontSize="14"
Expand Down
9 changes: 8 additions & 1 deletion EU4-PCP/Views/ColorPickerPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using EU4_PCP.Models;
using EU4_PCP.Services;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
Expand Down Expand Up @@ -31,7 +32,7 @@ public ColorPickerPage()

public event PropertyChangedEventHandler PropertyChanged;

private void Set<T>(ref T storage, T value, [CallerMemberName]string propertyName = null)
private void Set<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
{
if (Equals(storage, value))
{
Expand Down Expand Up @@ -79,6 +80,12 @@ private void InitializeData()
BookmarkComboBox.ItemsSource = BookmarkComboBox.IsEnabled ? BookmarkList : null;
BookmarkComboBox.SelectedIndex = SelectedBookmarkIndex;

if (SelectedMod)
{
string modPath = Directory.GetParent(PCP_Paths.SteamModPath).FullName;
BookmarkBlock.Text = $"Bookmark Selection{(BookFiles.Any(b => Directory.GetParent(b.Path).FullName.Contains(modPath)) ? "" : " *")}";
}

StartDateBlock.Text = StartDateStr;
StartDateBlock.ToolTip = CurrentDateFormat(true);

Expand Down
12 changes: 11 additions & 1 deletion EU4-PCP/Views/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
xmlns:models="clr-namespace:EU4_PCP.Models"
xmlns:properties="clr-namespace:EU4_PCP.Properties"
xmlns:sys="clr-namespace:System;assembly=System.Runtime"
d:DesignHeight="1300"
d:DesignWidth="800"
Style="{DynamicResource MahApps.Styles.Page}"
mc:Ignorable="d">
Expand Down Expand Up @@ -283,6 +282,17 @@
Tag="IgnoreIllegal"
Unchecked="Box_Checked" />
</StackPanel>
<StackPanel Margin="{StaticResource SmallTopMargin}">
<TextBlock Style="{StaticResource BodyTextStyle}" Text="{x:Static properties:Resources.Bookmarks}" />
<CheckBox
x:Name="OverrideModBooks"
Margin="{StaticResource XSmallTopMargin}"
Checked="Box_Checked"
Content="{x:Static properties:Resources.OverrideModBooks}"
FontSize="{StaticResource MediumFontSize}"
Tag="OverrideBooks"
Unchecked="Box_Checked" />
</StackPanel>
</StackPanel>
<StackPanel Margin="{StaticResource SmallTopMargin}" Orientation="Horizontal">
<Button
Expand Down
3 changes: 2 additions & 1 deletion EU4-PCP/Views/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,8 @@ private void AddControls()
PersonalizationHideButton,
PersonalizationStack,
AboutHideButton,
AboutStack
AboutStack,
OverrideModBooks
});
}

Expand Down

0 comments on commit cfeed56

Please sign in to comment.