Ejemplo n.º 1
0
 def __init__(self):
     Menu.__init__(self, textctrl=ScrollableTextFrame())
     self.addText(
         'Resume',
         #'Controls',
         #'Load Game',
         'Show Damage: ' +
         ('OFF', 'ON ')[system.engine.player.stats.damageind],
         'Set Controls',
         'Exit to Title')
     self.autoSize()
     self.Border = self.textCtrl.wnd.iLeft.width
Ejemplo n.º 2
0
 def __init__(self):
     self.equipWindow = EquipWindow()
     self.portraitWindow = PortraitWindow()
     self.statWindow = gui.FrameDecorator(StatPreviewWindow())
     self.itemList = InventoryWindow(stats.inventory)
     self.equipMenu = gui.FrameDecorator(Menu(textctrl=self.equipWindow))
     self.itemMenu = gui.FrameDecorator(Menu(textctrl=self.itemList))
     self.charIdx = 0
     self.slotIdx = 0
     self.itemMenu.cursor = _nullCursor
     self.state = self.updateEquipWindow
     self.description = gui.FrameDecorator(gui.StaticText(text=['','']))
Ejemplo n.º 3
0
    def __init__(self):
        self.skillWindow = SkillWindow()
        self.menu = gui.FrameDecorator(Menu(textctrl=self.skillWindow))
        self.portraitWindow = PortraitWindow()
        self.statWindow = gui.FrameDecorator(StatusWindow())
        self.charidx = 0

        self.description = gui.FrameDecorator(gui.StaticText(text=['', '']))
Ejemplo n.º 4
0
def selectCharacter(parent=None, caption='Use on whom?'):
    # A menu to select a character from the active roster.
    # TODO: maybe make this a bit more elaborate.
    caption = gui.FrameDecorator(gui.StaticText(text=caption))
    menu = gui.FrameDecorator(Menu())
    caption.autoSize()

    for char in stats.activeRoster:
        menu.addText(char.name)

    menu.autoSize()
    menu.width = max(menu.width, caption.width)
    caption.width = menu.width

    layout = VerticalBoxLayout(pad=8, children=[caption, menu])
    layout.layout()
    layout.position = ((ika.Video.xres - layout.width) / 2,
                       (ika.Video.yres - layout.height) / 2)

    menu.x += layout.x
    menu.y += layout.y
    caption.x += layout.x
    caption.y += layout.y

    draw = parent and parent.draw or ika.Map.Render

    trans = Transition()
    trans.addChild(caption, startRect=(caption.x, -caption.height))
    trans.addChild(menu, startRect=(menu.x, ika.Video.yres))
    trans.execute(draw)

    result = None
    while result is None:
        result = menu.update()

        draw()
        caption.draw()
        menu.draw()
        ika.Video.ShowPage()

    trans.addChild(caption, endRect=(caption.x, -caption.height))
    trans.addChild(menu, endRect=(menu.x, ika.Video.yres))
    trans.execute(draw)

    return result
Ejemplo n.º 5
0
    def __init__(self):
        StatelessProxy.__init__(self)
        if len(self.__dict__) != 0:
            return
        # "static constructor" logic follows

        mm = self.mainMenu = gui.FrameDecorator(Menu())

        self.statbar = gui.FrameDecorator(StatusBar())
        self.statbar.refresh()
        self.statbar.dockRight().dockTop()
        self.miscwindow = gui.FrameDecorator(MiscWindow())
        self.miscwindow.refresh()
        self.miscwindow.dockRight().dockBottom()

        self.setMenuItems(self.createMenuItems())

        mm.autoSize()
        mm.dockTop().dockLeft()
Ejemplo n.º 6
0
 def __init__(self, statbar):
     self.statbar = statbar
     self.itemList = self.createInventoryWindow()
     self.menu = gui.FrameDecorator(Menu(textctrl=self.itemList))
     self.description = self.createDescriptionBar()
Ejemplo n.º 7
0
def textMenu(where, *args, **kwargs):
    """Displays a text frame with list of options.

    """

    options = kwargs.get('options', [])
    menu = Menu(textctrl=ScrollableTextFrame())
    menu.addText(*options)
    menu.autoSize()

    frame = gui.Frame()

    portrait, text, side = None, '', ''

    if len(args) == 1:
        text = args[0]
    elif len(args) == 2:
        portrait, text = args
    elif len(args) == 3:
        portrait, side, text = args
    else:
        assert False, 'text recieves 1 or two arguments.'

    textBox = TextBox(where, portrait, side, text)

    menu.width += 16  #hack!
    #menu.dockBottom(textBox.frame)
    menu.y = textBox.frame.y
    if where == 'right':
        menu.dockRight(textBox.frame)
        #menu.dockTop(textBox.frame)
        #menu.x = textBox.frame.x - menu.width - 20

        menu.x -= 20  #hack hack!
    else:
        menu.dockLeft(textBox.frame)
        menu.x += 20  #hack hack!

    #menu.y-=24 #hack hack haaaaack!!

    engine.things.append(textBox)
    engine.things.append(menu)

    result = None
    try:
        engine.beginCutScene()
        while True:  #not (controls.attack1() or controls.joy_attack1() or controls.ui_accept()):
            engine.tick()
            engine.draw()
            menu.draw()
            result = menu.update()
            if result is None:
                continue
            else:

                break

    finally:
        engine.endCutScene()
        engine.things.remove(textBox)
        engine.things.remove(menu)
        return result
Ejemplo n.º 8
0
 def __init__(self):
     Menu.__init__(self, textctrl=ScrollableTextFrame())
     #self.select = -1
     self.refreshContents()
     self.maxwidth = 0
Ejemplo n.º 9
0
 def __init__(self):
     Menu.__init__(self, textctrl=ScrollableTextFrame())
     self.addText('Yes', 'No')
     self.autoSize()
     self.Border = self.textCtrl.wnd.iLeft.width