예제 #1
0
    def __init__(self, card, x=0.0, y=0.0, *args, **kwargs):
        Control.__init__(self, *args, **kwargs)
        self._w, self._h = 33, 46
        self.x, self.y = x, y
        self.selected = False
        self.hover = False
        self.card = card

        self.img = L(card.ui_meta.image_small)
        self.balloon = balloon = BalloonPrompt(self)
        balloon.set_balloon(card.ui_meta.description)
예제 #2
0
    def __init__(self, card, x=0.0, y=0.0, *args, **kwargs):
        Control.__init__(self, *args, **kwargs)

        self._w, self._h = 91, 125
        self.shine = False
        self.gray = False
        self.x, self.y = x, y
        self.shine_alpha = 0.0
        self.selected = False
        self.alpha = 1.0
        self.card = card

        self.ft_anim = False
        self.balloon = BalloonPrompt(self)

        self.update()
예제 #3
0
    def __init__(self, x=0.0, y=0.0, color=Colors.blue, tag_placement='me', *args, **kwargs):
        self.bg = None
        self.character = None
        self._color = color
        self._disabled = False
        self._last_balloon = None
        self.player = None
        self._selected = False
        self.taganims = []
        self.tag_placement = tag_placement

        Frame.__init__(
            self, width=149, height=195,
            bot_reserve=20, color=color,
            thin_shadow=True,
            **kwargs
        )
        self.balloon = BalloonPrompt(self, self.balloon_show)

        self.view = view = self.parent
        self.x, self.y = x, y

        self.charname_lbl = self.add_label(
            u'', 7, self.height-30,
            width=16, multiline=True,
            font_size=9,
            anchor_x='left', anchor_y='top',
            color=(255, 255, 255, 255),
            shadow=(1, 0, 0, 0, 179),
        )

        self.portcard_area = PortraitCardArea(
            parent=view,
            x=self.x, y=self.y,
            width=self.width, height=self.height,
            zindex=100,
        )
        self.equipcard_area = EquipCardArea(
            view=view, parent=self, x=3, y=6,
        )

        w, h = self.width, self.height

        tbl = view.game.ui_meta.identity_table
        colortbl = view.game.ui_meta.identity_color
        conf = [(tbl[k], getattr(Colors, colortbl[k]), k) for k in tbl]

        self.identity_btn = b = OptionButton(
            conf=conf, default=0, parent=self,
            x=w-42-4, y=h-24-10-18,
            width=42, height=18,
        )

        @b.event
        def on_value_changed(v):
            self.set_color(b.color)

        def tagarrange_bottom():
            x, y = self.x, self.y
            w = self.width
            x += w + 1
            y -= 27
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                x -= 27
                a.set_position(x, y)

        def tagarrange_me():
            x, y = self.x, self.y
            w = self.width
            x += w + 6
            y += 142
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                x += 27

        def tagarrange_right():
            x, y = self.x, self.y
            w = self.width
            x += w + 3
            y += 1
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                y += 27

        def tagarrange_left():
            x, y = self.x, self.y
            x -= 28
            y += 1
            for a in self.taganims:  # they are pyglet.sprite.Sprite instances
                a.set_position(x, y)
                y += 27

        self._tagarrange_funcs = {
            'bottom': tagarrange_bottom,
            'me': tagarrange_me,
            'left': tagarrange_left,
            'right': tagarrange_right,
        }

        showncard_btn = ImageButton(
            L('c-buttons-port_showncard'),
            parent=self,
            x=self.width - 22, y=90,
        )

        @showncard_btn.event  # noqa
        def on_click():
            p = self.character
            if not p: return
            if not p.showncardlists: return  # before the 'real' game_start
            last = ShownCardPanel.current
            if last:
                last.delete()
                if last.character is p:
                    return

            ShownCardPanel(p, parent=self.view)
예제 #4
0
 def __init__(self, game, *a, **k):
     Control.__init__(self, *a, **k)
     intro = getattr(game.ui_meta, 'description', None)
     if intro:
         balloon = BalloonPrompt(self)
         balloon.set_balloon(intro, width=480)