EHR CP: Style/Display fixes

This commit is contained in:
Gurge44 committed 2024-09-19 20:56:46 +02:00
1 parent fb0043aa61
commit 2612d1df83
6 files changed
+181 -91

No files matched your search

+48 -48
View File
@@ -69,54 +69,54 @@ README file in the root directory of this source tree.
</Style>
<Style TargetType="ListBoxItem">
<Setter Property="Background" Value="#2D2D2D"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontWeight" Value="Regular"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Margin" Value="4"/>
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="BorderElement" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3C3C3C"/>
<Setter Property="Opacity" Value="0.9"/>
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
From="#2D2D2D" To="#3C3C3C" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
From="#3C3C3C" To="#2D2D2D" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#1F1F1F"/>
</Trigger>
</Style.Triggers>
</Style>
<Setter Property="Background" Value="#2D2D2D"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Margin" Value="4"/>
<Setter Property="MinWidth" Value="400"/>
<Setter Property="MinHeight" Value="60"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Stretch"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Border x:Name="BorderElement" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8">
<ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3C3C3C"/>
<Setter Property="Opacity" Value="0.9"/>
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
From="#2D2D2D" To="#3C3C3C" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
From="#3C3C3C" To="#2D2D2D" Duration="0:0:0.2"/>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="#1F1F1F"/>
</Trigger>
</Style.Triggers>
</Style>
<Style TargetType="ScrollViewer">
<Setter Property="Background" Value="#2D2D2D"/>
+62 -9
View File
@@ -58,14 +58,66 @@
<Setter Property="FontFamily" Value="Segoe UI"/>
</Style>
<Style TargetType="ComboBox">
<Setter Property="Background" Value="#2E2E2E"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
</Style>
<Style TargetType="ComboBoxItem">
<Setter Property="Background" Value="#2E2E2E"/>
<Setter Property="FontWeight" Value="Bold"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="FontFamily" Value="Segoe UI"/>
<Setter Property="Background" Value="#2D2D2D"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="200"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Grid.Column="2" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" >
<ToggleButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="5" Background="#2D2D2D" BorderBrush="Black" BorderThickness="1" />
<Border Grid.Column="0" CornerRadius="5,0,0,5" Margin="1" Background="#2D2D2D" BorderBrush="Black" BorderThickness="0,0,1,0" />
<Path x:Name="Arrow" Grid.Column="1" Fill="LightGray" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="#071228" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="true">
<Setter TargetName="Border" Property="Background" Value="#071228" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<ContentPresenter Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3" />
<TextBox x:Name="PART_EditableTextBox" Visibility="Hidden" IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
<Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder" Background="#071228" />
<ScrollViewer SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3E3E3E"/>
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="#707070"/>
<Setter Property="Background" Value="#1E1E1E"/>
<Setter Property="Opacity" Value="0.6"/>
</Trigger>
</Style.Triggers>
</Style>
</Page.Resources>
@@ -90,7 +142,7 @@
<Button Content="Underline" Click="Underline_Click" Margin="5" Foreground="White" />
<!-- Text Size ComboBox -->
<ComboBox Name="fontSizeComboBox" Width="100" Margin="5" SelectionChanged="FontSizeComboBox_SelectionChanged">
<ComboBox Width="100" Margin="5" SelectionChanged="FontSizeComboBox_SelectionChanged" SelectedIndex="0">
<ComboBoxItem Content="12" />
<ComboBoxItem Content="16" />
<ComboBoxItem Content="20" />
@@ -100,7 +152,8 @@
</ComboBox>
<!-- Text Color ComboBox -->
<ComboBox Name="fontColorComboBox" Width="100" Margin="5" SelectionChanged="FontColorComboBox_SelectionChanged">
<ComboBox Width="100" Margin="5" SelectionChanged="FontColorComboBox_SelectionChanged" SelectedIndex="0">
<ComboBoxItem Content="Black" />
<ComboBoxItem Content="White" />
<ComboBoxItem Content="Red" />
<ComboBoxItem Content="Green" />
@@ -116,6 +169,6 @@
<TextBox Name="htmlPreview" Grid.Row="6" Grid.RowSpan="3" IsReadOnly="True"
VerticalAlignment="Bottom" Margin="10,10,10,0" TextWrapping="Wrap" />
<Button Name="BackButton" Grid.Row="9" Content="Back" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="BackButton_Click" />
<Button Grid.Row="9" Content="Back" VerticalAlignment="Bottom" HorizontalAlignment="Right" Click="BackButton_Click" />
</Grid>
</Page>
+2 -5
View File
@@ -20,11 +20,7 @@ namespace CustomTeamAssigner
public string RoleRevealScreenBackgroundColor { get; set; } = "*";
public string TeamName
{
get => teamName;
set => teamName = value;
}
public string TeamName { get; set; } = teamName;
public List<CustomRoles> TeamMembers { get; set; } = [];
@@ -102,6 +98,7 @@ namespace CustomTeamAssigner
return TeamName == team.TeamName;
}
// ReSharper disable once NonReadonlyMemberInGetHashCode
public override int GetHashCode() => TeamName.GetHashCode();
}
}
+46 -21
View File
@@ -71,21 +71,6 @@ README file in the root directory of this source tree.
<ScaleTransform ScaleX="1.5" ScaleY="1.5"/>
</Setter.Value>
</Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="CheckBox">
<BulletDecorator Background="{TemplateBinding Background}">
<BulletDecorator.Bullet>
<Ellipse Width="20" Height="20" Fill="#2D2D2D" Stroke="LightGray" StrokeThickness="2"/>
</BulletDecorator.Bullet>
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</BulletDecorator>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Resources>
<SolidColorBrush x:Key="CheckBoxBulletBrush" Color="Transparent"/>
</Style.Resources>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Foreground" Value="White"/>
@@ -169,6 +154,47 @@ README file in the root directory of this source tree.
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="200"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Grid.Column="2" Focusable="false" IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}" >
<ToggleButton.Template>
<ControlTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="5*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Border x:Name="Border" Grid.ColumnSpan="2" CornerRadius="5" Background="#2D2D2D" BorderBrush="Black" BorderThickness="1" />
<Border Grid.Column="0" CornerRadius="5,0,0,5" Margin="1" Background="#2D2D2D" BorderBrush="Black" BorderThickness="0,0,1,0" />
<Path x:Name="Arrow" Grid.Column="1" Fill="LightGray" HorizontalAlignment="Center" VerticalAlignment="Center" Data="M 0 0 L 4 4 L 8 0 Z"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="ToggleButton.IsMouseOver" Value="true">
<Setter TargetName="Border" Property="Background" Value="#071228" />
</Trigger>
<Trigger Property="ToggleButton.IsChecked" Value="true">
<Setter TargetName="Border" Property="Background" Value="#071228" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</ToggleButton.Template>
</ToggleButton>
<ContentPresenter Name="ContentSite" IsHitTestVisible="False" Content="{TemplateBinding SelectionBoxItem}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" Margin="3" />
<TextBox x:Name="PART_EditableTextBox" Visibility="Hidden" IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup Name="Popup" Placement="Bottom" IsOpen="{TemplateBinding IsDropDownOpen}" AllowsTransparency="True" Focusable="False" PopupAnimation="Slide">
<Grid Name="DropDown" SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder" Background="#071228" />
<ScrollViewer SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3E3E3E"/>
@@ -187,10 +213,9 @@ README file in the root directory of this source tree.
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="#2D2D2D"/>
<Setter Property="BorderBrush" Value="Gray"/>
<Setter Property="Margin" Value="10"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Width" Value="300"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Width" Value="200"/>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#3E3E3E"/>
@@ -266,17 +291,17 @@ README file in the root directory of this source tree.
<TextBox Grid.Row="0" Grid.Column="2" x:Name="TeamNameTextBox" Text="Really Cool Team" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" MaxLines="1"/>
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideColorCheckBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideColorCheck" Unchecked="OverrideColorCheck">
<Label Content=" Override Team Color" VerticalContentAlignment="Top"></Label>
<Label Content=" Override Color" VerticalContentAlignment="Top"></Label>
</CheckBox>
<TextBox Grid.Row="1" Grid.Column="2" x:Name="TeamColorTextBox" Text="#00ffa5" Width="128" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLength="9" MaxLines="1" TextChanged="ColorTextChanged"/>
<CheckBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideTitleCheckBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideTitleCheck" Unchecked="OverrideTitleCheck">
<Label Content=" Override Team Display Title"></Label>
<Label Content=" Override Display Title"></Label>
</CheckBox>
<TextBox Grid.Row="2" Grid.Column="2" x:Name="TeamTitleTextBox" Text="Teamed" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" x:Name="OverrideSubTitleCheckBox" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" Checked="OverrideSubTitleCheck" Unchecked="OverrideSubTitleCheck">
<Label Content=" Override Team Display Subtitle"></Label>
<Label Content=" Override Display Subtitle"></Label>
</CheckBox>
<TextBox Grid.Row="3" Grid.Column="2" x:Name="TeamSubTitleTextBox" Text="You're in a Custom Team!" Width="720" FontWeight="Bold" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" IsEnabled="False" MaxLines="1"/>
+20 -5
View File
@@ -46,7 +46,8 @@ namespace CustomTeamAssigner
TeamMembersGrid.RowDefinitions.Clear();
TeamMembersGrid.Children.Clear();
for (int i = 0; i < Utils.GetAllValidRoles().Count() / 3 + 1; i++)
int count = Utils.GetAllValidRoles().Count();
for (int i = 0; i < count / 3 + 1; i++)
{
TeamMembersGrid.RowDefinitions.Add(new());
}
@@ -109,7 +110,7 @@ namespace CustomTeamAssigner
return;
}
var role = Enum.Parse<CustomRoles>(((string)MemberComboBox.SelectedItem).GetCustomRole().ToString());
var role = ((string)MemberComboBox.SelectedItem).GetCustomRole();
EditingTeamMembers.Add(role);
MemberComboBox.Items.RemoveAt(MemberComboBox.SelectedIndex);
AddMemberToGrid(role);
@@ -172,9 +173,23 @@ namespace CustomTeamAssigner
TeamMembersGrid.Children.Add(button);
}
void OverrideColorCheck(object sender, RoutedEventArgs e) => TeamColorTextBox.IsEnabled = OverrideColorCheckBox.IsChecked == true;
void OverrideTitleCheck(object sender, RoutedEventArgs e) => TeamTitleTextBox.IsEnabled = OverrideTitleCheckBox.IsChecked == true;
void OverrideSubTitleCheck(object sender, RoutedEventArgs e) => TeamSubTitleTextBox.IsEnabled = OverrideSubTitleCheckBox.IsChecked == true;
void OverrideColorCheck(object sender, RoutedEventArgs e)
{
if (TeamColorTextBox == null) return;
TeamColorTextBox.IsEnabled = OverrideColorCheckBox.IsChecked == true;
}
void OverrideTitleCheck(object sender, RoutedEventArgs e)
{
if (TeamTitleTextBox == null) return;
TeamTitleTextBox.IsEnabled = OverrideTitleCheckBox.IsChecked == true;
}
void OverrideSubTitleCheck(object sender, RoutedEventArgs e)
{
if (TeamSubTitleTextBox == null) return;
TeamSubTitleTextBox.IsEnabled = OverrideSubTitleCheckBox.IsChecked == true;
}
void ColorTextChanged(object sender, TextChangedEventArgs e)
{
+3 -3
View File
@@ -17,11 +17,11 @@ namespace CustomTeamAssigner
{
internal static class Utils
{
public static HashSet<Team> Teams = [];
public static readonly HashSet<Team> Teams = [];
public const string OutputFileName = "CTA_Data.txt";
public static Dictionary<CustomRoles, string> RoleNames = new()
private static readonly Dictionary<CustomRoles, string> RoleNames = new()
{
{ CustomRoles.Hacker, "Anonymous" },
{ CustomRoles.Sans, "Arrogance" },
@@ -97,7 +97,7 @@ namespace CustomTeamAssigner
return list;
}
public static IEnumerable<CustomRoles> GetAllValidRoles() => Enum.GetValues<CustomRoles>().Where(x => !Teams.Any(t => t.TeamMembers.Contains(x)) && !x.ToString().Contains("EHR") && x < CustomRoles.NotAssigned && x is not (CustomRoles.KB_Normal or CustomRoles.Killer or CustomRoles.Tasker or CustomRoles.Potato or CustomRoles.Hider or CustomRoles.Seeker or CustomRoles.Fox or CustomRoles.Troll or CustomRoles.GM or CustomRoles.Convict or CustomRoles.Impostor or CustomRoles.Shapeshifter or CustomRoles.Crewmate or CustomRoles.Engineer or CustomRoles.Scientist or CustomRoles.GuardianAngel));
public static IEnumerable<CustomRoles> GetAllValidRoles() => Enum.GetValues<CustomRoles>().Where(x => !Teams.Any(t => t.TeamMembers.Contains(x)) && !x.ToString().Contains("EHR") && x < CustomRoles.NotAssigned && x is not (CustomRoles.KB_Normal or CustomRoles.Killer or CustomRoles.Tasker or CustomRoles.Potato or CustomRoles.Runner or CustomRoles.CTFPlayer or CustomRoles.NDPlayer or CustomRoles.Hider or CustomRoles.Seeker or CustomRoles.Fox or CustomRoles.Troll or CustomRoles.Jet or CustomRoles.Detector or CustomRoles.Jumper or CustomRoles.Venter or CustomRoles.Locator or CustomRoles.Agent or CustomRoles.Dasher or CustomRoles.GM or CustomRoles.Convict or CustomRoles.Impostor or CustomRoles.Shapeshifter or CustomRoles.Crewmate or CustomRoles.Engineer or CustomRoles.Scientist or CustomRoles.GuardianAngel or CustomRoles.Phantom or CustomRoles.Tracker or CustomRoles.Noisemaker));
public static string GetActualRoleName(CustomRoles role)
{