mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-15 17:30:27 +08:00
refactor.解耦添加任务与开始任务
This commit is contained in:
@@ -16,14 +16,16 @@ extern "C" {
|
||||
bool MEOAPI AsstCatchCustom(void* p_asst);
|
||||
bool MEOAPI AsstCatchFake(void* p_asst);
|
||||
|
||||
bool MEOAPI AsstStartSanity(void* p_asst);
|
||||
bool MEOAPI AsstStartVisit(void* p_asst, bool with_shopping);
|
||||
bool MEOAPI AsstStartProcessTask(void* p_asst, const char* task);
|
||||
bool MEOAPI AsstStartRecruiting(void* p_asst, const int required_level[], int required_len, bool set_time);
|
||||
bool MEOAPI AsstStartInfrastShift(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold);
|
||||
bool MEOAPI AsstStartDebugTask(void* p_asst);
|
||||
bool MEOAPI AsstAppendSanity(void* p_asst);
|
||||
bool MEOAPI AsstAppendReceiveAward(void* p_asst);
|
||||
bool MEOAPI AsstAppendVisit(void* p_asst, bool with_shopping);
|
||||
bool MEOAPI AsstAppendProcessTask(void* p_asst, const char* task);
|
||||
bool MEOAPI AsstAppendRecruiting(void* p_asst, const int required_level[], int required_len, bool set_time);
|
||||
bool MEOAPI AsstAppendInfrastShift(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold);
|
||||
bool MEOAPI AsstAppendDebugTask(void* p_asst);
|
||||
|
||||
void MEOAPI AsstStop(void* p_asst);
|
||||
bool MEOAPI AsstStart(void* p_asst);
|
||||
bool MEOAPI AsstStop(void* p_asst);
|
||||
bool MEOAPI AsstSetParam(void* p_asst, const char* type, const char* param, const char* value);
|
||||
|
||||
MEOAPI_PORT const char* MEO_CALL AsstGetVersion();
|
||||
|
||||
@@ -139,15 +139,20 @@ bool asst::Assistance::catch_fake()
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::start_sanity()
|
||||
bool asst::Assistance::append_sanity(bool only_append)
|
||||
{
|
||||
return start_process_task("SanityBegin", ProcessTaskRetryTimesDefault);
|
||||
return append_process_task("SanityBegin", ProcessTaskRetryTimesDefault, only_append);
|
||||
}
|
||||
|
||||
bool asst::Assistance::start_visit(bool with_shopping)
|
||||
bool asst::Assistance::append_receive_award(bool only_append)
|
||||
{
|
||||
return append_process_task("AwardBegin", ProcessTaskRetryTimesDefault, only_append);
|
||||
}
|
||||
|
||||
bool asst::Assistance::append_visit(bool with_shopping, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -162,40 +167,36 @@ bool asst::Assistance::start_visit(bool with_shopping)
|
||||
m_tasks_deque.emplace_back(shopping_task_ptr);
|
||||
}
|
||||
|
||||
m_thread_idle = false;
|
||||
m_condvar.notify_one();
|
||||
if (!only_append) {
|
||||
start(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Assistance::start_process_task(const std::string& task, int retry_times, bool block)
|
||||
bool Assistance::append_process_task(const std::string& task, int retry_times, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
log.trace("Start |", task, block ? "block" : "non block");
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_lock<std::mutex> lock;
|
||||
if (block) {
|
||||
lock = std::unique_lock<std::mutex>(m_mutex);
|
||||
//clear_exec_times();
|
||||
resource.templ().clear_hists();
|
||||
}
|
||||
std::unique_lock<std::mutex> lock(m_mutex);
|
||||
|
||||
append_match_task(task, { task }, retry_times);
|
||||
|
||||
m_thread_idle = false;
|
||||
m_condvar.notify_one();
|
||||
if (!only_append) {
|
||||
start(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef LOG_TRACE
|
||||
bool Assistance::start_debug_task()
|
||||
bool Assistance::append_debug_task()
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -211,17 +212,14 @@ bool Assistance::start_debug_task()
|
||||
m_tasks_deque.emplace_back(shift_task_ptr);
|
||||
}
|
||||
|
||||
m_thread_idle = false;
|
||||
m_condvar.notify_one();
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Assistance::start_recruiting(const std::vector<int>& required_level, bool set_time)
|
||||
bool Assistance::append_recruiting(const std::vector<int>& required_level, bool set_time, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -233,16 +231,17 @@ bool Assistance::start_recruiting(const std::vector<int>& required_level, bool s
|
||||
task_ptr->set_task_chain("OpenRecruit");
|
||||
m_tasks_deque.emplace_back(task_ptr);
|
||||
|
||||
m_thread_idle = false;
|
||||
m_condvar.notify_one();
|
||||
if (!only_append) {
|
||||
start(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::start_infrast_shift(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses_of_drones, double dorm_threshold)
|
||||
bool asst::Assistance::append_infrast_shift(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses_of_drones, double dorm_threshold, bool only_append)
|
||||
{
|
||||
LogTraceFunction;
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
if (!m_inited) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -258,6 +257,8 @@ bool asst::Assistance::start_infrast_shift(infrast::WorkMode work_mode, const st
|
||||
|
||||
auto info_task_ptr = std::make_shared<InfrastInfoTask>(task_callback, (void*)this);
|
||||
info_task_ptr->set_work_mode(work_mode);
|
||||
info_task_ptr->set_task_chain(InfrastTaskCahin);
|
||||
|
||||
m_tasks_deque.emplace_back(info_task_ptr);
|
||||
|
||||
// 因为后期要考虑多任务间的联动等,所以这些任务的声明暂时不妨到for循环中
|
||||
@@ -307,18 +308,38 @@ bool asst::Assistance::start_infrast_shift(infrast::WorkMode work_mode, const st
|
||||
m_tasks_deque.emplace_back(recpt_task_ptr);
|
||||
}
|
||||
else {
|
||||
log.error("start_infrast_shift | Unknown facility", facility);
|
||||
log.error("append_infrast_shift | Unknown facility", facility);
|
||||
}
|
||||
append_match_task(InfrastTaskCahin, { "InfrastBegin" });
|
||||
}
|
||||
|
||||
if (!only_append) {
|
||||
start(false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool asst::Assistance::start(bool block)
|
||||
{
|
||||
LogTraceFunction;
|
||||
log.trace("Start |", block ? "block" : "non block");
|
||||
|
||||
if (!m_thread_idle || !m_inited) {
|
||||
return false;
|
||||
}
|
||||
std::unique_lock<std::mutex> lock;
|
||||
if (block) { // 外部调用
|
||||
lock = std::unique_lock<std::mutex>(m_mutex);
|
||||
}
|
||||
|
||||
m_thread_idle = false;
|
||||
m_condvar.notify_one();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Assistance::stop(bool block)
|
||||
bool Assistance::stop(bool block)
|
||||
{
|
||||
LogTraceFunction;
|
||||
log.trace("Stop |", block ? "block" : "non block");
|
||||
@@ -333,6 +354,8 @@ void Assistance::stop(bool block)
|
||||
m_tasks_deque.swap(empty);
|
||||
clear_exec_times();
|
||||
resource.templ().clear_hists();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Assistance::set_param(const std::string& type, const std::string& param, const std::string& value)
|
||||
@@ -365,7 +388,8 @@ void Assistance::working_proc()
|
||||
bool ret = task_ptr->run();
|
||||
if (ret) {
|
||||
retry_times = 0;
|
||||
if (m_tasks_deque.empty()) {
|
||||
if (m_tasks_deque.empty()
|
||||
|| task_ptr->get_task_chain() != m_tasks_deque.front()->get_task_chain()) {
|
||||
json::value task_all_completed_json;
|
||||
task_all_completed_json["task_chain"] = task_ptr->get_task_chain();
|
||||
task_callback(AsstMsg::TaskChainCompleted, task_all_completed_json, p_this);
|
||||
|
||||
@@ -39,24 +39,30 @@ namespace asst
|
||||
// 不实际进行捕获,调试用接口
|
||||
bool catch_fake();
|
||||
|
||||
// 开始刷理智
|
||||
bool start_sanity();
|
||||
// 开始访问好友基建
|
||||
bool start_visit(bool with_shopping = false);
|
||||
// 添加刷理智任务
|
||||
bool append_sanity(bool only_append = true);
|
||||
// 添加领取日常任务奖励任务
|
||||
bool append_receive_award(bool only_append = true);
|
||||
// 添加访问好友基建任务
|
||||
bool append_visit(bool with_shopping, bool only_append = true);
|
||||
|
||||
// 开始公开招募操作
|
||||
bool start_recruiting(const std::vector<int>& required_level, bool set_time = true);
|
||||
// 开始基建换班任务
|
||||
bool start_infrast_shift(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses, double dorm_threshold);
|
||||
// 添加公开招募操作任务
|
||||
bool append_recruiting(const std::vector<int>& required_level, bool set_time, bool only_append = true);
|
||||
// 添加基建换班任务任务
|
||||
bool append_infrast_shift(infrast::WorkMode work_mode, const std::vector<std::string>& order, UsesOfDrones uses, double dorm_threshold, bool only_append = true);
|
||||
|
||||
// 添加流程任务,应该是private的,调试用临时放到public
|
||||
bool append_process_task(const std::string& task, int retry_times = ProcessTaskRetryTimesDefault, bool only_append = true);
|
||||
|
||||
// 开始流程任务,应该是private的,调试用临时放到public
|
||||
bool start_process_task(const std::string& task, int retry_times = ProcessTaskRetryTimesDefault, bool block = true);
|
||||
#ifdef LOG_TRACE
|
||||
// 调试用
|
||||
bool start_debug_task();
|
||||
bool append_debug_task();
|
||||
#endif
|
||||
|
||||
void stop(bool block = true);
|
||||
// 开始执行任务队列
|
||||
bool start(bool block = true);
|
||||
// 停止任务队列并清空
|
||||
bool stop(bool block = true);
|
||||
|
||||
bool set_param(const std::string& type, const std::string& param, const std::string& value);
|
||||
|
||||
|
||||
@@ -112,40 +112,85 @@ bool AsstCatchFake(void* p_asst)
|
||||
#endif // LOG_TRACE
|
||||
}
|
||||
|
||||
bool AsstStartSanity(void* p_asst)
|
||||
bool AsstAppendSanity(void* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start_sanity();
|
||||
}
|
||||
|
||||
bool AsstStartVisit(void* p_asst, bool with_shopping)
|
||||
return ((asst::Assistance*)p_asst)->append_sanity();
|
||||
}
|
||||
|
||||
bool AsstAppendReceiveAward(void* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start_visit(with_shopping);
|
||||
return ((asst::Assistance*)p_asst)->append_receive_award();
|
||||
}
|
||||
|
||||
bool AsstStartProcessTask(void* p_asst, const char* task)
|
||||
bool AsstAppendVisit(void* p_asst, bool with_shopping)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start_process_task(task, asst::Assistance::ProcessTaskRetryTimesDefault);
|
||||
return ((asst::Assistance*)p_asst)->append_visit(with_shopping);
|
||||
}
|
||||
|
||||
void AsstStop(void* p_asst)
|
||||
bool AsstAppendProcessTask(void* p_asst, const char* task)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
((asst::Assistance*)p_asst)->stop();
|
||||
return ((asst::Assistance*)p_asst)->append_process_task(task, asst::Assistance::ProcessTaskRetryTimesDefault);
|
||||
}
|
||||
|
||||
|
||||
bool AsstAppendRecruiting(void* p_asst, const int required_level[], int required_len, bool set_time)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::vector<int> level_vector;
|
||||
level_vector.assign(required_level, required_level + required_len);
|
||||
return ((asst::Assistance*)p_asst)->append_recruiting(level_vector, set_time);
|
||||
}
|
||||
|
||||
bool AsstAppendInfrastShift(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> order_vector;
|
||||
order_vector.assign(order, order + order_size);
|
||||
|
||||
return ((asst::Assistance*)p_asst)->
|
||||
append_infrast_shift(
|
||||
static_cast<asst::infrast::WorkMode>(work_mode),
|
||||
order_vector,
|
||||
static_cast<asst::UsesOfDrones>(uses_of_drones),
|
||||
dorm_threshold);
|
||||
}
|
||||
|
||||
bool AsstStart(void* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start();
|
||||
}
|
||||
|
||||
bool AsstStop(void* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return ((asst::Assistance*)p_asst)->stop();
|
||||
}
|
||||
|
||||
bool AsstSetParam(void* p_asst, const char* type, const char* param, const char* value)
|
||||
@@ -162,34 +207,13 @@ const char* AsstGetVersion()
|
||||
return asst::Version;
|
||||
}
|
||||
|
||||
bool AsstStartRecruiting(void* p_asst, const int required_level[], int required_len, bool set_time)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::vector<int> level_vector;
|
||||
level_vector.assign(required_level, required_level + required_len);
|
||||
return ((asst::Assistance*)p_asst)->start_recruiting(level_vector, set_time);
|
||||
}
|
||||
|
||||
bool AsstStartInfrastShift(void* p_asst, int work_mode, const char** order, int order_size, int uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
std::vector<std::string> order_vector;
|
||||
order_vector.assign(order, order + order_size);
|
||||
|
||||
return ((asst::Assistance*)p_asst)->start_infrast_shift(static_cast<asst::infrast::WorkMode>(work_mode), order_vector, static_cast<asst::UsesOfDrones>(uses_of_drones), dorm_threshold);
|
||||
}
|
||||
|
||||
bool AsstStartDebugTask(void* p_asst)
|
||||
bool AsstAppendDebugTask(void* p_asst)
|
||||
{
|
||||
if (p_asst == nullptr) {
|
||||
return false;
|
||||
}
|
||||
#if LOG_TRACE
|
||||
return ((asst::Assistance*)p_asst)->start_debug_task();
|
||||
return ((asst::Assistance*)p_asst)->append_debug_task();
|
||||
#else
|
||||
return false;
|
||||
#endif // LOG_TRACE
|
||||
|
||||
@@ -23,17 +23,19 @@ namespace MeoAsstGui
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstCatchDefault(IntPtr ptr);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStartProcessTask(IntPtr ptr, string task);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendProcessTask(IntPtr ptr, string task);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStartSanity(IntPtr ptr);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendSanity(IntPtr ptr);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendReceiveAward(IntPtr ptr);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStartVisit(IntPtr ptr, bool with_shopping);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendVisit(IntPtr ptr, bool with_shopping);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStartRecruiting(IntPtr ptr, int[] required_level, int required_len, bool set_time);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendRecruiting(IntPtr ptr, int[] required_level, int required_len, bool set_time);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStartInfrastShift(IntPtr ptr, int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstAppendInfrastShift(IntPtr ptr, int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern void AsstStop(IntPtr ptr);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStart(IntPtr ptr);
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstStop(IntPtr ptr);
|
||||
|
||||
[DllImport("MeoAssistance.dll")] private static extern bool AsstSetParam(IntPtr p_asst, string type, string param, string value);
|
||||
|
||||
@@ -104,10 +106,14 @@ namespace MeoAsstGui
|
||||
case AsstMsg.TaskStart:
|
||||
{
|
||||
string taskChain = detail["task_chain"].ToString();
|
||||
string taskType = detail["task_type"].ToString();
|
||||
if (taskChain == "SanityBegin" || taskChain == "VisitBegin")
|
||||
{
|
||||
mfvm.RunStatus = "正在运行中……";
|
||||
}
|
||||
else if (taskChain == "Infrast")
|
||||
{
|
||||
var ifvm = _container.Get<InfrastructureConstructionViewModel>();
|
||||
ifvm.StatusPrompt = "正在运行中……";
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -187,7 +193,7 @@ namespace MeoAsstGui
|
||||
{
|
||||
//AsstStop();
|
||||
System.Threading.Thread.Sleep(2000);
|
||||
AsstStartSanity();
|
||||
AsstAppendSanity();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -283,12 +289,7 @@ namespace MeoAsstGui
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void AsstStop()
|
||||
{
|
||||
AsstStop(_ptr);
|
||||
}
|
||||
}
|
||||
|
||||
private bool _isCatched = false;
|
||||
|
||||
@@ -301,30 +302,47 @@ namespace MeoAsstGui
|
||||
return _isCatched;
|
||||
}
|
||||
|
||||
public bool AsstStartSanity()
|
||||
public bool AsstAppendSanity()
|
||||
{
|
||||
return AsstStartSanity(_ptr);
|
||||
return AsstAppendSanity(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstAppendReceiveAward()
|
||||
{
|
||||
return AsstAppendReceiveAward(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstStartVisit(bool with_shopping)
|
||||
public bool AsstAppendVisit(bool with_shopping)
|
||||
{
|
||||
return AsstStartVisit(_ptr, with_shopping);
|
||||
return AsstAppendVisit(_ptr, with_shopping);
|
||||
}
|
||||
|
||||
public bool AsstAppendRecruiting(int[] required_level, int required_len, bool set_time)
|
||||
{
|
||||
return AsstAppendRecruiting(_ptr, required_level, required_len, set_time);
|
||||
}
|
||||
|
||||
public bool AsstAppendInfrastShift(int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
return AsstAppendInfrastShift(_ptr, work_mode, order, order_len, uses_of_drones, dorm_threshold);
|
||||
}
|
||||
|
||||
public bool AsstStart()
|
||||
{
|
||||
return AsstStart(_ptr);
|
||||
}
|
||||
|
||||
public bool AsstStop()
|
||||
{
|
||||
return AsstStop(_ptr);
|
||||
}
|
||||
|
||||
|
||||
public void AsstSetParam(string type, string param, string value)
|
||||
{
|
||||
AsstSetParam(_ptr, type, param, value);
|
||||
}
|
||||
|
||||
public bool AsstStartRecruiting(int[] required_level, int required_len, bool set_time)
|
||||
{
|
||||
return AsstStartRecruiting(_ptr, required_level, required_len, set_time);
|
||||
}
|
||||
|
||||
public bool AsstStartInfrastShift(int work_mode, string[] order, int order_len, int uses_of_drones, double dorm_threshold)
|
||||
{
|
||||
return AsstStartInfrastShift(_ptr, work_mode, order, order_len, uses_of_drones, dorm_threshold);
|
||||
}
|
||||
}
|
||||
|
||||
public enum AsstMsg
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="200" d:DesignWidth="500">
|
||||
d:DesignHeight="280" d:DesignWidth="500">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||
@@ -37,6 +38,7 @@
|
||||
<TextBlock Style="{StaticResource TextBlockDefault}" Text="次" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
|
||||
<CheckBox Grid.Row="3" IsChecked="{Binding Shutdown}" Content="刷完自动关机" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<CheckBox Grid.Row="3" IsChecked="{Binding ReceiveAward}" Content="领取日常奖励" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<CheckBox Grid.Row="4" IsChecked="{Binding Shutdown}" Content="刷完自动关机" Margin="10" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -230,10 +230,14 @@ namespace MeoAsstGui
|
||||
orderList.Add(facility_key[item.Name]);
|
||||
}
|
||||
|
||||
bool ret = asstProxy.AsstStartInfrastShift((int)work_mode, orderList.ToArray(), orderList.Count, (int)uses_of_drones, DormThreshold / 100.0);
|
||||
if (ret)
|
||||
bool ret = asstProxy.AsstAppendInfrastShift(
|
||||
(int)work_mode, orderList.ToArray(), orderList.Count, (int)uses_of_drones, DormThreshold / 100.0);
|
||||
|
||||
ret &= asstProxy.AsstStart();
|
||||
|
||||
if (!ret)
|
||||
{
|
||||
StatusPrompt = "正在运行中……";
|
||||
StatusPrompt = "出现未知错误";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,17 @@ namespace MeoAsstGui
|
||||
SetAndNotify(ref _runStatus, value);
|
||||
}
|
||||
}
|
||||
private bool _receiveAward = System.Convert.ToBoolean(ViewStatusStorage.Get("MainFunction.ReceiveAward", bool.TrueString));
|
||||
public bool ReceiveAward
|
||||
{
|
||||
get { return _receiveAward; }
|
||||
set
|
||||
{
|
||||
ViewStatusStorage.Set("MainFunction.ReceiveAward", value.ToString());
|
||||
SetAndNotify(ref _receiveAward, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private bool _shutdown;
|
||||
|
||||
@@ -278,9 +289,16 @@ namespace MeoAsstGui
|
||||
{
|
||||
RunStatus = "捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限";
|
||||
return;
|
||||
}
|
||||
if (!asstProxy.AsstStartSanity())
|
||||
}
|
||||
bool startRet = asstProxy.AsstAppendSanity();
|
||||
if (ReceiveAward)
|
||||
{
|
||||
startRet &= asstProxy.AsstAppendReceiveAward();
|
||||
}
|
||||
startRet &= asstProxy.AsstStart();
|
||||
if (!startRet)
|
||||
{
|
||||
RunStatus = "开始失败,出现未知错误";
|
||||
return;
|
||||
}
|
||||
ExecInfo = "";
|
||||
@@ -307,9 +325,12 @@ namespace MeoAsstGui
|
||||
{
|
||||
RunStatus = "捕获模拟器窗口失败,若是第一次运行,请尝试使用管理员权限";
|
||||
return;
|
||||
}
|
||||
if (!asstProxy.AsstStartVisit(CreditShopping))
|
||||
{
|
||||
}
|
||||
bool start_ret = asstProxy.AsstAppendVisit(CreditShopping)
|
||||
&& asstProxy.AsstStart();
|
||||
if (!start_ret)
|
||||
{
|
||||
RunStatus = "出现未知错误";
|
||||
return;
|
||||
}
|
||||
CreditShoppingCheckBoxIsEnable = false;
|
||||
|
||||
@@ -135,7 +135,8 @@ namespace MeoAsstGui
|
||||
levelList.Add(6);
|
||||
}
|
||||
|
||||
asstProxy.AsstStartRecruiting(levelList.ToArray(), levelList.Count, AutoSetTime);
|
||||
asstProxy.AsstAppendRecruiting(levelList.ToArray(), levelList.Count, AutoSetTime);
|
||||
asstProxy.AsstStart();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,12 @@
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
xmlns:dd="urn:gong-wpf-dragdrop"
|
||||
mc:Ignorable="d"
|
||||
Height="350" Width="750">
|
||||
Height="460" Width="750">
|
||||
<Grid Margin="20, 20">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="80" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -49,23 +50,20 @@
|
||||
<Slider Width="200" Value="{Binding DormThreshold}" Minimum="0" Maximum="100" Margin="0, 5" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Column="2" VerticalAlignment="Center">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0, 0, 0, 10">
|
||||
<RadioButton GroupName="换班模式" Content="温和换班" IsChecked="{Binding WorkModeGentle}" Margin="0, 5" />
|
||||
<RadioButton GroupName="换班模式" Content="激进换班" IsChecked="{Binding WorkModeAggressive}" Margin="0, 5" />
|
||||
<RadioButton GroupName="换班模式" Content="偏激换班(还没做)" IsChecked="{Binding WorkModeExtreme}" Margin="0, 5" />
|
||||
</StackPanel>
|
||||
<Button Grid.Row="1" Command="{s:Action ChangeShift}" Content="开始换班" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Height="50" Margin="0, 10" />
|
||||
<Button Grid.Row="2" Command="{s:Action Stop}" Content="停止" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Height="50" Margin="0, 10, 0, 0" />
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="2" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0, 0, 0, 10">
|
||||
<RadioButton GroupName="换班模式" Content="温和换班" IsChecked="{Binding WorkModeGentle}" Margin="0, 5" />
|
||||
<RadioButton GroupName="换班模式" Content="激进换班" IsChecked="{Binding WorkModeAggressive}" Margin="0, 5" />
|
||||
<RadioButton GroupName="换班模式" Content="偏激换班(还没做)" IsChecked="{Binding WorkModeExtreme}" Margin="0, 5" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
<TextBlock Grid.Row="1" Style="{StaticResource TextBlockDefaultBold}"
|
||||
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<Button Grid.Row="1" Command="{s:Action ChangeShift}" Content="开始换班" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Height="50" Margin="20, 10" />
|
||||
<Button Grid.Row="2" Command="{s:Action Stop}" Content="停止" HorizontalAlignment="Center" VerticalAlignment="Center" Width="120" Height="50" Margin="20, 10" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock Grid.Row="2" Style="{StaticResource TextBlockDefaultBold}"
|
||||
HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Text="{Binding StatusPrompt}" />
|
||||
</Grid>
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
xmlns:local="clr-namespace:MeoAsstGui"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
Height="350" Width="500">
|
||||
Height="460" Width="500">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="200" />
|
||||
<RowDefinition Height="280" />
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="50" />
|
||||
<RowDefinition Height="80" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Center">
|
||||
<local:SanityParamSettingUserControl Width="350" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="350" d:DesignWidth="750">
|
||||
d:DesignHeight="460" d:DesignWidth="750">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:s="https://github.com/canton7/Stylet"
|
||||
mc:Ignorable="d"
|
||||
Title="Meo明日方舟辅助" Height="450" Width="750">
|
||||
Title="Meo明日方舟辅助" Height="560" Width="750">
|
||||
<DockPanel>
|
||||
<TabControl Style="{StaticResource StyletConductorTabControl}" Margin="0,10,0,0" />
|
||||
</DockPanel>
|
||||
|
||||
@@ -16,18 +16,20 @@ int main(int argc, char** argv)
|
||||
|
||||
char ch = 0;
|
||||
while (ch != 'q') {
|
||||
//AsstStartSanity(ptr);
|
||||
//AsstStartVisit(ptr, true);
|
||||
//AsstAppendSanity(ptr);
|
||||
//AsstAppendVisit(ptr, true);
|
||||
//{
|
||||
// const int required[] = { 3, 4, 5, 6 };
|
||||
// AsstStartRecruiting(ptr, required, sizeof(required) / sizeof(int), true);
|
||||
// AsstAppendRecruiting(ptr, required, sizeof(required) / sizeof(int), true);
|
||||
//}
|
||||
//AsstStartDebugTask(ptr);
|
||||
{
|
||||
const char* order[] = { "Trade", "Mfg", "Dorm" };
|
||||
AsstStartInfrastShift(ptr, 1, order, 3, 0, 0);
|
||||
}
|
||||
|
||||
//AsstAppendDebugTask(ptr);
|
||||
//{
|
||||
// const char* order[] = { "Trade", "Mfg", "Dorm" };
|
||||
// AsstAppendInfrastShift(ptr, 1, order, 3, 0, 0);
|
||||
//}
|
||||
AsstAppendProcessTask(ptr, "AwardBegin");
|
||||
AsstStart(ptr);
|
||||
|
||||
ch = getchar();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user