private void LoadData(Game GameSelected) { Guid GameId = GameSelected.Id; GameAchievements successStories = PluginDatabase.Get(GameSelected); List <Achievements> ListAchievements = successStories.Items; List <GameStats> ListGameStats = successStories.ItemsStats; // List Achievements SuccessStoryAchievementsList successStoryAchievementsList = new SuccessStoryAchievementsList(true); successStoryAchievementsList.SetScData(successStories); PART_Achievements_List.Children.Add(successStoryAchievementsList); // Chart achievements int limit = 0; if (!PluginDatabase.PluginSettings.GraphicAllUnlockedByDay) { PART_ChartTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitle"); limit = 20; } else { PART_ChartTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitleDay"); limit = 16; } PluginDatabase.PluginSettings.IgnoreSettings = true; SuccessStoryAchievementsGraphics successStoryAchievementsGraphics = new SuccessStoryAchievementsGraphics(); successStoryAchievementsGraphics.SetScData(GameId, limit); PART_Achievements_Graphics.Children.Add(successStoryAchievementsGraphics); // User stats SuccessStoryUserStats successStoryUserStats = new SuccessStoryUserStats(); successStoryUserStats.SetScData(ListGameStats); PART_ScUserStats.Children.Add(successStoryUserStats); }
/// <summary> /// Show Achievements for the selected game. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ListviewGames_SelectionChanged(object sender, SelectionChangedEventArgs e) { ListViewGames GameSelected = (ListViewGames)((ListBox)sender).SelectedItem; if (GameSelected != null) { listAchievementBorder.BorderThickness = new Thickness(0); Guid GameId = Guid.Parse(GameSelected.Id); GameAchievements successStories = PluginDatabase.Get(GameId); List <Achievements> ListAchievements = successStories.Items; SuccessStory_Achievements_List.Children.Clear(); SuccessStoryAchievementsList successStoryAchievementsList = new SuccessStoryAchievementsList(true); successStoryAchievementsList.SetScData(successStories, true); SuccessStory_Achievements_List.Children.Add(successStoryAchievementsList); int limit = 0; if (!PluginDatabase.PluginSettings.GraphicAllUnlockedByDay) { GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitle"); } else { GraphicTitle.Content = resources.GetString("LOCSuccessStoryGraphicTitleDay"); limit = 8; } SuccessStory_Achievements_Graphics_Game.Children.Clear(); PluginDatabase.PluginSettings.IgnoreSettings = true; SuccessStoryAchievementsGraphics successStoryAchievementsGraphics = new SuccessStoryAchievementsGraphics(); successStoryAchievementsGraphics.SetScData(GameId, limit); SuccessStory_Achievements_Graphics_Game.Children.Add(successStoryAchievementsGraphics); } }
public SuccessView(SuccessStory plugin, IPlayniteAPI PlayniteApi, string PluginUserDataPath, bool isRetroAchievements = false, Game GameSelected = null) { _plugin = plugin; _PlayniteApi = PlayniteApi; _PlayniteApiDatabase = PlayniteApi.Database; _PlayniteApiPaths = PlayniteApi.Paths; _PluginUserDataPath = PluginUserDataPath; InitializeComponent(); PART_DataLoad.Visibility = Visibility.Visible; PART_Data.Visibility = Visibility.Hidden; var TaskView = Task.Run(() => { GetListGame(); SetGraphicsAchievementsSources(); this.Dispatcher.BeginInvoke((Action) delegate { // Block hidden column. lvProgressionValue.IsEnabled = false; lvSourceName.IsEnabled = false; pbProgressionGlobalCount.Value = PluginDatabase.Progession().Unlocked; pbProgressionGlobalCount.Maximum = PluginDatabase.Progession().Total; labelProgressionGlobalCount.Content = PluginDatabase.Progession().Progression + "%"; pbProgressionLaunchedCount.Value = PluginDatabase.ProgessionLaunched().Unlocked; pbProgressionLaunchedCount.Maximum = PluginDatabase.ProgessionLaunched().Total; labelProgressionLaunchedCount.Content = PluginDatabase.ProgessionLaunched().Progression + "%"; GraphicTitle.Content = string.Empty; // lvGames options if (!PluginDatabase.PluginSettings.lvGamesIcon100Percent) { lvGameIcon100Percent.Width = 0; } if (!PluginDatabase.PluginSettings.lvGamesIcon) { lvGameIcon.Width = 0; } if (!PluginDatabase.PluginSettings.lvGamesName) { lvGameName.Width = 0; } if (!PluginDatabase.PluginSettings.lvGamesLastSession) { lvGameLastActivity.Width = 0; } if (!PluginDatabase.PluginSettings.lvGamesSource) { lvGamesSource.Width = 0; } if (!PluginDatabase.PluginSettings.lvGamesProgression) { lvGameProgression.Width = 0; } int limit = 5; GraphicTitleALL.Content = resources.GetString("LOCSuccessStoryGraphicTitleALL"); SuccessStory_Achievements_Graphics.Children.Clear(); PluginDatabase.PluginSettings.IgnoreSettings = true; SuccessStoryAchievementsGraphics successStoryAchievementsGraphics = new SuccessStoryAchievementsGraphics(); successStoryAchievementsGraphics.SetScData(null, limit, true); SuccessStory_Achievements_Graphics.Children.Add(successStoryAchievementsGraphics); SuccessStory_Achievements_Graphics.UpdateLayout(); // Set game selected if (GameSelected != null) { for (int i = 0; i < ListviewGames.Items.Count; i++) { if (((ListViewGames)ListviewGames.Items[i]).Name == GameSelected.Name) { ListviewGames.SelectedIndex = i; } } } ListviewGames.ScrollIntoView(ListviewGames.SelectedItem); string icon = string.Empty; if (PluginDatabase.PluginSettings.EnableRetroAchievementsView && PluginDatabase.PluginSettings.EnableRetroAchievements) { if (isRetroAchievements) { PART_GraphicBySource.Visibility = Visibility.Collapsed; Grid.SetColumn(PART_GraphicAllUnlocked, 0); Grid.SetColumnSpan(PART_GraphicAllUnlocked, 3); if (PluginDatabase.PluginSettings.EnableRetroAchievements) { icon = TransformIcon.Get("RetroAchievements") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "RetroAchievements", SourceNameShort = "RetroAchievements", IsCheck = false }); } } else { if (PluginDatabase.PluginSettings.EnableLocal) { icon = TransformIcon.Get("Playnite") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Playnite", SourceNameShort = "Playnite", IsCheck = false }); icon = TransformIcon.Get("Hacked") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Hacked", SourceNameShort = "Hacked", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableSteam) { icon = TransformIcon.Get("Steam") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Steam", SourceNameShort = "Steam", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableGog) { icon = TransformIcon.Get("GOG") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "GOG", SourceNameShort = "GOG", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableOrigin) { icon = TransformIcon.Get("Origin") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Origin", SourceNameShort = "Origin", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableXbox) { icon = TransformIcon.Get("Xbox") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Xbox", SourceNameShort = "Xbox", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableRpcs3Achievements) { icon = TransformIcon.Get("Rpcs3") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Rpcs3", SourceNameShort = "Rpcs3", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableManual) { icon = TransformIcon.Get("Manual") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Manual", SourceNameShort = "Manual", IsCheck = false }); } } } else { if (PluginDatabase.PluginSettings.EnableLocal) { icon = TransformIcon.Get("Playnite") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Playnite", SourceNameShort = "Playnite", IsCheck = false }); icon = TransformIcon.Get("Hacked") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Hacked", SourceNameShort = "Hacked", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableSteam) { icon = TransformIcon.Get("Steam") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Steam", SourceNameShort = "Steam", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableGog) { icon = TransformIcon.Get("GOG") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "GOG", SourceNameShort = "GOG", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableOrigin) { icon = TransformIcon.Get("Origin") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Origin", SourceNameShort = "Origin", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableXbox) { icon = TransformIcon.Get("Xbox") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Xbox", SourceNameShort = "Xbox", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableRetroAchievements) { icon = TransformIcon.Get("RetroAchievements") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "RetroAchievements", SourceNameShort = "RetroAchievements", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableRpcs3Achievements) { icon = TransformIcon.Get("RPCS3") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "RPCS3", SourceNameShort = "Rpcs3", IsCheck = false }); } if (PluginDatabase.PluginSettings.EnableManual) { icon = TransformIcon.Get("Manual") + " "; FilterSourceItems.Add(new ListSource { SourceName = ((icon.Length == 2) ? icon : string.Empty) + "Manual", SourceNameShort = "Manual", IsCheck = false }); } } FilterSource.ItemsSource = FilterSourceItems; // Set Binding data DataContext = this; PART_DataLoad.Visibility = Visibility.Hidden; PART_Data.Visibility = Visibility.Visible; }); }); }