优化PVZ运行判断逻辑

This commit is contained in:
萌狼蓝天 2024-07-14 11:19:12 +08:00
parent 1b044a9995
commit 19031401d6
10 changed files with 8271 additions and 8234 deletions

View File

@ -10,7 +10,7 @@ import ctypes
kernel32 = ctypes.windll.kernel32
PROCESS_ALL_ACCESS = (0x000F0000 | 0x00100000 | 0xFFF)
running = False
# 定义修改阳光和冷却的函数
def change_sun(Phand, sun_num):
@ -75,8 +75,8 @@ def change_cooling(Phand, cooling):
# 定义检测游戏是否运行的函数
def find_game_window():
global running # 声明running为全局变量
hwnd = win32gui.FindWindow(None, "植物大战僵尸v2.2 ")
global running
hwnd = win32gui.FindWindow(None, game_title_entry.get())
if hwnd == 0:
messagebox.showinfo("提示", "植物大战僵尸没有运行,请先启动游戏!")
# 将启动按钮设置为禁用状态
@ -87,6 +87,7 @@ def find_game_window():
start_button.config(text="启动")
return None
else:
running = True
_, pid = win32process.GetWindowThreadProcessId(hwnd)
Phand = win32api.OpenProcess(PROCESS_ALL_ACCESS, False, pid)
# 如果游戏开始运行,重新激活启动按钮

38
PVZZZB_C4_gui.spec Normal file
View File

@ -0,0 +1,38 @@
# -*- mode: python ; coding: utf-8 -*-
a = Analysis(
['PVZ\\PVZZZB_C4_gui.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='PVZZZB_C4_gui',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)

View File

@ -10,4 +10,4 @@ MdImgUrlChange将Markdown中图片链接格式化为hexo图片链接的一款
植物大战僵尸杂交版v2.2修改器
pyinstaller --onefile --windowed .\PVZZZB_C4_gui.py
pyinstaller --onefile --windowed PVZ/PVZZZB_C4_gui.py

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@ missing module named 'org.python' - imported by copy (optional)
missing module named org - imported by pickle (optional)
missing module named pwd - imported by posixpath (delayed, conditional, optional), shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
missing module named grp - imported by shutil (delayed, optional), tarfile (optional), pathlib (delayed, optional), subprocess (delayed, conditional, optional)
missing module named posix - imported by os (conditional, optional), posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional)
missing module named posix - imported by posixpath (optional), shutil (conditional), importlib._bootstrap_external (conditional), os (conditional, optional)
missing module named resource - imported by posix (top-level)
missing module named _frozen_importlib_external - imported by importlib._bootstrap (delayed), importlib (optional), importlib.abc (optional)
excluded module named _frozen_importlib - imported by importlib (optional), importlib.abc (optional)

View File

@ -15,7 +15,7 @@
<div class="node">
<a name="PVZZZB_C4_gui.py"></a>
<a target="code" href="///C:/Users/xrilang/Desktop/pythonProject/PVZZZB_C4_gui.py" type="text/plain"><tt>PVZZZB_C4_gui.py</tt></a>
<a target="code" href="///C:/Users/xrilang/Desktop/pythonProject/PVZ/PVZZZB_C4_gui.py" type="text/plain"><tt>PVZZZB_C4_gui.py</tt></a>
<span class="moduletype">Script</span> <div class="import">
imports:
<a href="#_collections_abc">_collections_abc</a>
@ -4984,7 +4984,6 @@ imports:
&#8226; <a href="#importlib">importlib</a>
&#8226; <a href="#importlib._bootstrap">importlib._bootstrap</a>
&#8226; <a href="#importlib._bootstrap_external">importlib._bootstrap_external</a>
&#8226; <a href="#importlib.machinery">importlib.machinery</a>
&#8226; <a href="#sys">sys</a>
&#8226; <a href="#warnings">warnings</a>
@ -5115,8 +5114,7 @@ imports:
</div>
<div class="import">
imported by:
<a href="#importlib">importlib</a>
&#8226; <a href="#importlib.abc">importlib.abc</a>
<a href="#importlib.abc">importlib.abc</a>
&#8226; <a href="#inspect">inspect</a>
&#8226; <a href="#py_compile">py_compile</a>

BIN
dist/PVZZZB_C4_gui.exe vendored

Binary file not shown.