add: Print to special disp

This commit is contained in:
Jonas Zeunert
2022-06-06 19:00:49 +02:00
parent b362442bb8
commit 3185efd0c6
3 changed files with 12 additions and 5 deletions

View File

@@ -2,10 +2,13 @@ import logging
from lamps.LampGroup import PLAYER_LAMPS
class GameState:
def __init__(self, players, highscore, currentPlayerID = 0):
def __init__(self, players, highscore, specialDisplay, currentPlayerID = 0):
self.players = players
self.gameStateID = currentPlayerID
self.highscore = highscore
self.credits = 3
self.specialDisplay = specialDisplay
self.specialDisplay.printCredits(self.credits)
PLAYER_LAMPS.activateNext()
@property

View File

@@ -23,7 +23,6 @@ TUNNEL_SCORES = [20000, 30000, 50000]
BONUS_MULTIPLIER = [1, 10, 20, 50]
UPPER_PLAYFIELD_TIME = [5, 10, 20, 30]
class PlayerState:
display = None
specialDisplay = None
@@ -137,6 +136,7 @@ class PlayerState:
Lamp("Right Advance Time").deactivate()
def reset(self):
self.printSpecial()
self.upperPlayfieldTimer = None
self.upperPlayfieldTimeIter = iter(UPPER_PLAYFIELD_TIME)
self.upperPlayfieldTime = next(self.upperPlayfieldTimeIter)
@@ -188,6 +188,10 @@ class PlayerState:
BottomLeftBankSolenoid().trigger()
TopCentralBankSolenoid().trigger()
def printSpecial(self):
self.specialDisplay.printBallsToPlay(self.ballsLeft)
self.specialDisplay.printGameTimeBonus(self.bonusTime)
def advanceRightOrangeSpecial(self):
self.orangeSpecialRight = True
self.setOrangeSpecialLit()

View File

@@ -15,11 +15,11 @@ class GameFactory:
def __init__(self):
displayNames = networking.getDisplays()['displays']
self.displayFactory = DisplayFactory(displayNames)
specialDisplay = self.displayFactory.createSpecialDisplay()
self.specialDisplay = self.displayFactory.createSpecialDisplay()
self.playerCount = len(displayNames)
self.gameStateFactory = PlayerStateFactory(specialDisplay)
self.gameStateFactory = PlayerStateFactory(self.specialDisplay)
def createGame(self):
@@ -29,7 +29,7 @@ class GameFactory:
banks = [targets['Left Bank'], targets['Right Bank'], targets['Top Bank']]
players = self.createPlayers(banks)
gameState = GameState(players, self.getHighScore(), players[0].id)
gameState = GameState(players, self.getHighScore(), self.specialDisplay, players[0].id)
eventFactory = EventFactory(targets, gameState)
events = eventFactory.allEvents()