Skip to content

Commit

Permalink
🐛 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rmbadmin committed Nov 15, 2023
1 parent fdaf795 commit 2df32c6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 30 deletions.
1 change: 0 additions & 1 deletion src/BD.WTTS.Client.Plugins.SteamIdleCard/Plugins/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using BD.WTTS.Properties;
using BD.WTTS.UI.Views.Pages;
using BD.WTTS.UI.Views.Windows;

namespace BD.WTTS.Plugins;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using BD.SteamClient.Models.Idle;
using BD.SteamClient.Services;
using BD.WTTS.UI.Views.Pages;
using System.Linq;

namespace BD.WTTS.UI.ViewModels;

Expand Down Expand Up @@ -183,28 +184,20 @@ private async Task SteamAppsSort()
return;
}

var appid_sorts = Enumerable.Empty<int>();
switch (IdleSequentital)
var apps = Enumerable.Empty<SteamApp>();
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);
}

Expand Down Expand Up @@ -236,7 +229,7 @@ private void StartIdle()
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);
Expand All @@ -251,7 +244,7 @@ private void StartIdle()
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);
Expand Down Expand Up @@ -426,7 +419,7 @@ private async Task AutoNextTask()
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
Spacing="6">
<TextBlock FontWeight="SemiBold">
<TextBlock.Text>

<MultiBinding Converter="{StaticResource StringFormatConverter}">
<CompiledBinding
Mode="OneWay"
Expand All @@ -106,7 +105,8 @@
<ProgressBar
Height="10"
Classes="Material"
Value="50" />
Maximum="100"
Value="{Binding UserIdleInfo.NextLevelExpPercentage}" />

<Border
Height="1"
Expand Down Expand Up @@ -162,8 +162,8 @@
Spacing="6">
<Panel>
<ProgressBar
Width="100"
Height="100"
Width="80"
Height="80"
Classes="Circle"
Value="60" />
<TextBlock
Expand All @@ -176,7 +176,7 @@
Grid.Row="2"
Grid.Column="1"
TextAlignment="Center">
<Run FontSize="36" Text="{Binding IdleGameList.Count}" />
<Run FontSize="24" Text="{Binding IdleGameList.Count}" />
<Run Text=" 个游戏可掉落卡牌" />
</TextBlock>
</StackPanel>
Expand All @@ -202,7 +202,10 @@
<ItemsControl.ItemTemplate>
<DataTemplate DataType="spp:SteamApp">
<Border Margin="5" spp:Animations.EnableAnimations="True">
<spp:AppItem Title="{Binding DisplayName}" MaxHeight="150">
<spp:AppItem
Title="{Binding DisplayName}"
Width="280"
MaxHeight="150">
<spp:AppItem.Status>
<Border Classes="Status">
<Panel>
Expand Down

0 comments on commit 2df32c6

Please sign in to comment.