Skip to content

Commit

Permalink
'show alternate' deck editor toggle state is now saved into config
Browse files Browse the repository at this point in the history
  • Loading branch information
brine authored and kellyelton committed Apr 23, 2024
1 parent b8721de commit 195f075
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 5 deletions.
5 changes: 5 additions & 0 deletions octgnFX/Octgn.Core/Prefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,5 +648,10 @@ public static string DeviceId {
get { return Config.Instance.ReadValue(nameof(DeviceId), Guid.NewGuid().ToString()); }
set { Config.Instance.WriteValue(nameof(DeviceId), value); }
}
public static bool ShowAltsInDeckEditor
{
get { return Config.Instance.ReadValue("ShowAltsInDeckEditor", false); }
set { Config.Instance.WriteValue("ShowAltsInDeckEditor", value); }
}
}
}
4 changes: 2 additions & 2 deletions octgnFX/Octgn.JodsEngine/DeckBuilder/SearchControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
</Grid.ColumnDefinitions>
<Button Content="Hide Filters" FontSize="14" Width="100" Margin="1,10,10,1" Style="{StaticResource FlatDarkButtonStyle}"
Click="ToggleFilterVisibility" IsDefault="False" x:Name="ShowFilterToggleButton" Grid.Column="0" />
<CheckBox Content="Hide Alternates" Margin="1,10,10,1" Foreground="Black" VerticalAlignment="Bottom" HorizontalAlignment="Left" FontWeight="Bold"
Click="RefreshSearch" IsChecked="False" x:Name="HideAltToggleButton" Grid.Column="1" />
<CheckBox Content="Show Alternates" Margin="1,10,10,1" Foreground="Black" VerticalAlignment="Bottom" HorizontalAlignment="Left" FontWeight="Bold"
IsChecked="{Binding ElementName=self,Path=ShowAlternates}" x:Name="ShowAltToggleButton" Grid.Column="1" />
<TextBlock x:Name="ResultCount" TextAlignment="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" FontWeight="Bold" Foreground="Black"
Grid.Column="2" TextWrapping="WrapWithOverflow" Text="0 Results" />
<Button Content="Search" FontSize="14" Width="80" Margin="10,10,1,1" Style="{StaticResource FlatDarkGreenButtonStyle}"
Expand Down
33 changes: 30 additions & 3 deletions octgnFX/Octgn.JodsEngine/DeckBuilder/SearchControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,23 @@ public bool NumVisible
}
}

public bool ShowAlternates
{
get
{
return Prefs.ShowAltsInDeckEditor;
}
set
{
if (value != Prefs.ShowAltsInDeckEditor)
{
Prefs.ShowAltsInDeckEditor = value;
OnPropertyChanged("ShowAlternates");
RefreshSearch(null, null);
}
}
}

public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow)
{
_deckWindow = deckWindow;
Expand All @@ -68,6 +85,17 @@ public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow)
filtersList.ItemsSource = source;
GenerateColumns(game);
//resultsGrid.ItemsSource = game.SelectCards(null).DefaultView;


RoutedEventHandler loadedEvent = null;

loadedEvent = (sender, args) => {
this.Loaded -= loadedEvent;
this.RefreshSearch(SearchButton, null);
};

this.Loaded += loadedEvent;

UpdateDataGrid(game.AllCards(true).ToDataTable(Game).DefaultView);
FileName = "";
UpdateCount();
Expand Down Expand Up @@ -95,7 +123,7 @@ public SearchControl(DataNew.Entities.Game loadedGame, SearchSave save, DeckBuil
filtersList.ItemsSource =
Enumerable.Repeat<object>("First", 1)
.Union(Enumerable.Repeat<object>(new NamePropertyDef(), 1))
.Union(Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets()), 1))
.Union(Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets().Where(x => x.Hidden == false)), 1))
.Union(game.CardProperties.Values.Where(p => !p.Hidden));
this.GenerateColumns(game);
FileName = "";
Expand Down Expand Up @@ -481,8 +509,7 @@ private void RefreshSearch(object sender, RoutedEventArgs e)
if (orconditions.Count > 0) filterString += " and ";
filterString += String.Format("({0})", String.Join(" and ", conditions));
}

if (HideAltToggleButton.IsChecked == true)
if (ShowAlternates == false)
{
if (filterString != "") filterString += " and ";
filterString += "[Alternates] = ''";
Expand Down
3 changes: 3 additions & 0 deletions recentchanges.txt
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
o8build will give a more useful error if you use richtext symbols in a set but don't have a symbols element in the game XML.
richtext symbol sizes will properly scale with the font size they are placed in
changed 'hide alternates' to 'show alternates' in deck editor for clarity
the 'show alternates' deck editor toggle state is now saved in config

0 comments on commit 195f075

Please sign in to comment.