mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 10:10:45 +08:00
perf: Mumu截图增强设置增加测试按钮
This commit is contained in:
@@ -1844,6 +1844,7 @@ namespace MaaWpfGui.Main
|
||||
Gacha,
|
||||
ReclamationAlgorithm,
|
||||
ReclamationAlgorithm2,
|
||||
Custom,
|
||||
}
|
||||
|
||||
private readonly Dictionary<TaskType, AsstTaskId> _latestTaskId = [];
|
||||
@@ -2480,6 +2481,20 @@ namespace MaaWpfGui.Main
|
||||
return id != 0 && AsstStart();
|
||||
}
|
||||
|
||||
public bool AsstStartTestLink()
|
||||
{
|
||||
var taskParams = new JObject
|
||||
{
|
||||
["task_names"] = new JArray
|
||||
{
|
||||
"Stop",
|
||||
},
|
||||
};
|
||||
AsstTaskId id = AsstAppendTaskWithEncoding("Custom", taskParams);
|
||||
_latestTaskId[TaskType.Custom] = id;
|
||||
return id != 0 && AsstStart();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 自动抄作业。
|
||||
/// </summary>
|
||||
|
||||
@@ -820,7 +820,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
private BitmapImage? _gachaImage;
|
||||
|
||||
public BitmapImage GachaImage
|
||||
public BitmapImage? GachaImage
|
||||
{
|
||||
get => _gachaImage;
|
||||
set => SetAndNotify(ref _gachaImage, value);
|
||||
|
||||
@@ -28,6 +28,7 @@ using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Imaging;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using MaaWpfGui.Configuration;
|
||||
@@ -1620,6 +1621,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
Instances.TaskQueueViewModel.CustomInfrastPlanIndex--;
|
||||
Instances.TaskQueueViewModel.CustomInfrastPlanIndex++;
|
||||
}
|
||||
|
||||
Instances.TaskQueueViewModel.NeedAddCustomInfrastPlanInfo = true;
|
||||
}
|
||||
}
|
||||
@@ -1943,7 +1945,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
private ObservableCollection<CombinedData> _roguelikeModeList = new();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the list of roguelike modes.
|
||||
/// Gets or sets the list of roguelike modes.
|
||||
/// </summary>
|
||||
public ObservableCollection<CombinedData> RoguelikeModeList
|
||||
{
|
||||
@@ -1975,7 +1977,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
];
|
||||
|
||||
// public List<CombData> RoguelikeCoreCharList { get; set; }
|
||||
|
||||
private string _roguelikeTheme = ConfigurationHelper.GetValue(ConfigurationKeys.RoguelikeTheme, "Sarkaz");
|
||||
|
||||
/// <summary>
|
||||
@@ -2145,7 +2146,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public bool RoguelikeOnlyStartWithEliteTwo => _roguelikeOnlyStartWithEliteTwo && RoguelikeStartWithEliteTwo;
|
||||
|
||||
|
||||
private bool _roguelike3FirstFloorFoldartal = Convert.ToBoolean(ConfigurationHelper.GetValue(ConfigurationKeys.Roguelike3FirstFloorFoldartal, bool.FalseString));
|
||||
|
||||
/// <summary>
|
||||
@@ -2198,7 +2198,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
/// </summary>
|
||||
public bool Roguelike3NewSquad2StartingFoldartal => _roguelike3NewSquad2StartingFoldartal && RoguelikeSquadIsFoldartal;
|
||||
|
||||
|
||||
private string _roguelike3NewSquad2StartingFoldartals = ConfigurationHelper.GetValue(ConfigurationKeys.Roguelike3NewSquad2StartingFoldartals, string.Empty);
|
||||
|
||||
public string Roguelike3NewSquad2StartingFoldartals
|
||||
@@ -3371,7 +3370,6 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
get => AllVersionTypeList.Where(v => AllowNightlyUpdates || v.Value != UpdateVersionType.Nightly).ToList();
|
||||
}
|
||||
|
||||
|
||||
public bool AllowNightlyUpdates { get; set; } = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.AllowNightlyUpdates, bool.FalseString));
|
||||
|
||||
private bool _hasAcknowledgedNightlyWarning = Convert.ToBoolean(ConfigurationHelper.GetGlobalValue(ConfigurationKeys.HasAcknowledgedNightlyWarning, bool.FalseString));
|
||||
@@ -4079,6 +4077,59 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test Link And Get Image.
|
||||
/// </summary>
|
||||
// UI 绑定的方法
|
||||
// ReSharper disable once UnusedMember.Global
|
||||
public async void TestLinkAndGetImage()
|
||||
{
|
||||
_runningState.SetIdle(false);
|
||||
|
||||
string errMsg = string.Empty;
|
||||
TestLinkInfo = LocalizationHelper.GetString("ConnectingToEmulator");
|
||||
bool caught = await Task.Run(() => Instances.AsstProxy.AsstConnect(ref errMsg));
|
||||
if (!caught)
|
||||
{
|
||||
TestLinkInfo = errMsg;
|
||||
_runningState.SetIdle(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Instances.AsstProxy.AsstStartTestLink())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var image = Instances.AsstProxy.AsstGetImage();
|
||||
TestLinkImage = image;
|
||||
TestLinkInfo = "Finish";
|
||||
}
|
||||
|
||||
private bool _showTestLinkImage = false;
|
||||
|
||||
public bool ShowTestLinkImage
|
||||
{
|
||||
get => _showTestLinkImage;
|
||||
set => SetAndNotify(ref _showTestLinkImage, value);
|
||||
}
|
||||
|
||||
private BitmapImage? _testLinkImage;
|
||||
|
||||
public BitmapImage? TestLinkImage
|
||||
{
|
||||
get => _testLinkImage;
|
||||
set => SetAndNotify(ref _testLinkImage, value);
|
||||
}
|
||||
|
||||
private string _testLinkInfo = string.Empty;
|
||||
|
||||
public string TestLinkInfo
|
||||
{
|
||||
get => _testLinkInfo;
|
||||
set => SetAndNotify(ref _testLinkInfo, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 标题栏显示模拟器名称和IP端口。
|
||||
/// </summary>
|
||||
|
||||
@@ -162,7 +162,26 @@
|
||||
hc:TitleElement.TitlePlacement="Left"
|
||||
Text="{Binding MuMuEmulator12Extras.Display}"
|
||||
Visibility="{c:Binding 'ConnectConfig=="MuMuEmulator12"'}" />
|
||||
<Button
|
||||
Width="60"
|
||||
Height="30"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Right"
|
||||
Command="{s:Action TestLinkAndGetImage}"
|
||||
Content="Test" />
|
||||
</StackPanel>
|
||||
<Image
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Source="{Binding TestLinkImage}"
|
||||
Visibility="{c:Binding 'TestLinkInfo!=""'}" />
|
||||
<controls:TextBlock
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding TestLinkInfo}"
|
||||
Visibility="{c:Binding 'TestLinkInfo!=""'}" />
|
||||
</StackPanel>
|
||||
<WrapPanel
|
||||
Grid.Row="4"
|
||||
|
||||
Reference in New Issue
Block a user