Mods
This commit is contained in:
parent
9fcc9d31f8
commit
2b9eb8a4fd
|
@ -270,8 +270,10 @@ class Game:
|
|||
else:
|
||||
return
|
||||
|
||||
if Game.merge_charge < Config.merge_goal:
|
||||
Game.merge_charge += 1
|
||||
|
||||
if Settings.merge:
|
||||
if Game.merge_charge >= Config.merge_goal:
|
||||
nums.insert(0, Method.merge)
|
||||
weights.insert(0, 1)
|
||||
|
@ -467,10 +469,19 @@ class Game:
|
|||
menu = QMenu(Window.root.widget())
|
||||
update = QAction("Update")
|
||||
restart = QAction("Restart")
|
||||
|
||||
if Settings.merge:
|
||||
merge = QAction("Merge: On")
|
||||
else:
|
||||
merge = QAction("Merge: Off")
|
||||
|
||||
update.triggered.connect(Game.force_update)
|
||||
restart.triggered.connect(Game.restart)
|
||||
merge.triggered.connect(Settings.toggle_merge)
|
||||
|
||||
menu.addAction(update)
|
||||
menu.addAction(restart)
|
||||
menu.addAction(merge)
|
||||
menu.exec_(QCursor.pos())
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "1.2.0",
|
||||
"version": "1.4.0",
|
||||
"title": "Cromulant",
|
||||
"program": "cromulant",
|
||||
"author": "madprops",
|
||||
|
|
|
@ -7,6 +7,7 @@ from .storage import Storage
|
|||
class Settings:
|
||||
speed: str
|
||||
mode: str
|
||||
merge: bool
|
||||
|
||||
@staticmethod
|
||||
def prepare() -> None:
|
||||
|
@ -20,11 +21,14 @@ class Settings:
|
|||
mode = Settings.mode.capitalize()
|
||||
Window.mode.setCurrentText(mode)
|
||||
|
||||
Settings.merge = settings.get("merge", True)
|
||||
|
||||
@staticmethod
|
||||
def save() -> None:
|
||||
settings = {
|
||||
"speed": Settings.speed,
|
||||
"mode": Settings.mode,
|
||||
"merge": Settings.merge,
|
||||
}
|
||||
|
||||
Storage.save_settings(settings)
|
||||
|
@ -38,3 +42,8 @@ class Settings:
|
|||
def set_mode(mode: str) -> None:
|
||||
Settings.mode = mode
|
||||
Settings.save()
|
||||
|
||||
@staticmethod
|
||||
def toggle_merge() -> None:
|
||||
Settings.merge = not Settings.merge
|
||||
Settings.save()
|
||||
|
|
|
@ -224,7 +224,7 @@ class Window:
|
|||
container = QHBoxLayout()
|
||||
|
||||
btn_menu = QPushButton("Menu")
|
||||
btn_menu.setToolTip("Restart with a new set of ants")
|
||||
btn_menu.setToolTip("The main menu")
|
||||
btn_menu.clicked.connect(Game.menu)
|
||||
|
||||
Window.speed = QComboBox()
|
||||
|
|
Loading…
Reference in New Issue