def __init__(self, x, y, width, height): ActiveListLayer.__init__(self, x, y, width, height, font_name=WorldView.FONT_NAME, font_size=WorldView.FONT_SIZE, line_height=WorldView.LINE_HEIGHT) y = 0 for depth, floor in World.FLOORS.iteritems(): self.items[0][y].text = floor['name'] self.items[0][y].depth = depth y += 1
def on_select(self, model, selection_x, selection_y): ActiveListLayer.on_select(self, model, selection_x, selection_y) item = self.items[0][selection_y] if item.text != "": model.display_info(item.action.name+"<br /><br />"+item.action.description) else: model.display_info(None)
def __init__(self, title, x, y, width, height, header, description_y, columns=1): height -= 50 ActiveListLayer.__init__(self, x, y, width, height, InventoryView.FONT_NAME, InventoryView.FONT_SIZE, InventoryView.LINE_HEIGHT, columns=columns, column_width=width/columns) text.Label(text=title, color=(255, 127, 80, 255), font_name=InventoryView.FONT_NAME, font_size=InventoryView.FONT_SIZE, x=x, y=height+34, batch=self.batches) text.Label(text=header, color=(150, 150, 150, 255), font_name=InventoryView.FONT_NAME, font_size=InventoryView.HEADER_FONT_SIZE, x=x, y=height+15, batch=self.batches) self.title = text.Label(font_name=InventoryView.FONT_NAME, font_size=InventoryView.FONT_SIZE, x=850, y=height-description_y, batch=self.batches) self.description = text.HTMLLabel(x=870, y=height-description_y-20, width=300, multiline=True, batch=self.batches)
def update(self, components = None): ActiveListLayer.update(self, components) if components is None or 'stance' in components: player = State.model().player for i in range(min(len(player.actions), self.rows)): action = player.actions[i] x = i / self.rows y = i self.items[x][y].text = action.name self.items[x][y].action = action
def update(self, components = None): ActiveListLayer.update(self, components) player = State.model().player slots = self.rows * self.columns i = 0 for action in player.actions: if i < slots: x = i / self.rows y = i - self.columns*x self.items[x][y].text = action.name self.items[x][y].action = action i += 1 else: break;
def update(self, components = None): ActiveListLayer.update(self, components) player = State.model().player slots = self.rows * self.columns i = 0 for trait in player.traits: if (i < slots): x = i / self.rows y = i - self.columns*x self.items[x][y].text = trait.name self.items[x][y].trait = trait i += 1 else: break;
def update(self, components = None): ActiveListLayer.update(self, components) if components is None or 'inventory' in components: player = State.model().player for i in range(min(len(player.inventory), self.rows)): x = i / self.rows y = i item = player.inventory[i] text = "" if item in player.equipment[item.equip_slot]: text += "e " else: text += " " text += item.name self.items[x][y].text = text self.items[x][y].item = item
def update(self, components = None): ActiveListLayer.update(self, components) player = State.model().player slots = self.rows * self.columns i = 0 for prop in properties.Property.all: if i < slots: x = i / self.rows y = i - self.rows*x name = prop.name value = str(player.get(prop)) spacing = " "*(19 - len(prop.name) + 3 - len(value)) self.items[x][y].text = name + spacing + value self.items[x][y].prop = prop i += 1 else: break;
def update_cursor(self): ActiveListLayer.update_cursor(self) if self.has_focus: self.update_description(self.items[self.selection_x][self.selection_y])
def __init__(self, x, y, width, height): ActiveListLayer.__init__(self, x, y, width, height, PropertiesView.FONT_NAME, PropertiesView.FONT_SIZE, PropertiesView.LINE_HEIGHT, columns=4, column_width=180) self.title = text.Label(font_name=PropertiesView.FONT_NAME, font_size=PropertiesView.FONT_SIZE, x=800, y=height-50, batch=self.batches) self.modifiers = text.Label(font_name=PropertiesView.FONT_NAME, font_size=PropertiesView.MODS_FONT_SIZE, x=800, y=height-70, width=250, multiline=True, batch=self.batches)
def update(self, components = None): ActiveListLayer.update(self, components) self.update_list()
def __init__(self, x, y, width, height): ActiveListLayer.__init__(self, x, y, width, height, ActionsView.FONT_NAME, ActionsView.FONT_SIZE, ActionsView.LINE_HEIGHT, columns=3, column_width=250) self.title = text.Label(font_name=ActionsView.FONT_NAME, font_size=ActionsView.FONT_SIZE, x=800, y=height-50, batch=self.batches) self.description = text.Label(font_name=ActionsView.FONT_NAME, font_size=ActionsView.DESCRIPTION_FONT_SIZE, x=820, y=height-70, width=300, multiline=True, batch=self.batches)
def draw(self): ActiveListLayer.draw(self);
def __init__(self, x, y, width, height, tile_width, tile_height, color): ActiveListLayer.__init__(self, x, y, width, height, color)
def on_focus_lost(self, model): ActiveListLayer.on_focus_lost(self, model) model.display_info(None)
def __init__(self, x, y, width, height): ActiveListLayer.__init__(self, x, y, width, height)