Skip to content

Commit

Permalink
添加启动AUTO_MAA后直接代理功能
Browse files Browse the repository at this point in the history
  • Loading branch information
DLmaster361 committed Nov 7, 2024
1 parent f4f99c2 commit a3fe641
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 19 deletions.
23 changes: 22 additions & 1 deletion AUTO_MAA.py
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,6 @@ def __init__(self, PASSWARD=""):
]

self.ui = uiLoader.load(self.app_path + "/gui/ui/main.ui")
self.ui.setWindowTitle("AUTO_MAA")
self.ui.setWindowIcon(QIcon(self.app_path + "/res/AUTO_MAA.ico"))
# 检查文件完整性
self.initialize()
Expand Down Expand Up @@ -1162,6 +1161,11 @@ def __init__(self, PASSWARD=""):
self.if_sleep = self.ui.findChild(QCheckBox, "checkBox_ifsleep")
self.if_sleep.stateChanged.connect(self.change_config)

self.if_proxy_directly = self.ui.findChild(
QCheckBox, "checkBox_ifproxydirectly"
)
self.if_proxy_directly.stateChanged.connect(self.change_config)

self.check_update = self.ui.findChild(QPushButton, "pushButton_check_update")
self.check_update.clicked.connect(self.check_version)

Expand Down Expand Up @@ -1222,6 +1226,9 @@ def __init__(self, PASSWARD=""):
self.update_config()
self.change_userlist_method()

if self.config["Default"]["SelfSet.IfProxyDirectly"] == "True":
self.routine_starter()

def initialize(self):
"""初始化程序的配置文件"""
# 检查目录
Expand Down Expand Up @@ -1299,6 +1306,7 @@ def check_config(self):
["TimesLimit.run", 3],
["SelfSet.IfSelfStart", "False"],
["SelfSet.IfSleep", "False"],
["SelfSet.IfProxyDirectly", "False"],
]
# 导入配置文件
with open(self.config_path, "r", encoding="utf-8") as f:
Expand Down Expand Up @@ -1710,6 +1718,10 @@ def update_config(self):
bool(self.config["Default"]["SelfSet.IfSleep"] == "True")
)

self.if_proxy_directly.setChecked(
bool(self.config["Default"]["SelfSet.IfProxyDirectly"] == "True")
)

for i in range(10):
self.start_time[i][0].setChecked(
bool(self.config["Default"]["TimeSet.set" + str(i + 1)] == "True")
Expand Down Expand Up @@ -2093,6 +2105,7 @@ def change_config(self):
"""将GUI中发生修改的程序配置同步至self.config变量"""
if not self.if_update_config:
return None

self.config["Default"]["MaaSet.path"] = self.maa_path.text().replace("\\", "/")
if not self.check_maa_path():
self.config["Default"]["MaaSet.path"] = ""
Expand All @@ -2103,6 +2116,7 @@ def change_config(self):
self.ui, "错误", "未找到MAA.exe或MAA配置文件,请重新设置MAA路径!"
)
return None

self.config["Default"]["TimeLimit.routine"] = self.routine.value()
self.config["Default"]["TimeLimit.annihilation"] = self.annihilation.value()
self.config["Default"]["TimesLimit.run"] = self.num.value()
Expand All @@ -2117,15 +2131,22 @@ def change_config(self):
else:
self.config["Default"]["SelfSet.IfSelfStart"] = "False"

if self.if_proxy_directly.isChecked():
self.config["Default"]["SelfSet.IfProxyDirectly"] = "True"
else:
self.config["Default"]["SelfSet.IfProxyDirectly"] = "False"

for i in range(10):
if self.start_time[i][0].isChecked():
self.config["Default"]["TimeSet.set" + str(i + 1)] = "True"
else:
self.config["Default"]["TimeSet.set" + str(i + 1)] = "False"
time = self.start_time[i][1].time().toString("HH:mm")
self.config["Default"]["TimeSet.run" + str(i + 1)] = time

with open(self.config_path, "w", encoding="utf-8") as f:
json.dump(self.config, f, indent=4)

self.update_config()

def change_userlist_method(self):
Expand Down
102 changes: 92 additions & 10 deletions gui/ui/main.ui
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1156</width>
<height>546</height>
<width>88</width>
<height>74</height>
</rect>
</property>
<attribute name="label">
Expand Down Expand Up @@ -1037,8 +1037,8 @@
<property name="title">
<string>AUTO_MAA设置</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<layout class="QGridLayout" name="gridLayout_4" rowstretch="1,1" columnstretch="1,1,1,1">
<item row="0" column="0">
<widget class="QFrame" name="frame_routine_3">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
Expand All @@ -1054,10 +1054,23 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_14">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<item row="0" column="1">
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
Expand All @@ -1070,7 +1083,7 @@
</property>
</spacer>
</item>
<item>
<item row="0" column="2">
<widget class="QFrame" name="frame_routine_2">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
Expand All @@ -1086,10 +1099,23 @@
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_13">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<item row="0" column="3">
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
Expand All @@ -1102,7 +1128,52 @@
</property>
</spacer>
</item>
<item>
<item row="1" column="0">
<widget class="QFrame" name="frame_routine_4">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Shadow::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="QCheckBox" name="checkBox_ifproxydirectly">
<property name="text">
<string>启动AUTO_MAA后直接代理</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_15">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<spacer name="horizontalSpacer_11">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>231</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<widget class="QFrame" name="frame_check_update">
<property name="frameShape">
<enum>QFrame::Shape::StyledPanel</enum>
Expand Down Expand Up @@ -1147,6 +1218,19 @@
</layout>
</widget>
</item>
<item row="1" column="3">
<spacer name="horizontalSpacer_12">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>311</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
Expand Down Expand Up @@ -1184,8 +1268,6 @@ li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Microsoft YaHei UI'; font-size:9pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;致用户:&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 这是AUTO_MAA_v4.1.0,版本更新程序上线。&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 使用本程序前,请先仔细阅读README.md。&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt; 对于B服用户,由于我们无权替您同意用户协议,若出现用户协议弹窗,您需要自行完成确认,否则可能造成MAA卡死,代理任务失败。&lt;/p&gt;
Expand Down
8 changes: 4 additions & 4 deletions res/AUTO_MAA_info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(4, 1, 1, 0),
filevers=(4, 1, 1, 1),
prodvers=(0, 0, 0, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
Expand All @@ -31,13 +31,13 @@ VSVersionInfo(
[StringStruct('Comments', 'https://github.com/DLmaster361/AUTO_MAA/'),
StringStruct('CompanyName', 'AUTO_MAA Team'),
StringStruct('FileDescription', 'AUTO_MAA Component'),
StringStruct('FileVersion', '4.1.1.0'),
StringStruct('FileVersion', '4.1.1.1'),
StringStruct('InternalName', 'AUTO_MAA'),
StringStruct('LegalCopyright', 'Copyright © 2024 DLmaster361'),
StringStruct('OriginalFilename', 'AUTO_MAA.py'),
StringStruct('ProductName', 'AUTO_MAA'),
StringStruct('ProductVersion', 'v4.1.1.0'),
StringStruct('Assembly Version', 'v4.1.1.0')])
StringStruct('ProductVersion', 'v4.1.1.1'),
StringStruct('Assembly Version', 'v4.1.1.1')])
])
]
)
8 changes: 4 additions & 4 deletions res/version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"main_version": "4.1.1.0",
"main_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1/AUTO_MAA_v4.1.1.zip",
"main_version": "4.1.1.1",
"main_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1_beta/AUTO_MAA_v4.1.1_beta.zip",
"updater_version": "1.0.0.0",
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1/Updater_v1.0.0.zip",
"announcement": "\n## 修复BUG\n- 适配MAA的`启动MAA后自动开启模拟器`字段更改"
"updater_download_url": "https://ghp.ci/https://github.com/DLmaster361/AUTO_MAA/releases/download/v4.1.1_beta/Updater_v1.0.0.zip",
"announcement": "\n# 开发中的版本!非开发者勿直接更新!!否则后果自负!!!\n## 新增功能\n- 添加`启动AUTO_MAA后直接代理`功能"
}

0 comments on commit a3fe641

Please sign in to comment.