From 5a1d0a282e15a8eb53c3b8c35e311d3a5f7c03c5 Mon Sep 17 00:00:00 2001 From: hzqst <113660872@qq.com> Date: Thu, 28 Sep 2023 18:23:16 +0800 Subject: [PATCH] 1 --- CGAssistant/main.cpp | 6 +++++- CGAssistant/mainwindow.h | 2 +- CGAssistant/scriptform.cpp | 17 ++++++++++++++++- CGAssistant/scriptform.h | 2 +- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CGAssistant/main.cpp b/CGAssistant/main.cpp index 1156480..ec43293 100644 --- a/CGAssistant/main.cpp +++ b/CGAssistant/main.cpp @@ -112,6 +112,8 @@ int main(int argc, char *argv[]) QCommandLineOption consolemaxlines("consolemaxlines", "", "consolemaxlines", "100"); + QCommandLineOption scriptfreezeduration("scriptfreezeduration", "", "scriptfreezeduration", "60"); + QCommandLineOption chatmaxlines("chatmaxlines", "", "chatmaxlines", "100"); QCommandLineParser parser; @@ -147,6 +149,7 @@ int main(int argc, char *argv[]) parser.addOption(loadsettings); parser.addOption(killfreeze); parser.addOption(consolemaxlines); + parser.addOption(scriptfreezeduration); parser.addOption(chatmaxlines); parser.process(a); @@ -287,7 +290,8 @@ int main(int argc, char *argv[]) parser.isSet(scriptfreezestop) ? true : false, parser.isSet(injuryprotect) ? true : false, parser.isSet(soulprotect) ? true : false, - parser.value(consolemaxlines).toInt() ); + parser.value(consolemaxlines).toInt(), + parser.value(scriptfreezeduration).toInt() ); w.NotifyFillLoadSettings(parser.value(loadsettings)); diff --git a/CGAssistant/mainwindow.h b/CGAssistant/mainwindow.h index a3b0207..eaa630e 100644 --- a/CGAssistant/mainwindow.h +++ b/CGAssistant/mainwindow.h @@ -34,7 +34,7 @@ class MainWindow : public QMainWindow bool autologin, bool skipupdate, bool autochangeserver,bool autokillgame, bool create_chara, int create_chara_chara, int create_chara_eye, int create_chara_mou, int create_chara_color, QString create_chara_points, QString create_chara_elements, QString create_chara_name); - void NotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines); + void NotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration); void NotifyFillLoadSettings(QString path); void NotifyFillStaticSettings(int freezetime, int chatmaxlines); void HttpGetGameProcInfo(QJsonDocument* doc); diff --git a/CGAssistant/scriptform.cpp b/CGAssistant/scriptform.cpp index ce7255f..62ae38c 100644 --- a/CGAssistant/scriptform.cpp +++ b/CGAssistant/scriptform.cpp @@ -543,7 +543,7 @@ void ScriptForm::OnNotifyAttachProcessOk(quint32 ProcessId, quint32 ThreadId, qu qputenv("CGA_GAME_PORT", qportString); } -void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines) +void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration) { if(!path.isEmpty()) { @@ -572,7 +572,10 @@ void ScriptForm::OnNotifyFillLoadScript(QString path, int autorestart, bool free if(freezestop) ui->checkBox_freezestop->setChecked(true); + ui->horizontalSlider_freezeDuration->setValue(scriptfreezeduration); + m_ConsoleMaxLines = consolemaxlines; + m_output->setMaximumBlockCount(m_ConsoleMaxLines); } @@ -692,6 +695,18 @@ void ScriptForm::OnHttpLoadScript(QString query, QByteArray postdata, QJsonDocum ui->checkBox_soulProt->setChecked(qsoulprot.toBool()); } } + if(newobj.contains("freezestop")){ + auto freezestop = newobj.take("freezestop"); + if(freezestop.isBool()){ + ui->checkBox_freezestop->setChecked(freezestop.toBool()); + } + } + if(newobj.contains("freezeduration")){ + auto scriptfreezeduration = newobj.take("scriptfreezeduration"); + if(scriptfreezeduration.toInt() >= 10 && scriptfreezeduration.toInt() <= 600 ){ + ui->horizontalSlider_freezeDuration->setValue(scriptfreezeduration.toInt()); + } + } } else { diff --git a/CGAssistant/scriptform.h b/CGAssistant/scriptform.h index 0e35325..50c0f31 100644 --- a/CGAssistant/scriptform.h +++ b/CGAssistant/scriptform.h @@ -31,7 +31,7 @@ public slots: void on_pushButton_run_clicked(); void on_pushButton_debug_clicked(); void on_pushButton_term_clicked(); - void OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines); + void OnNotifyFillLoadScript(QString path, int autorestart, bool freezestop, bool injuryprot, bool soulprot, int consolemaxlines, int scriptfreezeduration); void RunNavigatorScript(int x, int y, int enter, QString *result); void StopNavigatorScript(); void OnHttpLoadScript(QString query, QByteArray postdata, QJsonDocument* doc);