mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
✨ Idle Complete
This commit is contained in:
@@ -3,7 +3,7 @@ using BD.SteamClient.Models;
|
||||
using BD.SteamClient.Models.Idle;
|
||||
using BD.SteamClient.Services;
|
||||
using BD.WTTS.UI.Views.Pages;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using BD.SteamClient.Constants;
|
||||
|
||||
namespace BD.WTTS.UI.ViewModels;
|
||||
|
||||
@@ -50,9 +50,12 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase
|
||||
}
|
||||
});
|
||||
|
||||
//this.ChangeState = ReactiveCommand.Create<int>(i =>
|
||||
//{
|
||||
//});
|
||||
NavAppToSteamViewCommand = ReactiveCommand.Create<uint>((appid) =>
|
||||
{
|
||||
var url = string.Format(SteamApiUrls.STEAM_NAVGAME_URL, appid);
|
||||
Process2.Start(url, useShellExecute: true);
|
||||
});
|
||||
OpenLinkUrlCommand = ReactiveCommand.Create<string>(async url => await Browser2.OpenAsync(url));
|
||||
}
|
||||
|
||||
public override void Activation()
|
||||
@@ -102,7 +105,7 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase
|
||||
{
|
||||
//await SteamConnectService.Current.RefreshGamesListAsync();
|
||||
RunState = await ReadyToGoIdle();
|
||||
RunOrStopAutoNext(SteamIdleSettings.IsAutoNextOn);
|
||||
RunOrStopAutoNext(SteamIdleSettings.IsAutoNextOn.Value);
|
||||
RunOrStopAutoCardDropCheck(true);
|
||||
}
|
||||
else
|
||||
@@ -224,7 +227,6 @@ public sealed partial class IdleCardPageViewModel : ViewModelBase
|
||||
|
||||
foreach (var badge in badges)
|
||||
{
|
||||
|
||||
TotalCardsAvgPrice += badge.RegularAvgPrice * badge.CardsRemaining;
|
||||
TotalCardsRemaining += badge.CardsRemaining;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,10 @@ public sealed partial class IdleCardPageViewModel
|
||||
|
||||
//public ICommand ChangeState { get; }
|
||||
|
||||
public ICommand NavAppToSteamViewCommand { get; }
|
||||
|
||||
public ICommand OpenLinkUrlCommand { get; }
|
||||
|
||||
[Reactive]
|
||||
public bool IsLogin { get; set; }
|
||||
|
||||
@@ -56,6 +60,8 @@ public sealed partial class IdleCardPageViewModel
|
||||
[Reactive]
|
||||
public int TotalCardsRemaining { get; set; }
|
||||
|
||||
public int DropCardsCount => DroppedCardsCount - TotalCardsRemaining;
|
||||
|
||||
[Reactive]
|
||||
public decimal TotalCardsAvgPrice { get; set; }
|
||||
|
||||
|
||||
+5
-5
@@ -77,10 +77,10 @@ public sealed partial class IdleSteamLoginPageViewModel : WindowViewModel
|
||||
if (!string.IsNullOrEmpty(SeesionId) && !string.IsNullOrEmpty(SteamLoginSecure))
|
||||
{
|
||||
var temps = SteamLoginSecure.Split(SteamLoginSecure.Contains("||") ? "||" : "%7C%7C");
|
||||
if (temps.Length == 2)
|
||||
if (temps.Length == 2 && ulong.TryParse(temps[0], out var steamid))
|
||||
{
|
||||
var steamid = temps[0];
|
||||
var accecstoken = temps[1];
|
||||
SteamLoginState.SteamId = steamid;
|
||||
SteamLoginState.AccessToken = temps[1];
|
||||
var cookieContainer = new CookieContainer();
|
||||
cookieContainer.Add(new Cookie("steamLoginSecure", SteamLoginSecure, "/", "steamcommunity.com"));
|
||||
cookieContainer.Add(new Cookie("sessionid", SeesionId, "/", "steamcommunity.com"));
|
||||
@@ -88,8 +88,8 @@ public sealed partial class IdleSteamLoginPageViewModel : WindowViewModel
|
||||
cookieContainer.Add(new Cookie("sessionid", SeesionId, "/", "steampowered.com"));
|
||||
SteamSession session = new SteamSession()
|
||||
{
|
||||
SteamId = steamid,
|
||||
AccessToken = accecstoken,
|
||||
SteamId = steamid.ToString(),
|
||||
AccessToken = SteamLoginState.AccessToken,
|
||||
RefreshToken = string.Empty,
|
||||
CookieContainer = cookieContainer,
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
Text="优先运行此游戏" />
|
||||
<ui:MenuFlyoutSeparator />
|
||||
<ui:MenuFlyoutItem
|
||||
Command="{ReflectionBinding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).NavAppToSteamViewCommand}"
|
||||
Command="{Binding $parent[spp:PageBase].((spp:IdleCardPageViewModel)DataContext).NavAppToSteamViewCommand}"
|
||||
CommandParameter="{Binding App}"
|
||||
Text="{Binding Path=Res.GameList_NavToSteamView, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
|
||||
<ui:MenuFlyoutItem.IconSource>
|
||||
@@ -39,12 +39,17 @@
|
||||
</ui:MenuFlyoutItem.IconSource>
|
||||
</ui:MenuFlyoutItem>
|
||||
<ui:MenuFlyoutSubItem Text="{Binding Path=Res.OpenLink, Mode=OneWay, Source={x:Static s:ResourceService.Current}}">
|
||||
<ui:MenuFlyoutItem IconSource="Link" Text="{Binding Path=Res.GameList_OpenStoreUrl, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
<ui:MenuFlyoutItem
|
||||
Click="AppOpenLink_MenuItem_Click"
|
||||
IconSource="Link"
|
||||
Text="{Binding Path=Res.GameList_OpenStoreUrl, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
<ui:MenuFlyoutItem
|
||||
Click="AppOpenLink_MenuItem_Click"
|
||||
IconSource="Link"
|
||||
Tag="steamdb"
|
||||
Text="{Binding Path=Res.GameList_OpenSteamDBUrl, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
<ui:MenuFlyoutItem
|
||||
Click="AppOpenLink_MenuItem_Click"
|
||||
IconSource="Link"
|
||||
Tag="steamcardexchange"
|
||||
Text="{Binding Path=Res.GameList_OpenSteamCardUrl, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
@@ -74,51 +79,61 @@
|
||||
Theme="{StaticResource TransparentButton}">
|
||||
<Button.Content>
|
||||
<Panel>
|
||||
<Viewbox
|
||||
Width="16"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left">
|
||||
<ui:SymbolIcon Name="LaunchIcon">
|
||||
<i:Interaction.Behaviors>
|
||||
<ia:DataTriggerBehavior
|
||||
Binding="{Binding RunState}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="True">
|
||||
<ia:ChangePropertyAction
|
||||
PropertyName="Symbol"
|
||||
TargetObject="LaunchIcon"
|
||||
Value="StopFilled" />
|
||||
</ia:DataTriggerBehavior>
|
||||
<ia:DataTriggerBehavior
|
||||
Binding="{Binding RunState}"
|
||||
ComparisonCondition="NotEqual"
|
||||
Value="True">
|
||||
<ia:ChangePropertyAction
|
||||
PropertyName="Symbol"
|
||||
TargetObject="LaunchIcon"
|
||||
Value="PlayFilled" />
|
||||
</ia:DataTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
</ui:SymbolIcon>
|
||||
</Viewbox>
|
||||
<TextBlock
|
||||
Margin="28,4,0,4"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
|
||||
<CompiledBinding Mode="OneWay" Path="RunState" />
|
||||
<CompiledBinding
|
||||
Mode="OneWay"
|
||||
Path="Res.Stop"
|
||||
Source="{x:Static s:ResourceService.Current}" />
|
||||
<CompiledBinding
|
||||
Mode="OneWay"
|
||||
Path="Res.Launch"
|
||||
Source="{x:Static s:ResourceService.Current}" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<Panel IsVisible="{Binding !RunLoaingState}">
|
||||
<Viewbox
|
||||
Width="16"
|
||||
Height="16"
|
||||
HorizontalAlignment="Left">
|
||||
<ui:SymbolIcon Name="LaunchIcon">
|
||||
<i:Interaction.Behaviors>
|
||||
<ia:DataTriggerBehavior
|
||||
Binding="{Binding RunState}"
|
||||
ComparisonCondition="Equal"
|
||||
Value="True">
|
||||
<ia:ChangePropertyAction
|
||||
PropertyName="Symbol"
|
||||
TargetObject="LaunchIcon"
|
||||
Value="StopFilled" />
|
||||
</ia:DataTriggerBehavior>
|
||||
<ia:DataTriggerBehavior
|
||||
Binding="{Binding RunState}"
|
||||
ComparisonCondition="NotEqual"
|
||||
Value="True">
|
||||
<ia:ChangePropertyAction
|
||||
PropertyName="Symbol"
|
||||
TargetObject="LaunchIcon"
|
||||
Value="PlayFilled" />
|
||||
</ia:DataTriggerBehavior>
|
||||
</i:Interaction.Behaviors>
|
||||
</ui:SymbolIcon>
|
||||
</Viewbox>
|
||||
<TextBlock
|
||||
Margin="28,4,0,4"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource VisibleStringConverter}">
|
||||
<CompiledBinding Mode="OneWay" Path="RunState" />
|
||||
<CompiledBinding
|
||||
Mode="OneWay"
|
||||
Path="Res.Stop"
|
||||
Source="{x:Static s:ResourceService.Current}" />
|
||||
<CompiledBinding
|
||||
Mode="OneWay"
|
||||
Path="Res.Launch"
|
||||
Source="{x:Static s:ResourceService.Current}" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
</Panel>
|
||||
<ProgressBar
|
||||
Width="28"
|
||||
Height="28"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Classes="Circle"
|
||||
IsIndeterminate="True"
|
||||
IsVisible="{Binding RunLoaingState}" />
|
||||
</Panel>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
@@ -193,9 +208,9 @@
|
||||
OnContent="{Binding Path=Res.Idle_OpenAutoNext, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
|
||||
<TextBlock Text="游戏最小运行时间(小时)" Theme="{StaticResource CaptionTextBlockStyle}" />
|
||||
<ui:NumberBox Value="{Binding Source={x:Static ms:SteamIdleSettings.MinRunTime}, Path=Value, Mode=TwoWay}" />
|
||||
<ui:NumberBox SpinButtonPlacementMode="Inline" Value="{Binding Source={x:Static ms:SteamIdleSettings.MinRunTime}, Path=Value, Mode=TwoWay}" />
|
||||
<TextBlock Text="快速切换游戏间隔时间(毫秒)" Theme="{StaticResource CaptionTextBlockStyle}" />
|
||||
<ui:NumberBox Value="{Binding Source={x:Static ms:SteamIdleSettings.SwitchTime}, Path=Value, Mode=TwoWay}" />
|
||||
<ui:NumberBox SpinButtonPlacementMode="Inline" Value="{Binding Source={x:Static ms:SteamIdleSettings.SwitchTime}, Path=Value, Mode=TwoWay}" />
|
||||
</StackPanel>
|
||||
</spp:PageBase.PaneContent>
|
||||
|
||||
@@ -436,8 +451,22 @@
|
||||
Spacing="6">
|
||||
<Panel>
|
||||
<ToolTip.Tip>
|
||||
123
|
||||
<MultiBinding Converter="{StaticResource StringFormatConverter}">
|
||||
<CompiledBinding
|
||||
Mode="OneWay"
|
||||
Path="Res.SteamIdle_DroppedCardsCountTip_"
|
||||
Source="{x:Static s:ResourceService.Current}" />
|
||||
<CompiledBinding Mode="OneWay" Path="DropCardsCount" />
|
||||
</MultiBinding>
|
||||
</ToolTip.Tip>
|
||||
<Arc
|
||||
Width="80"
|
||||
Height="80"
|
||||
StartAngle="0"
|
||||
Stretch="None"
|
||||
Stroke="{DynamicResource ControlStrokeColorSecondaryBrush}"
|
||||
StrokeThickness="5"
|
||||
SweepAngle="360" />
|
||||
<ProgressBar
|
||||
Width="80"
|
||||
Height="80"
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using Avalonia.Controls;
|
||||
using BD.SteamClient.Constants;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using BD.SteamClient.Models;
|
||||
|
||||
namespace BD.WTTS.UI.Views.Pages;
|
||||
|
||||
@@ -9,4 +12,18 @@ public partial class IdleCardPage : PageBase<IdleCardPageViewModel>
|
||||
InitializeComponent();
|
||||
DataContext ??= new IdleCardPageViewModel();
|
||||
}
|
||||
|
||||
private void AppOpenLink_MenuItem_Click(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (sender is MenuFlyoutItem item && item.DataContext is SteamApp app)
|
||||
{
|
||||
var url = item.Tag switch
|
||||
{
|
||||
"steamdb" => string.Format(SteamApiUrls.STEAMDBINFO_APP_URL, app.AppId),
|
||||
"steamcardexchange" => string.Format(SteamApiUrls.STEAMCARDEXCHANGE_APP_URL, app.AppId),
|
||||
_ => string.Format(SteamApiUrls.STEAMSTORE_APP_URL, app.AppId),
|
||||
};
|
||||
ViewModel?.OpenLinkUrlCommand.Execute(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
MaxWidth="280"
|
||||
Classes="revealPasswordButton"
|
||||
PasswordChar="{StaticResource PasswordChar}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
Text="{Binding PasswordText}"
|
||||
Watermark="{Binding Path=Res.Steam_Password, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" />
|
||||
<CheckBox Content="{ReflectionBinding Path=Res.User_Rememberme, Mode=OneWay, Source={x:Static s:ResourceService.Current}}" IsChecked="{Binding RemenberLogin}" />
|
||||
@@ -96,7 +97,7 @@
|
||||
<TextBox
|
||||
Height="90"
|
||||
AcceptsReturn="True"
|
||||
MaxLines="6"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
||||
Text="{Binding SteamLoginSecure}" />
|
||||
<!--<TextBlock Text="家庭监护代码" />-->
|
||||
<!--<TextBox Text="{Binding 家庭监护代码}" />-->
|
||||
|
||||
@@ -6882,6 +6882,15 @@ namespace BD.WTTS.Client.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 已掉落 {0} 张卡牌 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string SteamIdle_DroppedCardsCountTip_ {
|
||||
get {
|
||||
return ResourceManager.GetString("SteamIdle_DroppedCardsCountTip_", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 已游玩 {0} 小时
|
||||
///{1} 张剩余卡牌掉落
|
||||
|
||||
@@ -2874,5 +2874,8 @@
|
||||
</data>
|
||||
<data name="CookieLogin" xml:space="preserve">
|
||||
<value>Cookie 登录</value>
|
||||
</data>
|
||||
<data name="SteamIdle_DroppedCardsCountTip_" xml:space="preserve">
|
||||
<value>已掉落 {0} 张卡牌</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -24,8 +24,6 @@ public sealed partial class DebugPageViewModel : TabItemViewModel
|
||||
set => this.RaiseAndSetIfChanged(ref _DebugString, value);
|
||||
}
|
||||
|
||||
string? phonenumber;
|
||||
|
||||
sealed class D : Repository<Common.Entities.KeyValuePair, string>
|
||||
{
|
||||
|
||||
@@ -107,7 +105,7 @@ public sealed partial class DebugPageViewModel : TabItemViewModel
|
||||
// catch (Exception ex)
|
||||
// {
|
||||
// }
|
||||
|
||||
string phonenumber = cmds[0];
|
||||
if (phonenumber == null) phonenumber = "180" + Random2.GenerateRandomNum(8);
|
||||
if (cmds[1] == "sms")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user