def on_select(self, model, x, y): Hotspot.on_select(self, model, x, y) item = self.items[self.selection_y] if item.text != "": model.display_info(item.effect.name+"<br /><br />"+item.effect.description) else: model.display_info(None)
def __init__(self, x, y, width, height): Layer.__init__(self, x, y, width, height, [255.0, 0.0, 0.0]) Hotspot.__init__(self, x, y, width, height, columns=len(CommandBar.BUTTONS), hover_type=Hotspot.HOVER_CLICK) self.batches = graphics.Batch() self.commands = [] for text in CommandBar.BUTTONS: self.create_label(text) self.redistribute_labels()
def __init__(self, x, y, width, height): Layer.__init__(self, x, y, width, height, [255.0, 0.0, 255.0]) self.batches = graphics.Batch() self.items = [] self.line_quantity = height / GameView.EFFECTS_LINE_HEIGHT for i in range(self.line_quantity): self.items.append(text.Label(font_name=GameView.FONT_NAME, font_size=GameView.EFFECTS_FONT_SIZE, x=x, y=y+i*GameView.EFFECTS_LINE_HEIGHT, batch=self.batches)) Hotspot.__init__(self, x, y, width, height, rows=self.line_quantity)
def update(self, components = None): world = State.model().game Layer.update(self, components) Hotspot.__init__(self, self.x, self.y, self.width, self.height, world.rows, world.columns) if components is None or 'cursor' in components: self.update_cursor(); elif components == None: y = 0 for depth in xrange(-world.depth, world.height): floor = World.FLOORS[depth] self.items[0][y].text = floor['name'] self.items[0][y].depth = depth y += 1
def on_select(self, model, x, y): ''' The player just hovered over a tile, update the UI to indicate what is present in the tile. ''' Hotspot.on_select(self, model, x, y) tile = model.map.get_tile(self.grid_x + x, self.grid_y + y) text = None if tile is not None: if tile.entity is not None: text = tile.entity.name elif tile.room is not None: text = tile.room.name + " " + str(tile.room.count_connections()) model.display_info(text) model.do_update('log')
def __init__(self, x, y, width, height, font_name=View.FONT_NAME, font_size=View.FONT_SIZE, line_height=(View.FONT_SIZE*1.2), columns=1, column_width=None): ListLayer.__init__(self, x, y, width, height, font_name, font_size, line_height, columns, column_width) hotspot_height = self.line_height*self.rows hotspot_y = y + height - hotspot_height Hotspot.__init__(self, x, hotspot_y, self.column_width*self.columns, hotspot_height, rows=self.rows, columns=self.columns)
def __init__(self, x, y, width, height, rows=1, columns=1, hover_type=Hotspot.HOVER_HIDDEN): Hotspot.__init__(self, x, y, width, height, rows, columns, hover_type)
def on_focus_lost(self, model): Hotspot.on_focus_lost(self, model) model.display_info(None)