Skip to content

Commit

Permalink
Merge prepare-release into develop
Browse files Browse the repository at this point in the history
Completed some points on the release preperation list
  • Loading branch information
Yelo420 authored Dec 12, 2023
2 parents 8a3323c + 0bb7252 commit 470b5a3
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 37 deletions.
28 changes: 23 additions & 5 deletions gamevault/Converter/StringToColorConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,33 @@ internal class StringToColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
int hash = value.GetHashCode();
if (value is string stringValue)
{
int hashCode = stringValue.GetHashCode();
Color generatedColor = GenerateColor(hashCode);
SolidColorBrush brush = new SolidColorBrush(generatedColor);
brush.Freeze();
return brush;
}
return Brushes.Black;
}

private Color GenerateColor(int numericValue)
{
byte red = (byte)((numericValue >> 16) & 0xFF);
byte green = (byte)((numericValue >> 8) & 0xFF);
byte blue = (byte)(numericValue & 0xFF);

byte red = (byte)(hash & 0xFF);
byte green = (byte)((hash >> 8) & 0xFF);
byte blue = (byte)((hash >> 16) & 0xFF);
// Darken the color by reducing each component by a fixed amount
const int darkeningAmount = 10;
red = (byte)Math.Max(0, red - darkeningAmount);
green = (byte)Math.Max(0, green - darkeningAmount);
blue = (byte)Math.Max(0, blue - darkeningAmount);

return new SolidColorBrush(Color.FromRgb(red, green, blue));
return Color.FromRgb(red, green, blue);
}


public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return Colors.White;
Expand Down
2 changes: 1 addition & 1 deletion gamevault/Resources/Assets/Icons.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<Geometry x:Key="IconGameSettingsEditImages">
M18 15v4c0 .55-.45 1-1 1H5c-.55 0-1-.45-1-1V7c0-.55.45-1 1-1h3.02c.55 0 1-.45 1-1s-.45-1-1-1H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-5c0-.55-.45-1-1-1s-1 .45-1 1zm-2.5 3H6.52c-.42 0-.65-.48-.39-.81l1.74-2.23a.5.5 0 0 1 .78-.01l1.56 1.88l2.35-3.02c.2-.26.6-.26.79.01l2.55 3.39c.25.32.01.79-.4.79zm3.8-9.11c.48-.77.75-1.67.69-2.66c-.13-2.15-1.84-3.97-3.97-4.2A4.5 4.5 0 0 0 11 6.5c0 2.49 2.01 4.5 4.49 4.5c.88 0 1.7-.26 2.39-.7l2.41 2.41c.39.39 1.03.39 1.42 0c.39-.39.39-1.03 0-1.42l-2.41-2.4zM15.5 9a2.5 2.5 0 0 1 0-5a2.5 2.5 0 0 1 0 5z
</Geometry>
<Geometry x:Key="IconGameSettingsRemap">
<Geometry x:Key="IconGameSettingsRawg">
m20.5 3l-.16.03L15 5.1L9 3L3.36 4.9c-.21.07-.36.25-.36.48V20.5c0 .28.22.5.5.5l.16-.03L9 18.9l6 2.1l5.64-1.9c.21-.07.36-.25.36-.48V3.5c0-.28-.22-.5-.5-.5zM10 5.47l4 1.4v11.66l-4-1.4V5.47zm-5 .99l3-1.01v11.7l-3 1.16V6.46zm14 11.08l-3 1.01V6.86l3-1.16v11.84z
</Geometry>
<Geometry x:Key="IconGameSettingsLink">
Expand Down
7 changes: 2 additions & 5 deletions gamevault/UserControls/AdminConsoleUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@
</Style>
</Grid.Style>

<local:CacheImage ImageCacheType="UserIcon" Data="{Binding}" Width="6" HorizontalAlignment="Left" Cursor="Hand" MouseLeftButtonUp="ShowUser_Click">
<local:CacheImage.Clip>
<EllipseGeometry RadiusX="3" RadiusY="3" Center="3,3"/>
</local:CacheImage.Clip>
<local:CacheImage ImageCacheType="UserIcon" Data="{Binding}" Width="6" CornerRadius="0.5" HorizontalAlignment="Left" Cursor="Hand" MouseLeftButtonUp="ShowUser_Click">
</local:CacheImage>

<TextBlock FontSize="2" Margin="8,0,0,0" Text="{Binding Path=Username}" VerticalAlignment="Center"/>
Expand All @@ -89,7 +86,7 @@
<ComboBox ItemsSource="{Binding Path=DataContext.PermissionRoleEnumTypes,RelativeSource={RelativeSource AncestorType=UserControl}}" SelectedItem="{Binding Path=Role}" SelectionChanged="PermissionRole_SelectionChanged"/>
</Viewbox>

<TextBlock FontSize="2" Margin="0,0,5,0" Text="" HorizontalAlignment="Right" VerticalAlignment="Center" Cursor="Hand" ToolTip="Edit user" MouseLeftButtonUp="EditUser_Clicked"/>
<TextBlock FontSize="2" Margin="0,0,5,0" Text="" HorizontalAlignment="Right" VerticalAlignment="Center" Cursor="Hand" ToolTip="Edit user" MouseLeftButtonUp="EditUser_Clicked"/>

<TextBlock FontSize="2" Margin="0,0,1,0" HorizontalAlignment="Right" VerticalAlignment="Center" Cursor="Hand" MouseLeftButtonUp="DeleteUser_Clicked">
<TextBlock.Style>
Expand Down
13 changes: 4 additions & 9 deletions gamevault/UserControls/CommunityUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,8 @@
<Viewbox Grid.Column="1" Grid.Row="0" HorizontalAlignment="Left">
<Grid>
<Grid>
<Border CornerRadius="100" Height="130" Width="130" Margin="-340,5,0,0">
<local:CacheImage ImageCacheType="UserIcon" Data="{Binding Path=CurrentShownUser}">
<local:CacheImage.Clip>
<EllipseGeometry RadiusX="65" RadiusY="65" Center="65,65"/>
</local:CacheImage.Clip>
</local:CacheImage>
</Border>
<local:CacheImage Height="130" Width="130" Margin="-340,5,0,0" ImageCacheType="UserIcon" CornerRadius="5" Data="{Binding Path=CurrentShownUser}">
</local:CacheImage>
<Border Background="{StaticResource MahApps.Brushes.Accent}" Width="46" Height="23" Padding="3" CornerRadius="10" Margin="145,70,0,0" HorizontalAlignment="Left">
<TextBlock Text="{Binding Path=CurrentShownUser.Role}" TextAlignment="Center"/>
</Border>
Expand All @@ -57,9 +52,9 @@
</Grid>
<Grid HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,5,5,0">

<TextBlock Text="" Cursor="Hand" ToolTip="Edit User" MouseLeftButtonUp="UserEdit_Clicked" Visibility="{Binding SelectedIndex,ElementName=uiSelectUser,Converter={StaticResource roleToVisConv}}" HorizontalAlignment="Right" Margin="0,2,5,0"/>
<TextBlock Text="" Cursor="Hand" ToolTip="Edit User" MouseLeftButtonUp="UserEdit_Clicked" Visibility="{Binding SelectedIndex,ElementName=uiSelectUser,Converter={StaticResource roleToVisConv}}" HorizontalAlignment="Right" Margin="0,2,5,0"/>
<TextBlock Text="" Cursor="Hand" ToolTip="Reload user" MouseLeftButtonUp="ReloadUser_Clicked" HorizontalAlignment="Right" Margin="0,-8,25,0" FontSize="24"/>

<Canvas x:Name="uiUserEditPopup" Margin="48,0,0,0"/>
</Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="320,0,10,0">
Expand Down
8 changes: 4 additions & 4 deletions gamevault/UserControls/GameSettingsUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
<TabItem>
<TabItem.Header>
<StackPanel Orientation="Horizontal">
<Path Style="{StaticResource TabItemHeaderPath}" Data="{DynamicResource IconGameSettingsRemap}" VerticalAlignment="Center"/>
<TextBlock Style="{StaticResource TabItemHeaderTextBlock}" Text="Remap Game"/>
<Path Style="{StaticResource TabItemHeaderPath}" Data="{DynamicResource IconGameSettingsRawg}" VerticalAlignment="Center"/>
<TextBlock Style="{StaticResource TabItemHeaderTextBlock}" Text="RAWG Integration"/>
</StackPanel>
</TabItem.Header>
</TabItem>
Expand Down Expand Up @@ -298,8 +298,8 @@
<mah:MetroTabItem>
<StackPanel Margin="20,20,0,0">
<StackPanel Orientation="Horizontal">
<Path Data="{DynamicResource IconGameSettingsRemap}" Fill="White" VerticalAlignment="Center"/>
<TextBlock Text="Remap Game" FontSize="20" FontWeight="Bold" Margin="5,0,0,0"/>
<Path Data="{DynamicResource IconGameSettingsRawg}" Fill="White" VerticalAlignment="Center"/>
<TextBlock Text="RAWG Integration" FontSize="20" FontWeight="Bold" Margin="5,0,0,0"/>
</StackPanel>
<TextBlock Text="Here, you can remap your games to other RAWG games or recache all information for them from the RAWG database." FontSize="15" Margin="0,5,0,0"/>
<StackPanel Margin="0,10,0,0">
Expand Down
2 changes: 1 addition & 1 deletion gamevault/UserControls/NewGameViewUserControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@
<DataTemplate>
<Border CornerRadius="5" Background="#33000000" Padding="0" Margin="0,0,0,10" Height="50">
<Grid Margin="5">
<local:CacheImage Data="{Binding User}" Stretch="Fill" ImageCacheType="UserIcon" CornerRadius="5" HorizontalAlignment="Left" VerticalAlignment="Center" Width="40"/>
<local:CacheImage Data="{Binding User}" Stretch="Fill" ImageCacheType="UserIcon" CornerRadius="5" HorizontalAlignment="Left" VerticalAlignment="Center" Width="40" Cursor="Hand" MouseLeftButtonUp="ShowProgressUser_Click"/>
<TextBlock Text="{Binding Path=User.Username}" FontSize="10" HorizontalAlignment="Left" Margin="50,0,0,0" VerticalAlignment="Center"/>
<TextBlock Text="{Binding MinutesPlayed,Converter={StaticResource timeConv}}" FontSize="10" HorizontalAlignment="Left" Margin="135,0,0,0" VerticalAlignment="Center"/>
<TextBlock FontSize="10" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,140,0">
Expand Down
10 changes: 10 additions & 0 deletions gamevault/UserControls/NewGameViewUserControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,16 @@ await Task.Run(() =>
});
}
}

private void ShowProgressUser_Click(object sender, MouseButtonEventArgs e)
{
Progress selectedProgress = ((FrameworkElement)sender).DataContext as Progress;
if (selectedProgress != null)
{
MainWindowViewModel.Instance.Community.ShowUser(selectedProgress.User);
}
}

public void RefreshGame(Game game)
{
ViewModel.Game = game;
Expand Down
12 changes: 6 additions & 6 deletions gamevault/ViewModels/NewLibraryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ public Dictionary<string, string> GameFilterSortByValues
{
var dict = new Dictionary<string, string>
{
{"Game title","title"},
{"Game size","size" },
{"Game release date","rawg_release_date" },
{"Game rating","metacritic_rating" },
{"Game average playtime","average_playtime" },
{"Recently added","created_at" }
{"Title","title"},
{"Size","size" },
{"Recently Added","created_at" },
{"Release Date","release_date" },
{"Metacritic Rating","metacritic_rating" },
{"Average Playtime","average_playtime" },
};
return dict;
}
Expand Down
12 changes: 6 additions & 6 deletions gamevault/ViewModels/OldControls/LibraryViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public Dictionary<string, string> GameFilterSortByValues
{
var dict = new Dictionary<string, string>
{
{"Game title","title"},
{"Game size","size" },
{"Game release date","rawg_release_date" },
{"Game rating","metacritic_rating" },
{"Game average playtime","average_playtime" },
{"Recently added","created_at" }
{"Title","title"},
{"Size","size" },
{"Recently Added","created_at" },
{"Release Date","release_date" },
{"Metacritic Rating","metacritic_rating" },
{"Average Playtime","average_playtime" },
};
return dict;
}
Expand Down
2 changes: 2 additions & 0 deletions gamevault/Windows/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
<Button Click="WindowCommand_Clicked" Content="💸 Kofi" FontSize="18" Cursor="Hand" Tag="https://ko-fi.com/phalcode"/>
<Button Click="WindowCommand_Clicked" Content="💬 Discord" FontSize="18" Cursor="Hand" Tag="https://discord.com/invite/NEdNen2dSu"/>
<Button Click="WindowCommand_Clicked" Content="📜 Documentation" FontSize="18" Cursor="Hand" Tag="https://gamevau.lt/docs/intro"/>
<Button Click="WindowCommand_Clicked" Content="🧑‍💻 Github" FontSize="18" Cursor="Hand" Tag="https://github.com/orgs/Phalcode/repositories"/>
<Button Click="WindowCommand_Clicked" Content="⚠️ Bug Report" FontSize="18" Cursor="Hand" Tag="https://github.com/Phalcode/gamevault-app/issues/new/choose"/>
</mah:WindowCommands>
</mah:MetroWindow.RightWindowCommands>
<Grid>
Expand Down

0 comments on commit 470b5a3

Please sign in to comment.