mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 02:10:21 +08:00
feat.简单优化了一下抄作业的 UI
This commit is contained in:
@@ -26,6 +26,14 @@ bool asst::BattleFormationTask::_run()
|
||||
return false;
|
||||
}
|
||||
|
||||
json::value info = basic_info_with_what("BattleFormation");
|
||||
auto& details = info["details"];
|
||||
auto& formation = details["formation"];
|
||||
for (const auto& [name, oper_vec] : m_groups) {
|
||||
formation.array_emplace(name);
|
||||
}
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
|
||||
// TODO: 需要加一个滑到头了的检测
|
||||
while (!need_exit()) {
|
||||
select_opers_in_cur_page();
|
||||
@@ -89,6 +97,11 @@ bool asst::BattleFormationTask::select_opers_in_cur_page()
|
||||
m_ctrler->click(SkillRectArray.at(skill - 1));
|
||||
}
|
||||
m_groups.erase(iter);
|
||||
|
||||
json::value info = basic_info_with_what("BattleFormationSelected");
|
||||
auto& details = info["details"];
|
||||
details["selected"] = name;
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -65,6 +65,13 @@ bool asst::BattleProcessTask::get_stage_info()
|
||||
|
||||
bool asst::BattleProcessTask::analyze_opers_preview()
|
||||
{
|
||||
{
|
||||
json::value info = basic_info_with_what("BattleAction");
|
||||
auto& details = info["details"];
|
||||
details["description"] = "识别干员";
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
}
|
||||
|
||||
BattleImageAnalyzer oper_analyzer;
|
||||
oper_analyzer.set_target(BattleImageAnalyzer::Target::Oper);
|
||||
|
||||
@@ -243,6 +250,26 @@ bool asst::BattleProcessTask::update_opers_info(const cv::Mat& image)
|
||||
|
||||
bool asst::BattleProcessTask::do_action(const BattleAction& action)
|
||||
{
|
||||
json::value info = basic_info_with_what("BattleAction");
|
||||
auto& details = info["details"];
|
||||
std::string desc;
|
||||
switch (action.type) {
|
||||
case BattleActionType::Deploy:
|
||||
desc = action.group_name + " 部署";
|
||||
break;
|
||||
case BattleActionType::Retreat:
|
||||
desc = action.group_name + " 撤退";
|
||||
break;
|
||||
case BattleActionType::UseSkill:
|
||||
desc = action.group_name + " 技能";
|
||||
break;
|
||||
case BattleActionType::SwitchSpeed:
|
||||
desc = "切换二倍速";
|
||||
break;
|
||||
}
|
||||
details["description"] = desc;
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
|
||||
if (!wait_condition(action)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ namespace MeoAsstGui
|
||||
builder.Bind<TaskQueueViewModel>().ToSelf().InSingletonScope();
|
||||
builder.Bind<RecruitViewModel>().ToSelf().InSingletonScope();
|
||||
builder.Bind<SettingsViewModel>().ToSelf().InSingletonScope();
|
||||
builder.Bind<CopilotViewModel>().ToSelf().InSingletonScope();
|
||||
builder.Bind<AsstProxy>().ToSelf().InSingletonScope();
|
||||
}
|
||||
|
||||
|
||||
@@ -371,6 +371,7 @@ namespace MeoAsstGui
|
||||
var subTaskDetails = details["details"];
|
||||
|
||||
var mainModel = _container.Get<TaskQueueViewModel>();
|
||||
var copilotModel = _container.Get<CopilotViewModel>();
|
||||
switch (what)
|
||||
{
|
||||
case "StageDrops":
|
||||
@@ -489,6 +490,18 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "BattleFormation":
|
||||
copilotModel.AddLog("开始编队\n" + JsonConvert.SerializeObject(subTaskDetails["formation"]));
|
||||
break;
|
||||
|
||||
case "BattleFormationSelected":
|
||||
copilotModel.AddLog("选择干员:" + subTaskDetails["selected"].ToString());
|
||||
break;
|
||||
|
||||
case "BattleAction":
|
||||
copilotModel.AddLog("当然步骤:" + subTaskDetails["description"].ToString());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,12 +29,25 @@ namespace MeoAsstGui
|
||||
{
|
||||
private readonly IWindowManager _windowManager;
|
||||
private readonly IContainer _container;
|
||||
public ObservableCollection<LogItemViewModel> LogItemViewModels { get; set; }
|
||||
|
||||
public CopilotViewModel(IContainer container, IWindowManager windowManager)
|
||||
{
|
||||
_container = container;
|
||||
_windowManager = windowManager;
|
||||
DisplayName = "自动战斗";
|
||||
DisplayName = "自动战斗 Beta";
|
||||
LogItemViewModels = new ObservableCollection<LogItemViewModel>();
|
||||
}
|
||||
|
||||
public void AddLog(string content, string color = "Gray", string weight = "Regular")
|
||||
{
|
||||
LogItemViewModels.Add(new LogItemViewModel(content, color, weight));
|
||||
//LogItemViewModels.Insert(0, new LogItemViewModel(time + content, color, weight));
|
||||
}
|
||||
|
||||
public void ClearLog()
|
||||
{
|
||||
LogItemViewModels.Clear();
|
||||
}
|
||||
|
||||
private string _filename;
|
||||
@@ -69,6 +82,8 @@ namespace MeoAsstGui
|
||||
|
||||
public async void Start()
|
||||
{
|
||||
AddLog("正在连接模拟器……");
|
||||
|
||||
var asstProxy = _container.Get<AsstProxy>();
|
||||
if (!_catched)
|
||||
{
|
||||
@@ -80,10 +95,12 @@ namespace MeoAsstGui
|
||||
}
|
||||
if (!_catched)
|
||||
{
|
||||
AddLog("连接模拟器失败\n请检查连接设置", "darkred");
|
||||
return;
|
||||
}
|
||||
if (Filename.Length == 0 || !File.Exists(Filename))
|
||||
{
|
||||
AddLog("作业文件不存在", "darkred");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -98,10 +115,12 @@ namespace MeoAsstGui
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
AddLog("作业文件读取出错", "darkred");
|
||||
return;
|
||||
}
|
||||
|
||||
asstProxy.AsstStartCopilot(data["stage_name"].ToString(), Filename, Form);
|
||||
AddLog("Star Burst Stream!");
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
|
||||
@@ -9,23 +9,33 @@
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="495" d:DesignWidth="800">
|
||||
<Grid Margin="20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Block.TextAlignment="Center"
|
||||
Text="作业路径" Margin="10" />
|
||||
<TextBox Text="{Binding Filename}" Margin="10"
|
||||
Width="500" Height="30" InputMethod.IsInputMethodEnabled="False" />
|
||||
Width="300" Height="30" InputMethod.IsInputMethodEnabled="False" />
|
||||
<Button Command="{s:Action SelectFile}" IsEnabled="{Binding Idle}" Content="选择作业" Width="120" Height="50" Margin="10" />
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding Form}" IsHitTestVisible="{Binding Idle}" Content="编队" Height="50" Margin="10" />
|
||||
<CheckBox IsChecked="{Binding Form}" HorizontalAlignment="Center" IsHitTestVisible="{Binding Idle}" Content="自动编队" Height="50" Margin="10" />
|
||||
<Button Command="{s:Action Start}" IsEnabled="{Binding Idle}" Content="开始" Width="120" Height="50" Margin="10" />
|
||||
<Button Command="{s:Action Stop}" Content="停止" Width="120" Height="50" Margin="10" />
|
||||
</StackPanel>
|
||||
|
||||
<ScrollViewer Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="10"
|
||||
local:AutoScroll.AutoScroll="True" Width="300">
|
||||
<ItemsControl ItemsSource="{Binding Path=LogItemViewModels}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{Binding Content}" Foreground="{Binding Color}" FontWeight="{Binding Weight}"
|
||||
Style="{StaticResource TextBlockDefault}" TextWrapping="Wrap" Margin="5, 5" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
Reference in New Issue
Block a user