From 2df32c67d0779da2c8a08fa9663bc033e3158fbd Mon Sep 17 00:00:00 2001 From: RMBGAME Date: Wed, 15 Nov 2023 19:28:16 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ref/SteamClient | 2 +- .../Plugins/Plugin.cs | 1 - .../UI/ViewModels/IdleCardPageViewModel.cs | 37 ++++++++----------- .../UI/Views/Pages/IdleCardPage.axaml | 15 +++++--- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/ref/SteamClient b/ref/SteamClient index 68e9495aa..4cc2cfe4c 160000 --- a/ref/SteamClient +++ b/ref/SteamClient @@ -1 +1 @@ -Subproject commit 68e9495aa5081db10e2713fc83f440a487023ea4 +Subproject commit 4cc2cfe4c95bbdfb22311ad0e48a89f530fc91ed diff --git a/src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs b/src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs index 90d4a308b..9e884d545 100644 --- a/src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs +++ b/src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs @@ -1,6 +1,5 @@ using BD.WTTS.Properties; using BD.WTTS.UI.Views.Pages; -using BD.WTTS.UI.Views.Windows; namespace BD.WTTS.Plugins; diff --git a/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs b/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs index 9dd8ed934..d15b7e84e 100644 --- a/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs +++ b/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/ViewModels/IdleCardPageViewModel.cs @@ -2,6 +2,7 @@ using BD.SteamClient.Models; using BD.SteamClient.Models.Idle; using BD.SteamClient.Services; using BD.WTTS.UI.Views.Pages; +using System.Linq; namespace BD.WTTS.UI.ViewModels; @@ -183,28 +184,20 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase return; } - var appid_sorts = Enumerable.Empty(); - switch (IdleSequentital) + var apps = Enumerable.Empty(); + apps = IdleSequentital switch { - case IdleSequentital.LeastCards: - appid_sorts = Badges.OrderBy(o => o.CardsRemaining).Select(s => s.AppId); - break; - case IdleSequentital.Mostcards: - appid_sorts = Badges.OrderByDescending(o => o.CardsRemaining).Select(s => s.AppId); - break; - case IdleSequentital.Mostvalue: - appid_sorts = Badges.OrderByDescending(o => o.RegularAvgPrice).Select(s => s.AppId); - break; - default: - appid_sorts = Badges.Select(s => s.AppId); - break; - } + IdleSequentital.LeastCards => Badges.OrderBy(o => o.CardsRemaining).Select(s => new SteamApp(s.AppId) { Name = s.AppName }), + IdleSequentital.Mostcards => Badges.OrderByDescending(o => o.CardsRemaining).Select(s => new SteamApp(s.AppId) { Name = s.AppName }), + IdleSequentital.Mostvalue => Badges.OrderByDescending(o => o.RegularAvgPrice).Select(s => new SteamApp(s.AppId) { Name = s.AppName }), + _ => Badges.Select(s => new SteamApp(s.AppId) { Name = s.AppName }), + }; //不应该使用 SteamConnectService 的 apps - var apps = SteamConnectService.Current.SteamApps.Items - .Where(x => appid_sorts.Contains((int)x.AppId)) - .OrderBy(o => appid_sorts.ToList().FindIndex(x => x == o.AppId)) - .ToList(); + //var apps = SteamConnectService.Current.SteamApps.Items + // .Where(x => appid_sorts.Contains((int)x.AppId)) + // .OrderBy(o => appid_sorts.ToList().FindIndex(x => x == o.AppId)) + // .ToList(); IdleGameList.Add(apps); } @@ -236,7 +229,7 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase if (IdleRule == IdleRule.OneThenMany) { var canIdles = Badges.Where(z => z.MinutesPlayed / 60 >= MinRunTime).Select(s => s.AppId); - var multi = IdleGameList.Where(x => canIdles.Contains((int)x.AppId)); + var multi = IdleGameList.Where(x => canIdles.Contains(x.AppId)); if (multi.Count() >= 1) { PauseAutoNext(false); @@ -251,7 +244,7 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase else { var canIdles = Badges.Where(z => z.MinutesPlayed / 60 < MinRunTime).Select(s => s.AppId); - var multi = IdleGameList.Where(x => canIdles.Contains((int)x.AppId)); + var multi = IdleGameList.Where(x => canIdles.Contains(x.AppId)); if (multi.Count() >= 2) { PauseAutoNext(true); @@ -426,7 +419,7 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase CancellationTokenSource.Cancel(); return; } - if (Badges.Where(x => IdleGameList.Select(s => (int)s.AppId).Contains(x.AppId)).Sum(s => s.CardsRemaining) == 0) + if (Badges.Where(x => IdleGameList.Select(s => s.AppId).Contains(x.AppId)).Sum(s => s.CardsRemaining) == 0) { CancellationTokenSource.Cancel(); if (IsReloaded == false) diff --git a/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/Views/Pages/IdleCardPage.axaml b/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/Views/Pages/IdleCardPage.axaml index e49788849..d309f9167 100644 --- a/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/Views/Pages/IdleCardPage.axaml +++ b/src/BD.WTTS.Client.Plugins.SteamIdleCard/UI/Views/Pages/IdleCardPage.axaml @@ -91,7 +91,6 @@ Spacing="6"> - + Maximum="100" + Value="{Binding UserIdleInfo.NextLevelExpPercentage}" /> - + @@ -202,7 +202,10 @@ - +