From 9b1c994b4438289966e74109fbecc7e0456fe137 Mon Sep 17 00:00:00 2001 From: Jonas Zeunert Date: Mon, 6 Jun 2022 17:52:12 +0200 Subject: [PATCH] Rewrite: Functionality to write content to special display --- displays/Display.py | 5 ++++- displays/SpecialDisplay.py | 4 ++-- events/StartBallEvent.py | 6 ++++-- networking/Networking.py | 3 +++ 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/displays/Display.py b/displays/Display.py index 2d84238..59ca35d 100644 --- a/displays/Display.py +++ b/displays/Display.py @@ -5,4 +5,7 @@ class Display: self.name = name def printScore(self, score): - networking.writeDisplayScore(self.name, score) \ No newline at end of file + networking.writeDisplayScore(self.name, score) + + def printContent(self, content): + networking.writeDisplayContent(self.name, content) \ No newline at end of file diff --git a/displays/SpecialDisplay.py b/displays/SpecialDisplay.py index 4f5aa5d..cca1b2f 100644 --- a/displays/SpecialDisplay.py +++ b/displays/SpecialDisplay.py @@ -8,9 +8,9 @@ class SpecialDisplay(Display): self.ballsToPlay = 0 def printScore(self): - super().printScore(int(str(self.credits).zfill(2) + super().printContent(str(self.credits).zfill(2) + str(self.gameTimeBonus).zfill(2) - + str(self.ballsToPlay).zfill(2))) + + str(self.ballsToPlay).zfill(2)) def printBallsToPlay(self, ballsToPlay): self.ballsToPlay = ballsToPlay diff --git a/events/StartBallEvent.py b/events/StartBallEvent.py index 7c310f9..c345a0c 100644 --- a/events/StartBallEvent.py +++ b/events/StartBallEvent.py @@ -7,14 +7,16 @@ from solenoids.MainFlipper import MainFlipper class StartBallEvent(Event): - def __init__(self): + def __init__(self, gameState): + self.gameState = gameState self.flipper = MainFlipper() super().__init__("Start Ball Event") def trigger(self, target): super().trigger(target) - self.flipper.activate() BottomRightBankSolenoid().trigger() BottomLeftBankSolenoid().trigger() TopCentralBankSolenoid().trigger() OutHoleSolenoid().trigger() + self.flipper.activate() + self.gameState.currentPlayer.activate() diff --git a/networking/Networking.py b/networking/Networking.py index dbcb609..b2b19f3 100644 --- a/networking/Networking.py +++ b/networking/Networking.py @@ -56,6 +56,9 @@ class Networking: def writeDisplayScore(self, display, score): self.get("/displays/" + display + "/write_score/" + str(score)) + def writeDisplayContent(self, display, content): + self.get("/displays/" + display + "/write_content/" + content) + async def getInputEvent(self): header = list() while b'\x02' not in header: