UI overhaul, achievements are now listed in the GUI

This commit is contained in:
Jeddunk 2022-02-07 10:51:23 +01:00
parent 2b77f9feb0
commit 8eb3b0d60e
4 changed files with 108 additions and 47 deletions

View File

@ -30,7 +30,7 @@ namespace GoldbergGUI.Core.ViewModels
private int _appId; private int _appId;
//private SteamApp _currentGame; //private SteamApp _currentGame;
private List<Achievement> achievements; private ObservableCollection<Achievement> _achievements;
private ObservableCollection<DlcApp> _dlcs; private ObservableCollection<DlcApp> _dlcs;
private string _accountName; private string _accountName;
private long _steamId; private long _steamId;
@ -143,6 +143,16 @@ namespace GoldbergGUI.Core.ViewModels
} }
} }
public ObservableCollection<Achievement> Achievements
{
get => _achievements;
set
{
_achievements = value;
RaisePropertyChanged(() => Achievements);
}
}
public string AccountName public string AccountName
{ {
get => _accountName; get => _accountName;
@ -381,13 +391,14 @@ namespace GoldbergGUI.Core.ViewModels
MainWindowEnabled = false; MainWindowEnabled = false;
StatusText = "Trying to get list of achievements..."; StatusText = "Trying to get list of achievements...";
achievements = await _steam.GetListOfAchievements(new SteamApp { AppId = AppId, Name = GameName }); var listOfAchievements = await _steam.GetListOfAchievements(new SteamApp { AppId = AppId, Name = GameName });
Achievements = new MvxObservableCollection<Achievement>(listOfAchievements);
MainWindowEnabled = true; MainWindowEnabled = true;
if (achievements.Count > 0) if (Achievements.Count > 0)
{ {
var empty = achievements.Count == 1 ? "" : "s"; var empty = Achievements.Count == 1 ? "" : "s";
StatusText = $"Successfully got {achievements.Count} achievement{empty}! Ready."; StatusText = $"Successfully got {Achievements.Count} achievement{empty}! Ready.";
} }
else else
{ {
@ -443,7 +454,7 @@ namespace GoldbergGUI.Core.ViewModels
await _goldberg.Save(dirPath, new GoldbergConfiguration await _goldberg.Save(dirPath, new GoldbergConfiguration
{ {
AppId = AppId, AppId = AppId,
Achievements = achievements.ToList(), Achievements = Achievements.ToList(),
DlcList = DLCs.ToList(), DlcList = DLCs.ToList(),
Offline = Offline, Offline = Offline,
DisableNetworking = DisableNetworking, DisableNetworking = DisableNetworking,
@ -554,7 +565,7 @@ namespace GoldbergGUI.Core.ViewModels
DllPath = "Path to game's steam_api(64).dll..."; DllPath = "Path to game's steam_api(64).dll...";
GameName = "Game name..."; GameName = "Game name...";
AppId = -1; AppId = -1;
achievements = new List<Achievement>(); Achievements = new ObservableCollection<Achievement>();
DLCs = new ObservableCollection<DlcApp>(); DLCs = new ObservableCollection<DlcApp>();
AccountName = "Account name..."; AccountName = "Account name...";
SteamId = -1; SteamId = -1;
@ -575,7 +586,7 @@ namespace GoldbergGUI.Core.ViewModels
private void SetFormFromConfig(GoldbergConfiguration config) private void SetFormFromConfig(GoldbergConfiguration config)
{ {
AppId = config.AppId; AppId = config.AppId;
achievements = new List<Achievement>(config.Achievements); Achievements = new ObservableCollection<Achievement>(config.Achievements);
DLCs = new ObservableCollection<DlcApp>(config.DlcList); DLCs = new ObservableCollection<DlcApp>(config.DlcList);
Offline = config.Offline; Offline = config.Offline;
DisableNetworking = config.DisableNetworking; DisableNetworking = config.DisableNetworking;

View File

@ -32,7 +32,7 @@
<Grid Margin="10,20,10,10"> <Grid Margin="10,20,10,10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto" MaxHeight="0"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition/> <RowDefinition/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
@ -42,41 +42,71 @@
<TextBox Text="{Binding GameName, Mode=TwoWay}" TextWrapping="Wrap" VerticalAlignment="Center" Padding="1,0,0,0" Grid.Row="2" Margin="0,5,215,5" Height="20"/> <TextBox Text="{Binding GameName, Mode=TwoWay}" TextWrapping="Wrap" VerticalAlignment="Center" Padding="1,0,0,0" Grid.Row="2" Margin="0,5,215,5" Height="20"/>
<Button Content="_Find ID..." Command="{Binding FindIdCommand}" Width="80" Grid.Row="2" Margin="0,5,130,5" HorizontalAlignment="Right" Height="20"/> <Button Content="_Find ID..." Command="{Binding FindIdCommand}" Width="80" Grid.Row="2" Margin="0,5,130,5" HorizontalAlignment="Right" Height="20"/>
<TextBox Text="{Binding AppId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="1,0,0,0" Grid.Row="2" Width="125" Margin="0,5,0,5" Height="20"/> <TextBox Text="{Binding AppId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" TextWrapping="Wrap" HorizontalAlignment="Right" VerticalAlignment="Center" Padding="1,0,0,0" Grid.Row="2" Width="125" Margin="0,5,0,5" Height="20"/>
<GroupBox Header="DLC" Grid.Row="3" Padding="0,0,0,0" Margin="0,5,0,0"> <TabControl Grid.Row="3" Margin="0,5,0,0" Padding="0,0,0,0">
<GroupBox.InputBindings> <TabItem Header="DLC">
<KeyBinding Key="V" Modifiers="Control" <TabItem.InputBindings>
Command="{Binding PasteDlcCommand}"/> <KeyBinding Key="V" Modifiers="Control" Command="{Binding PasteDlcCommand}"/>
</GroupBox.InputBindings> </TabItem.InputBindings>
<Grid Margin="10,10,10,10"> <Grid Margin="10,10,10,10">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition/> <RowDefinition/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<DataGrid Margin="0,0,0,5" ItemsSource="{Binding DLCs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectionMode="Extended" SelectionUnit="FullRow" HeadersVisibility="Column" AutoGenerateColumns="False" CanUserResizeColumns="False"> <DataGrid Margin="0,0,0,5" ItemsSource="{Binding DLCs, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" SelectionMode="Extended" SelectionUnit="FullRow" HeadersVisibility="Column" AutoGenerateColumns="False" CanUserResizeColumns="False">
<DataGrid.Columns> <DataGrid.Columns>
<DataGridTextColumn Header="App ID" Binding="{Binding AppId}" Width="80" /> <DataGridTextColumn Header="App ID" Binding="{Binding AppId}" Width="80" />
<DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" /> <DataGridTextColumn Header="Name" Binding="{Binding Name}" Width="*" />
<!--<DataGridTextColumn Header="Depot ID" Binding="{Binding DepotId}" Width="80" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}"/> <!--<DataGridTextColumn Header="Depot ID" Binding="{Binding DepotId}" Width="80" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}"/>
<DataGridTextColumn Header="Depot Name" Binding="{Binding DepotName}" Width="*" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />--> <DataGridTextColumn Header="Depot Name" Binding="{Binding DepotName}" Width="*" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />-->
<DataGridTextColumn Header="App Path" Binding="{Binding AppPath}" Width="*" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" /> <DataGridTextColumn Header="App Path" Binding="{Binding AppPath}" Width="*" Visibility="{Binding Source={x:Reference ShowOptionalDlcSettings}, Path=IsChecked, Converter={StaticResource B2V}}" />
</DataGrid.Columns> </DataGrid.Columns>
</DataGrid> </DataGrid>
<Grid Grid.Row="1"> <Grid Grid.Row="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<CheckBox Grid.Column="1" x:Name="ShowOptionalDlcSettings" Margin="0,5,0,0" Content="Show optional settings"/> <CheckBox x:Name="ShowOptionalDlcSettings" Margin="0,5,0,0" Content="Show optional settings"/>
<Button Grid.Column="1" Content="Get _Achievements for AppID" Command="{Binding GetListOfAchievementsCommand}" Margin="0,5,20,0" Width="200" HorizontalAlignment="Right" /> <Button Grid.Column="2" Content="Get _DLCs for AppID" Command="{Binding GetListOfDlcCommand}" HorizontalAlignment="Right" Margin="0,5,0,0" Height="20" Width="117"/>
<Button Grid.Column="2" Content="Get _DLCs for AppID" Command="{Binding GetListOfDlcCommand}" Width="120" HorizontalAlignment="Right" Margin="0,5,0,0" Height="20"/> </Grid>
</Grid> </Grid>
</Grid> </TabItem>
</GroupBox> <TabItem Header="Achievements" IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}">
<Grid Margin="10,10,10,10">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<DataGrid Margin="0,0,0,5" ItemsSource="{Binding Achievements, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" SelectionMode="Extended" SelectionUnit="FullRow" HeadersVisibility="Column" AutoGenerateColumns="False" CanUserResizeColumns="True" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Header="Name" Binding="{Binding DisplayName}" Width="*"/>
<DataGridTextColumn Header="Description" Binding="{Binding Description}" Width="*"/>
<DataGridCheckBoxColumn Header="Hidden" Binding="{Binding Hidden}" Width="60" CanUserResize="False"/>
</DataGrid.Columns>
</DataGrid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button Grid.Row="1" Grid.Column="1" Content="Get _Achievements for AppID" Command="{Binding GetListOfAchievementsCommand}" Margin="0,5,0,0" HorizontalAlignment="Right" Width="165" />
</Grid>
</Grid>
</TabItem>
<TabItem Header="Misc" IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}">
<StackPanel Margin="10,10,10,10">
<Button Content="_Generate steam__interfaces.txt" IsEnabled="{Binding SteamInterfacesTxtExists, UpdateSourceTrigger=PropertyChanged}" Command="{Binding GenerateSteamInterfacesCommand}" Height="20" Margin="0,0,0,5" />
<CheckBox Content="Offline" IsChecked="{Binding Offline, Mode=TwoWay}" Height="20" VerticalAlignment="Stretch" VerticalContentAlignment="Center"/>
<CheckBox Content="Disable Networking" IsChecked="{Binding DisableNetworking, Mode=TwoWay}" Height="20" VerticalContentAlignment="Center"/>
<CheckBox Content="Disable Overlay" IsChecked="{Binding DisableOverlay, Mode=TwoWay}" Height="20" VerticalContentAlignment="Center" IsEnabled="False"/>
</StackPanel>
</TabItem>
</TabControl>
</Grid> </Grid>
</TabItem> </TabItem>
<!-- Advanced --> <!-- Advanced -->
<TabItem Header="Advanced" IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"> <!--<TabItem Header="Advanced" IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}">
<Grid HorizontalAlignment="Stretch" Margin="10,20,10,10" > <Grid HorizontalAlignment="Stretch" Margin="10,20,10,10" >
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
@ -102,7 +132,7 @@
</StackPanel> </StackPanel>
</GroupBox> </GroupBox>
</Grid> </Grid>
</TabItem> </TabItem>-->
<!-- Settings --> <!-- Settings -->
<TabItem Header="Global Settings"> <TabItem Header="Global Settings">
<StackPanel Margin="10,20,10,10"> <StackPanel Margin="10,20,10,10">
@ -125,7 +155,7 @@
<CheckBox Content="Global" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right" <CheckBox Content="Global" Grid.Row="0" Grid.Column="2" HorizontalAlignment="Right"
Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True" Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True"
IsEnabled="False"/> IsEnabled="False"/>
<!-- <!--
IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/> IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/>
--> -->
<Label Content="Steam64ID" HorizontalAlignment="Left" Grid.Row="1" <Label Content="Steam64ID" HorizontalAlignment="Left" Grid.Row="1"
@ -134,7 +164,7 @@
<CheckBox Content="Global" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right" <CheckBox Content="Global" Grid.Row="1" Grid.Column="2" HorizontalAlignment="Right"
Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True" Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True"
IsEnabled="False"/> IsEnabled="False"/>
<!-- <!--
IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/> IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/>
--> -->
<Label Content="Language" HorizontalAlignment="Left" Grid.Row="2" <Label Content="Language" HorizontalAlignment="Left" Grid.Row="2"
@ -143,7 +173,7 @@
<CheckBox Content="Global" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right" <CheckBox Content="Global" Grid.Row="2" Grid.Column="2" HorizontalAlignment="Right"
Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True" Margin="10,0,5,0" VerticalAlignment="Center" IsChecked="True"
IsEnabled="False"/> IsEnabled="False"/>
<!-- <!--
IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/> IsEnabled="{Binding DllSelected, UpdateSourceTrigger=PropertyChanged}"/>
--> -->
<Label Content="Custom Broadcast Addresses:" HorizontalAlignment="Left" <Label Content="Custom Broadcast Addresses:" HorizontalAlignment="Left"
@ -178,6 +208,8 @@
<TextBlock Text="Developed by Jeddunk" /> <TextBlock Text="Developed by Jeddunk" />
<TextBlock Text="Licensed under GNU GPLv3" /> <TextBlock Text="Licensed under GNU GPLv3" />
<TextBlock Text="Goldberg Emulator is owned by Mr. Goldberg and licensed under GNU LGPLv3" Margin="0,10,0,0"/> <TextBlock Text="Goldberg Emulator is owned by Mr. Goldberg and licensed under GNU LGPLv3" Margin="0,10,0,0"/>
<TextBlock Text="Contributors:" Margin="0,10,0,0" FontWeight="Bold"/>
<TextBlock Text="UrbanCMC" Margin="0,5,0,0"/>
</StackPanel> </StackPanel>
</DataTemplate> </DataTemplate>
</Label.ContentTemplate> </Label.ContentTemplate>

View File

@ -9,6 +9,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GoldbergGUI.WPF", "Goldberg
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamStorefrontAPI", "SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj", "{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SteamStorefrontAPI", "SteamStorefrontAPI\SteamStorefrontAPI\SteamStorefrontAPI.csproj", "{42D17FA4-C45C-4CC1-BA9C-80B3FA1C006D}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E7DA860-D7FD-4090-B7EC-6DA3974DC845}"
ProjectSection(SolutionItems) = preProject
COPYING = COPYING
README.md = README.md
EndProjectSection
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU

View File

@ -30,7 +30,7 @@ While the most used options are available right now, I am planning to support al
* Subscribed Groups * Subscribed Groups
* Mods (Steam Workshop) * Mods (Steam Workshop)
* Inventory and Items * Inventory and Items
* Achievements * ~~Achievements~~
* Stats, Leaderboards * Stats, Leaderboards
* Controller (Steam Input) * Controller (Steam Input)
@ -40,8 +40,20 @@ Apart from those, I'm also always looking into improving the user experience of
Goldberg Emulator is owned by Mr. Goldberg and licensed under the GNU Lesser General Public License v3.0. Goldberg Emulator is owned by Mr. Goldberg and licensed under the GNU Lesser General Public License v3.0.
### Contributors
* [UrbanCMC](https://github.com/UrbanCMC/) - Implementation of achievements
### Dependencies
* AngleSharp
* MvvmCross
* NinjaNye
* Serilog
* SharpCompress
* sqlite-net-pcl
* My fork of SteamStorefrontAPI
## License ## License
GoldbergGUI is licensed under the GNU General Public License v3.0. GoldbergGUI is licensed under the GNU General Public License v3.0.
Dependencies will be listed ASAP.