pyscreeps-arena 0.5.7a0__py3-none-any.whl → 0.5.7a2__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.
@@ -35,8 +35,13 @@ def CMD_OpenUI():
35
35
 
36
36
  """
37
37
  try:
38
- from pyscreeps_arena.ui.project_ui import run_project_creator
39
- run_project_creator()
38
+ # 检查是否带 -c
39
+ if len(sys.argv) > 1 and sys.argv[1] == '-c':
40
+ from pyscreeps_arena.ui.creeplogic_edit import run_creeplogic_edit
41
+ run_creeplogic_edit()
42
+ else:
43
+ from pyscreeps_arena.ui.project_ui import run_project_creator
44
+ run_project_creator()
40
45
  except ImportError as e:
41
46
  print(f"错误: 无法导入UI模块 - {e}")
42
47
  print("请确保已安装PyQt6: pip install PyQt6")
@@ -9,7 +9,7 @@
9
9
  #
10
10
  import re
11
11
 
12
- VERSION = "0.5.7a0"
12
+ VERSION = "0.5.7a"
13
13
  AUTHOR = "●ω<🤍♪"
14
14
  STEAM_ID = "1029562896"
15
15
  GITHUB_NAME = "EagleBaby"
Binary file
@@ -0,0 +1,14 @@
1
+ import sys
2
+ from PyQt6.QtWidgets import QApplication
3
+ from pyscreeps_arena.ui.qcreeplogic import QPSACreepLogic
4
+
5
+
6
+
7
+ def run_creeplogic_edit():
8
+ app = QApplication(sys.argv)
9
+ window = QPSACreepLogic()
10
+ window.show()
11
+ sys.exit(app.exec())
12
+
13
+ if __name__ == '__main__':
14
+ run_creeplogic_edit()
@@ -15,6 +15,7 @@ from pyscreeps_arena.core import const
15
15
  from pyscreeps_arena.ui.rs_icon import get_pixmap
16
16
 
17
17
 
18
+
18
19
  class ProjectCreatorUI(QMainWindow):
19
20
  def __init__(self):
20
21
  super().__init__()
@@ -0,0 +1,3 @@
1
+ from pyscreeps_arena.ui.qcreeplogic.qcreeplogic import QPSACreepLogic
2
+
3
+
@@ -0,0 +1,72 @@
1
+ from typing import List, Optional, Union
2
+ from pyscreeps_arena.ui.qrecipe.model import PartsVector
3
+
4
+ class NamedRecipe:
5
+ def __init__(self, name: str, recipe: List[str]):
6
+ self.name = name
7
+ self.recipe = recipe
8
+
9
+ class CreepLogicSettings:
10
+ """
11
+ 爬虫逻辑设置类,用于定义爬虫的基本属性和行为。
12
+ """
13
+
14
+ def __init__(self):
15
+ # ---------------------- 爬虫本体 | Creep --------------------------- #
16
+ self.draw: bool = False # 是否绘制爬虫信息
17
+ self.layer: int = 10 # 爬虫绘制图层,默认为10
18
+
19
+ # ---------------------- 流程与结构 | Flow & Struct --------------------------- #
20
+ self.link: Union[List[str], str, None] = None # 爬虫逻辑链接
21
+ self.once: bool = True # 是否禁用死亡后重生
22
+
23
+ # ---------------------- 孵化选项 | Spawning --------------------------- #
24
+ self.spawnable = True # 是否可以孵化标志
25
+ self.recipe: Union[List[str], NamedRecipe] = ["MOVE"] # 爬虫配方,默认为["MOVE"]
26
+ self.optimise: bool = True # 自动优化配方标志
27
+ self.extension: bool = True # 使用extension标志
28
+ self.direction: Optional[int] = None # 出生方向
29
+
30
+ # ---------------------- 基本信息 | Basic Info --------------------------- #
31
+ self.name: str = "" # 爬虫名称
32
+
33
+ def to_dict(self) -> dict:
34
+ """
35
+ 将设置转换为字典格式
36
+ """
37
+ return {
38
+ "name": self.name,
39
+ "draw": self.draw,
40
+ "layer": self.layer,
41
+ "link": self.link,
42
+ "once": self.once,
43
+ "spawnable": self.spawnable,
44
+ "recipe": self.recipe if isinstance(self.recipe, list) else self.recipe.name,
45
+ "optimise": self.optimise,
46
+ "extension": self.extension,
47
+ "direction": self.direction
48
+ }
49
+
50
+ @classmethod
51
+ def from_dict(cls, data: dict) -> "CreepLogicSettings":
52
+ """
53
+ 从字典格式创建设置对象
54
+ """
55
+ settings = cls()
56
+ settings.name = data.get("name", "")
57
+ settings.draw = data.get("draw", False)
58
+ settings.layer = data.get("layer", 10)
59
+ settings.link = data.get("link", None)
60
+ settings.once = data.get("once", True)
61
+ settings.spawnable = data.get("spawnable", True)
62
+ settings.recipe = data.get("recipe", ["MOVE"])
63
+ settings.optimise = data.get("optimise", True)
64
+ settings.extension = data.get("extension", True)
65
+ settings.direction = data.get("direction", None)
66
+ return settings
67
+
68
+ def reset(self):
69
+ """
70
+ 重置所有设置为默认值
71
+ """
72
+ self.__init__()