mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
feat: 干员识别协议变动,增加一个导出剪切板的功能
This commit is contained in:
@@ -62,14 +62,23 @@ void asst::OperBoxRecognitionTask::callback_analyze_result(bool done)
|
||||
json::value info = basic_info_with_what("OperBoxInfo");
|
||||
auto& details = info["details"];
|
||||
details["done"] = done;
|
||||
auto& box_oper = details["operbox"].as_array();
|
||||
auto& all_opers = details["all_opers"].as_array();
|
||||
auto& own_opers = details["own_opers"].as_array();
|
||||
|
||||
for (const auto& name : all_oper_names) {
|
||||
box_oper.emplace_back(json::object {
|
||||
bool own = m_own_opers.contains(name);
|
||||
all_opers.emplace_back(json::object {
|
||||
{ "id", BattleData.get_id(name) },
|
||||
{ "name", name },
|
||||
{ "own", m_own_opers.contains(name) },
|
||||
{ "own", own },
|
||||
});
|
||||
if (own) {
|
||||
own_opers.emplace_back(json::object {
|
||||
{ "id", BattleData.get_id(name) }, { "name", name }, { "own", own },
|
||||
// TODO
|
||||
// { "elite", 0 }, { "level", 0 },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
|
||||
@@ -385,6 +385,7 @@
|
||||
<system:String x:Key="BeganToOperBoxRecognition">Start to identify</system:String>
|
||||
<system:String x:Key="OperBoxRecognitionTip">This function is still in testing, please sort the operator list by rarity or level. If the statistics are wrong, please pack the debug/oper file and submit an issue to us~</system:String>
|
||||
<system:String x:Key="OperBoxRecognitionResult">Not owned: {0} : \n\n{1}\n\nOwned: {2} : \n\n{3}</system:String>
|
||||
<system:String x:Key="OperBoxCopyToClipboard">Copy to clipboard</system:String>
|
||||
|
||||
<!-- Operator Recognition -->
|
||||
|
||||
|
||||
@@ -387,6 +387,7 @@
|
||||
<system:String x:Key="OperBoxRecognitionTip">该功能尚处于测试阶段,干员列表请用稀有度和等级排序,若统计有误,欢迎打包 debug/oper 文件后向我们提交issue ~</system:String>
|
||||
<system:String x:Key="OperBoxRecognitionResult">未拥有:{0} 名:\n\n{1}\n\n已拥有:{2} 名:\n\n{3}</system:String>
|
||||
<system:String x:Key="BeganToOperBoxRecognition">开始识别</system:String>
|
||||
<system:String x:Key="OperBoxCopyToClipboard">复制到剪切板</system:String>
|
||||
<!-- 干员识别 -->
|
||||
|
||||
<!-- 日志 -->
|
||||
|
||||
@@ -376,9 +376,12 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
set => SetAndNotify(ref _operBoxResult, value);
|
||||
}
|
||||
|
||||
private string _operBoxExportData = string.Empty;
|
||||
|
||||
public bool OperBoxParse(JObject details)
|
||||
{
|
||||
JArray operBoxs = (JArray)details["operbox"];
|
||||
JArray operBoxs = (JArray)details["all_opers"];
|
||||
|
||||
List<string> operHave = new List<string>();
|
||||
List<string> operNotHave = new List<string>();
|
||||
|
||||
@@ -429,6 +432,7 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
{
|
||||
OperBoxInfo = LocalizationHelper.GetString("IdentificationCompleted") + "\n" + LocalizationHelper.GetString("OperBoxRecognitionTip");
|
||||
OperBoxResult = string.Format(LocalizationHelper.GetString("OperBoxRecognitionResult"), operNotHave.Count, operNotHaveNames, operHave.Count, operHaveNames);
|
||||
_operBoxExportData = details["own_opers"].ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -440,6 +444,8 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
|
||||
public async void StartOperBox()
|
||||
{
|
||||
_operBoxExportData = string.Empty;
|
||||
|
||||
string errMsg = string.Empty;
|
||||
OperBoxInfo = LocalizationHelper.GetString("ConnectingToEmulator");
|
||||
bool caught = await Task.Run(() => _asstProxy.AsstConnect(ref errMsg));
|
||||
@@ -455,6 +461,17 @@ namespace MaaWpfGui.ViewModels.UI
|
||||
}
|
||||
}
|
||||
|
||||
public void ExportOperBox()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_operBoxExportData))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Clipboard.SetDataObject(_operBoxExportData);
|
||||
OperBoxInfo = LocalizationHelper.GetString("CopiedToClipboard");
|
||||
}
|
||||
|
||||
#endregion OperBox
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,24 @@
|
||||
xmlns:c="clr-namespace:CalcBinding;assembly=CalcBinding"
|
||||
xmlns:controls="clr-namespace:MaaWpfGui.Styles.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:styles="clr-namespace:MaaWpfGui.Styles"
|
||||
xmlns:ui="clr-namespace:MaaWpfGui.ViewModels.UI"
|
||||
xmlns:viewModels="clr-namespace:MaaWpfGui.ViewModels"
|
||||
xmlns:vm="clr-namespace:MaaWpfGui"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
d:DataContext="{d:DesignInstance {x:Type ui:RecognizerViewModel}}"
|
||||
d:DesignHeight="1200"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<TabControl
|
||||
SelectedIndex="3"
|
||||
Margin="0,10"
|
||||
BorderThickness="0"
|
||||
SelectedIndex="3"
|
||||
Style="{StaticResource TabControlSliding}">
|
||||
<TabItem Header="{DynamicResource RecruitmentRecognition}">
|
||||
<Grid
|
||||
Margin="20,0,20,20">
|
||||
<Grid Margin="20,0,20,20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="150" />
|
||||
@@ -31,8 +30,8 @@
|
||||
<hc:ScrollViewer
|
||||
Grid.Row="0"
|
||||
Margin="10,0"
|
||||
IsInertiaEnabled="True"
|
||||
VerticalAlignment="Top">
|
||||
VerticalAlignment="Top"
|
||||
IsInertiaEnabled="True">
|
||||
<StackPanel>
|
||||
<controls:TextBlock
|
||||
Height="36"
|
||||
@@ -112,8 +111,7 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource DepotRecognition}">
|
||||
<Grid
|
||||
Margin="20,0,20,20">
|
||||
<Grid Margin="20,0,20,20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="150" />
|
||||
@@ -121,8 +119,8 @@
|
||||
<hc:ScrollViewer
|
||||
Grid.Row="0"
|
||||
Margin="10,0"
|
||||
IsInertiaEnabled="True"
|
||||
VerticalAlignment="Top">
|
||||
VerticalAlignment="Top"
|
||||
IsInertiaEnabled="True">
|
||||
<StackPanel>
|
||||
<controls:TextBlock
|
||||
Height="36"
|
||||
@@ -177,17 +175,16 @@
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{DynamicResource OperBoxRecognition}">
|
||||
<Grid
|
||||
Margin="20,0,20,20">
|
||||
<Grid Margin="20,0,20,20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="150"/>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="150" />
|
||||
</Grid.RowDefinitions>
|
||||
<hc:ScrollViewer
|
||||
Grid.Row="0"
|
||||
Margin="10,0"
|
||||
IsInertiaEnabled="True"
|
||||
VerticalAlignment="Top">
|
||||
VerticalAlignment="Top"
|
||||
IsInertiaEnabled="True">
|
||||
<StackPanel>
|
||||
<controls:TextBlock
|
||||
Height="36"
|
||||
@@ -197,15 +194,14 @@
|
||||
FontSize="14"
|
||||
Style="{StaticResource TextBlockDefaultBold}"
|
||||
Text="{Binding OperBoxInfo}"
|
||||
TextWrapping="Wrap"/>
|
||||
TextWrapping="Wrap" />
|
||||
<controls:TextBlock
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="14"
|
||||
Text="{Binding OperBoxResult}"
|
||||
TextWrapping="Wrap"/>
|
||||
TextWrapping="Wrap" />
|
||||
</StackPanel>
|
||||
|
||||
</hc:ScrollViewer>
|
||||
<StackPanel
|
||||
Grid.Row="1"
|
||||
@@ -216,12 +212,15 @@
|
||||
<Button
|
||||
Width="180"
|
||||
Height="70"
|
||||
Margin="482,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Margin="30"
|
||||
Command="{s:Action ExportOperBox}"
|
||||
Content="{DynamicResource OperBoxCopyToClipboard}" />
|
||||
<Button
|
||||
Width="180"
|
||||
Height="70"
|
||||
Margin="30"
|
||||
Command="{s:Action StartOperBox}"
|
||||
Content="{DynamicResource BeganToOperBoxRecognition}"
|
||||
/>
|
||||
Content="{DynamicResource BeganToOperBoxRecognition}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
Reference in New Issue
Block a user