UI overhaul, achievements are now listed in the GUI

This commit is contained in:
Jeddunk 2022-02-07 10:51:23 +01:00
parent 176479387c
commit 81de24ed29
4 changed files with 108 additions and 47 deletions

View file

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