Skip to content

Commit

Permalink
Bumped version to 1.6.8.2, kitchen and cockpit slots are now grouped …
Browse files Browse the repository at this point in the history
…for accessibility checks
  • Loading branch information
BlackTasty committed Oct 2, 2024
1 parent b788df5 commit 76017fb
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 95 deletions.
158 changes: 81 additions & 77 deletions SLC_LayoutEditor/Controls/IssueTracker.xaml

Large diffs are not rendered by default.

10 changes: 0 additions & 10 deletions SLC_LayoutEditor/Controls/LogOutput.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Tasty.Logging;

namespace SLC_LayoutEditor.Controls
Expand Down
25 changes: 24 additions & 1 deletion SLC_LayoutEditor/Core/Cabin/AdjacentSlots.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using SLC_LayoutEditor.Core.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;

namespace SLC_LayoutEditor.Core.Cabin
{
Expand All @@ -22,6 +24,8 @@ internal class AdjacentSlots
public bool HasAdjacentAisle => adjacentSlots.Any(x => x?.IsAir ?? false) ||
center.IsSeat && ((TopSlot?.IsSeat ?? false) || (BottomSlot?.IsSeat ?? false));

public bool HasAdjacentSlotsWithType => adjacentSlots.Any(x => x?.Type == center.Type);

public List<CabinSlot> Adjacent => adjacentSlots;

public AdjacentSlots(CabinDeck cabinDeck, CabinSlot center)
Expand All @@ -32,5 +36,24 @@ public AdjacentSlots(CabinDeck cabinDeck, CabinSlot center)
adjacentSlots.Add(cabinDeck.GetSlotAtPosition(center.Row, center.Column - 1)); // top slot
adjacentSlots.Add(cabinDeck.GetSlotAtPosition(center.Row, center.Column + 1)); // bottom slot
}

public bool IsGroupReachable(CabinDeck cabinDeck)
{
return IsGroupReachable(cabinDeck, null);
}

private bool IsGroupReachable(CabinDeck cabinDeck, CabinSlot source)
{
foreach (CabinSlot groupedSlot in adjacentSlots.Where(x => x != null && x.GetPosition() != source?.GetPosition() && x.Type == center.Type))
{
if (cabinDeck.PathGrid.HasPathToAny(groupedSlot, cabinDeck.CabinSlots.Where(x => x.Type == CabinSlotType.Door)) ||
new AdjacentSlots(cabinDeck, groupedSlot).IsGroupReachable(cabinDeck, center))
{
return true;
}
}

return false;
}
}
}
6 changes: 6 additions & 0 deletions SLC_LayoutEditor/Core/Cabin/CabinSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ internal bool CollectForHistory
}
}

protected bool IsGroupableType => Type == CabinSlotType.Cockpit || Type == CabinSlotType.Kitchen;

public CabinSlot(int assignedFloor, int row, int column) : this(assignedFloor, row, column, CabinSlotType.Aisle, 0)
{

Expand Down Expand Up @@ -392,6 +394,10 @@ public bool IsReachable(CabinDeck deck)
bool hasPath = deck.PathGrid.HasPathToAny(this, deck.CabinSlots.Where(x => x.Type == CabinSlotType.Door));
return hasPath;
}
else if (IsGroupableType && adjacentSlots.HasAdjacentSlotsWithType)
{
return adjacentSlots.IsGroupReachable(deck);
}
else
{
return false;
Expand Down
6 changes: 3 additions & 3 deletions SLC_LayoutEditor/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@
<Grid Background="{StaticResource BackdropColorBrush}"
Visibility="{Binding DisableControls, Converter={StaticResource BooleanToVisibilityConverter}}">
<Border x:Name="container_loader" Visibility="{Binding IsLoadingLayout, Converter={StaticResource BooleanToVisibilityConverter}}"
BorderThickness="2" CornerRadius="10"
Background="{StaticResource BackgroundColorBrush}" UseLayoutRounding="True"
BorderThickness="2" CornerRadius="10" Padding="8,8,8,0"
Background="{StaticResource BackgroundDarkBrush}" UseLayoutRounding="True"
HorizontalAlignment="Center"
Margin="64">
<Border.Style>
Expand All @@ -410,7 +410,7 @@
</VisualBrush>
</StackPanel.OpacityMask>
<TextBlock Text="Loading layout, please wait..." FontSize="30" Margin="8,4,8,0"/>
<ProgressBar IsIndeterminate="True" Margin="0,8,0,2"
<ProgressBar IsIndeterminate="True" Margin="-8,8,-8,2"
BorderBrush="Transparent"/>
</StackPanel>
</Border>
Expand Down
4 changes: 2 additions & 2 deletions SLC_LayoutEditor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.6.8.1")]
[assembly: AssemblyFileVersion("1.6.8.1")]
[assembly: AssemblyVersion("1.6.8.2")]
[assembly: AssemblyFileVersion("1.6.8.2")]
2 changes: 2 additions & 0 deletions SLC_LayoutEditor/Resources/patchnotes.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
08.07.2024
Added: When loading layouts, you will now see a "Loading layout" screen to show something is happening. This is especially useful on larger layouts
Changed: Groups of kitchen and cockpit slots are now considered as accessible by the editor, as long as at least one of the slots in the group is adjacent to an aisle
Changed: The issue lists for decks are now better visible
Fixed: Changing slots with keybinds didn't trigger the check for unsaved changes
4 changes: 2 additions & 2 deletions SLC_LayoutEditor/UI/LayoutEditor.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
</ContextMenu>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="column_sidebar" Width="365"/>
<ColumnDefinition x:Name="column_sidebar" Width="381"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
Expand Down Expand Up @@ -832,7 +832,7 @@
</ToggleButton>
</AdornerDecorator>
</Grid>
<Border Background="{DynamicResource BackdropColorBrush}" Grid.ColumnSpan="3"
<Border Background="{DynamicResource BackdropColorBrush}" Grid.ColumnSpan="3" Padding="16"
Visibility="{Binding IsLoadingLayout, Converter={StaticResource BooleanToVisibilityConverter}}">
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="16">
<TextBlock Style="{StaticResource Title1TextStyle}" HorizontalAlignment="Center">
Expand Down

0 comments on commit 76017fb

Please sign in to comment.