mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-18 18:20:39 +08:00
feat. robot notification
This commit is contained in:
@@ -122,7 +122,7 @@ bool asst::AutoRecruitTask::calc_and_recruit()
|
||||
{
|
||||
LogTraceFunction;
|
||||
RecruitCalcTask recruit_task(m_callback, m_callback_arg, m_task_chain);
|
||||
recruit_task.set_param(m_select_level, true)
|
||||
recruit_task.set_param(m_select_level, true, m_skip_robot)
|
||||
.set_retry_times(m_retry_times)
|
||||
.set_exit_flag(m_exit_flag)
|
||||
.set_ctrler(m_ctrler)
|
||||
|
||||
@@ -63,9 +63,17 @@ bool RecruitCalcTask::_run()
|
||||
m_has_special_tag = true;
|
||||
}
|
||||
|
||||
static const std::string Robot = "支援机械";
|
||||
static const std::string Robot = "狙击干员";
|
||||
auto robot_iter = all_tags_name.find(Robot);
|
||||
if (robot_iter != all_tags_name.end()) {
|
||||
if (m_skip_robot)
|
||||
{
|
||||
info["what"] = "RecruitRobotTag";
|
||||
info["details"] = json::object{
|
||||
{ "tag", Robot }
|
||||
};
|
||||
callback(AsstMsg::SubTaskExtraInfo, info);
|
||||
}
|
||||
m_has_robot_tag = true;
|
||||
}
|
||||
|
||||
@@ -169,6 +177,7 @@ bool RecruitCalcTask::_run()
|
||||
json::value results_json;
|
||||
results_json["result"] = json::array();
|
||||
results_json["level"] = m_maybe_level;
|
||||
results_json["robot"] = m_skip_robot && m_has_robot_tag;
|
||||
|
||||
std::vector<json::value> result_json_vector;
|
||||
for (const auto& comb : result_vec) {
|
||||
@@ -218,9 +227,10 @@ bool RecruitCalcTask::_run()
|
||||
return true;
|
||||
}
|
||||
|
||||
RecruitCalcTask& RecruitCalcTask::set_param(std::vector<int> select_level, bool set_time) noexcept
|
||||
RecruitCalcTask& RecruitCalcTask::set_param(std::vector<int> select_level, bool set_time, bool skip_robot) noexcept
|
||||
{
|
||||
m_select_level = std::move(select_level);
|
||||
m_set_time = set_time;
|
||||
m_skip_robot = skip_robot;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace asst
|
||||
using AbstractTask::AbstractTask;
|
||||
virtual ~RecruitCalcTask() = default;
|
||||
|
||||
RecruitCalcTask& set_param(std::vector<int> select_level, bool set_time = true) noexcept;
|
||||
RecruitCalcTask& set_param(std::vector<int> select_level, bool set_time = true, bool skip_robot = true) noexcept;
|
||||
|
||||
bool get_has_special_tag() const noexcept
|
||||
{
|
||||
@@ -43,5 +43,6 @@ namespace asst
|
||||
bool m_has_special_tag = false;
|
||||
bool m_has_robot_tag = false;
|
||||
bool m_has_refresh = false;
|
||||
bool m_skip_robot = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -445,6 +445,16 @@ namespace MeoAsstGui
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "RecruitRobotTag":
|
||||
{
|
||||
string special = subTaskDetails["tag"].ToString();
|
||||
using (var toast = new ToastNotification("公招提示"))
|
||||
{
|
||||
toast.AppendContentText(special).ShowRecruitRobot();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "RecruitResult":
|
||||
{
|
||||
@@ -461,6 +471,16 @@ namespace MeoAsstGui
|
||||
{
|
||||
mainModel.AddLog(level + " 星 Tags", "darkcyan");
|
||||
}
|
||||
|
||||
bool robot = (bool)subTaskDetails["robot"];
|
||||
if (robot)
|
||||
{
|
||||
using (var toast = new ToastNotification($"公招出小车了哦!"))
|
||||
{
|
||||
toast.AppendContentText(new string('★', 1)).ShowRecruitRobot(row: 2);
|
||||
}
|
||||
mainModel.AddLog(1 + " 星 Tag", "gainsboro", "Bold");
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -362,6 +362,23 @@ namespace MeoAsstGui
|
||||
notificationContent: content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示公招小车标签通知
|
||||
/// </summary>
|
||||
/// <param name="row">内容显示行数,比如第 2 行用来放星星</param>
|
||||
public void ShowRecruitRobot(uint row = 1)
|
||||
{
|
||||
var content = BaseContent();
|
||||
|
||||
// 给通知染上小车相似的颜色
|
||||
content.Background = (SolidColorBrush)new BrushConverter().ConvertFrom("#DCDCDC04");
|
||||
content.Foreground = (SolidColorBrush)new BrushConverter().ConvertFrom("#B0B0B000");
|
||||
|
||||
Show(row: row,
|
||||
sound: NotificationSounds.Notification,
|
||||
notificationContent: content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 显示更新版本的通知
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user