pyscreeps-arena 0.5.6.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,51 @@
1
+ import os
2
+ import sys
3
+ import shutil
4
+ import py7zr
5
+ from pyscreeps_arena.core import const, config
6
+ def CMD_NewProject():
7
+ """
8
+ cmd:
9
+ pyscreeps-arena [project_path]
10
+ arena [project_path]
11
+
12
+ * 复制"src" "game" "build.py" 到指定目录
13
+
14
+ Returns:
15
+
16
+ """
17
+ if len(sys.argv) < 2:
18
+ print("Usage: pyarena new [project_path]\n# or\narena new [project_path]")
19
+ return
20
+ project_path = sys.argv[1]
21
+ if not os.path.exists(project_path):
22
+ os.makedirs(project_path)
23
+ this_path = os.path.dirname(os.path.abspath(__file__))
24
+ extract_7z(os.path.join(this_path, 'project.7z'), project_path)
25
+ print("Project created at", project_path)
26
+
27
+ def CMD_OpenUI():
28
+ """
29
+ cmd:
30
+ psaui
31
+
32
+ * 打开UI界面
33
+
34
+ Returns:
35
+
36
+ """
37
+ try:
38
+ from pyscreeps_arena.ui.project_ui import run_project_creator
39
+ run_project_creator()
40
+ except ImportError as e:
41
+ print(f"错误: 无法导入UI模块 - {e}")
42
+ print("请确保已安装PyQt6: pip install PyQt6")
43
+ except Exception as e:
44
+ print(f"错误: 打开UI界面失败 - {e}")
45
+
46
+ def extract_7z(file_path, output_dir):
47
+ with py7zr.SevenZipFile(file_path, mode='r') as archive:
48
+ archive.extractall(path=output_dir)
49
+
50
+ if __name__ == '__main__':
51
+ CMD_OpenUI()
@@ -0,0 +1,7 @@
1
+ from pyscreeps_arena.compiler import Compiler
2
+
3
+ if __name__ == '__main__':
4
+ compiler = Compiler('src', 'library', 'build')
5
+
6
+ compiler.compile()
7
+ # compiler.clean()