def __init__( self, board, category ): self.board = board self.category = category self.goods = GameItemTypes.getSubAttributes( self.category ) self.__producers = GameItemTypes.getObjectTypesWithAttribute( self.category + ".*", lambda v : v > 0 ) self.__detailedConsumers = GameItemTypes.getObjectTypesWithAttribute( self.category + ".*", lambda v : v < 0 ) self.__globalConsumers = GameItemTypes.getObjectTypesWithAttribute( self.category, lambda v : v < 0 )
def drawObjectInPolygon( self, resourceType, polygon, rotation ): matrix = cairo.Matrix() matrix.scale( MapView.__pixelPerUnit, MapView.__pixelPerUnit ) x, y = polygon.center width, height = GameItemTypes.getObjectSize( resourceType ) matrix.translate( width, height ) matrix.rotate( -rotation * math.pi / 4 ) matrix.translate( -x, -y ) pattern = PatternRepository.getPattern( "buildings", resourceType ) pattern.set_matrix( matrix ) self.ctx.set_source( pattern ) self.ctx.paint()
def __drawSurface( self, surface ): self.__drawPolygons( self.board.getSurface( surface ).polygons, *GameItemTypes.getSurfaceColor( surface ) )
def __init__( self, board ): self.board = board self.categories = GameItemTypes.getSubAttributes( "Housing" ) self.__houses = GameItemTypes.getObjectTypesWithAttribute( "Housing.*" )