Exemplo n.º 1
0
class TileController(TileEventProcessor):
    """ Manages the display of board tiles for the ScreenController """

    def __init__(self, eventId, session):
        super(TileController, self).__init__(eventId, session)
        self.tileViews = []
        self.tilePositionModel = BoardTileModel()

    def remove(self, id):
        tilePositionRemoved = self.tilePositionModel.removeTilePositionWithId(id)
        if tilePositionRemoved is not None:
            self.tileViews.remove(TileView(tilePositionRemoved))

    def add(self, id, tilePosition, data):
        if self.tilePositionModel.addTilePositionWithId(id, tilePosition) is not None:
            self.tileViews.append(TileView(tilePosition))

    def draw(self, drawOnto):
        for tileView in self.tileViews:
            tileView.draw(drawOnto)
Exemplo n.º 2
0
 def __init__(self, eventId, session):
     super(TileController, self).__init__(eventId, session)
     self.tileViews = []
     self.tilePositionModel = BoardTileModel()