fixed count error when use stone or medicine

This commit is contained in:
MistEO
2021-07-22 00:28:20 +08:00
parent eedbc16142
commit e69000770a
5 changed files with 22 additions and 3 deletions

View File

@@ -46,6 +46,7 @@ namespace asst {
int exec_times = 0;
int max_times = INT_MAX;
std::vector<std::string> exceeded_next;
std::vector<std::string> reduce_other_times;
asst::Rect specific_area;
int pre_delay = 0;
int rear_delay = 0;

View File

@@ -190,6 +190,9 @@ void Assistance::workingProc(Assistance* pThis)
break;
}
++task.exec_times;
for (auto&& reduce : task.reduce_other_times) {
--Configer::m_tasks[reduce].exec_times;
}
if (task.rear_delay > 0) {
DebugTrace("RearDelay", task.rear_delay);
// std::this_thread::sleep_for(std::chrono::milliseconds(task.rear_delay));

View File

@@ -104,6 +104,12 @@ bool Configer::reload()
if (task_json.exist("rearDelay")) {
task_info.rear_delay = task_json["rearDelay"].as_integer();
}
if (task_json.exist("reduceOtherTimes")) {
auto reduce_arr = task_json["reduceOtherTimes"].as_array();
for (auto&& reduce : reduce_arr) {
task_info.reduce_other_times.emplace_back(reduce.as_string());
}
}
auto next_arr = task_json["next"].as_array();

View File

@@ -89,7 +89,11 @@ namespace MeoAsstGui
private void textBox_useStone_TextChanged(object sender, TextChangedEventArgs e)
{
AsstSetParam(p_asst, "task.maxTimes", "StoneConfirm", textBox_useStone.Text);
if (checkBox_useMedicine.IsChecked == true)
{
String text = textBox_useStone.Text != String.Empty ? textBox_useStone.Text : "0";
AsstSetParam(p_asst, "task.maxTimes", "StoneConfirm", text);
}
}
private void checkBox_useStone_Checked(object sender, RoutedEventArgs e)
@@ -129,7 +133,8 @@ namespace MeoAsstGui
{
if (checkBox_maxTimes.IsChecked == true)
{
AsstSetParam(p_asst, "task.maxTimes", "StartButton1", textBox_maxTimes.Text);
String text = textBox_maxTimes.Text != String.Empty ? textBox_maxTimes.Text : "0";
AsstSetParam(p_asst, "task.maxTimes", "StartButton1", text);
}
else
{
@@ -141,7 +146,8 @@ namespace MeoAsstGui
{
if (checkBox_maxTimes.IsChecked == true)
{
AsstSetParam(p_asst, "task.maxTimes", "StartButton1", textBox_maxTimes.Text);
String text = textBox_maxTimes.Text != String.Empty ? textBox_maxTimes.Text : "0";
AsstSetParam(p_asst, "task.maxTimes", "StartButton1", text);
}
}
}

View File

@@ -291,6 +291,7 @@
"MedicineConfirm": {
"filename": "MedicineConfirm.png",
"type": "clickSelf",
"reduceOtherTimes": [ "StartButton1" ],
"next": [
"StartButton1"
]
@@ -306,6 +307,7 @@
"filename": "MedicineConfirm.png",
"type": "clickSelf",
"maxTimes": 0,
"reduceOtherTimes": [ "StartButton1" ],
"next": [
"StartButton1"
]
@@ -320,6 +322,7 @@
"AbandonAction": {
"filename": "AbandonAction.png",
"type": "clickSelf",
"reduceOtherTimes": [ "StartButton1", "StartButton2", "Loading" ],
"next": [
"Random"
]