def __init__(self, location, team): self.colour = ConfigReader.getColourForId(team) self.view = PieceView(self.colour, (location,)) self.location = location self.moves = 2 self.moveColour = ConfigReader.getColourForId(team+"Moving") self.team = team
def selectEvent(self, tilePosition): self.clearSelectEvent() if self.piecesModel.isPieceAt(tilePosition): logging.debug("Select event for %s", tilePosition) pieceData = self.piecesModel.getDataForPiecesAt(tilePosition)[0] self.moveSelectionsModel = self.selectionController.setSelectedTile( tilePosition, colour=ConfigReader.getColourForId("SelectedTile") ) self.selectionController.setInfoTiles( self.tilePositionModel.positionsOnBoardIn(HexCoordSys.getTilesWithin(pieceData.moves, tilePosition)), self.moveSelectionsModel, ConfigReader.getColourForId("Info1Tile"), type(OverlayView((), ())), ) self.pathSelectionModel = self.selectionController.setSelectedTile(tilePosition)
def __init__(self, tilePosition): self.surface = pygame.image.load("./hextile.png").convert() self.surface.set_colorkey(ConfigReader.getColourForId('TRANSPARENT_COLOR_KEY'), RLEACCEL) self.boundingBox = self.surface.get_rect() self.boundingBox.center = HexCoordSys.hexToPixel(tilePosition, TILE_EDGE_LENGTH, CENTER) self.views = [] self.addView(TextView("%d,%d" % (tilePosition.row, tilePosition.col))) self.tilePosition = tilePosition
def __init__(self): self.surface = pygame.image.load("./hexcursor.png").convert() self.surface.set_colorkey(ConfigReader.getColourForId('TRANSPARENT_COLOR_KEY'), RLEACCEL) self.boundingBox = self.surface.get_rect() self.tilePosUnderCursor = None self.setPosition(0,0)
def __init__(self, text): self.surface = pygame.font.Font(pygame.font.get_default_font(),12).render(text, 0, ConfigReader.getColourForId('WHITE')) self.boundingBox = self.surface.get_rect() self.setPosition(0,0)
def clearSurface(self): self.drawOn.fill(ConfigReader.getColourForId('LIGHT_GREY'))