예제 #1
0
        def __init__(self, parent=None):
            Control.__init__(self, parent=parent, **r2d((0, 0, 820, 720)))
            self.btn_getready = Button(
                parent=self, caption=u'准备', **r2d((360, 80, 100, 35))
            )

            self.ready = False

            l = []

            class MyPP(PlayerPortrait):
                # this class is INTENTIONALLY put here
                # to make cached avatars get gc'd
                cached_avatar = {}

            for x, y, color in parent.ui_class.portrait_location:
                l.append(MyPP('NONAME', parent=self, x=x, y=y, color=color))
            self.portraits = l

            @self.btn_getready.event
            def on_click():
                if self.ready:
                    Executive.call('cancel_ready', ui_message, [])
                    self.ready = False
                    self.btn_getready.caption = u'准备'
                    self.btn_getready.update()
                else:
                    Executive.call('get_ready', ui_message, [])
                    #self.btn_getready.state = Button.DISABLED
                    self.ready = True
                    self.btn_getready.caption = u'取消准备'
                    self.btn_getready.update()
예제 #2
0
    def __init__(self, texture, prompt, parent, *a, **k):
        self.texture = texture
        self.prompt = prompt

        width = texture.width
        height = texture.height

        x = (parent.width - width) // 2
        y = (parent.height - height) // 2

        self._x = x
        self._y = y

        Control.__init__(self, *a, x=x, y=y, width=width, height=height, parent=parent, zindex=999999, **k)

        ta = TextArea(
            parent=self,
            # font_size=12,
            x=2, y=2, width=width, height=100,
        )

        ta.append(prompt)
        h = ta.content_height
        ta.height = h
        self.ta_height = h
예제 #3
0
파일: view.py 프로젝트: AojiaoZero/thbattle
 def __init__(self, **k):
     pyglet.graphics.Batch.__init__(self)
     Control.__init__(
         self, x=0, y=0,
         width=0, height=0, zindex=2,
         **k
     )
예제 #4
0
    def __init__(self, texture, prompt, parent, *a, **k):
        self.texture = texture
        self.prompt = prompt

        width = texture.width
        height = texture.height + 80

        x = (parent.width - width) // 2
        y = (parent.height - height) // 2

        self._x = x
        self._y = y

        Control.__init__(self, *a, x=x, y=y, width=width, height=height, parent=parent, zindex=999999, **k)

        ta = TextArea(
            parent=self,
            # font_size=12,
            x=2, y=2, width=width, height=100,
        )

        ta.append(prompt)
        h = ta.content_height
        ta.height = h
        self.ta_height = h
예제 #5
0
 def __init__(self, **k):
     pyglet.graphics.Batch.__init__(self)
     Control.__init__(
         self, x=0, y=0,
         width=0, height=0, zindex=2,
         **k
     )
     self.animations = []
예제 #6
0
 def batch_draw(gcps):
     glPushMatrix()
     glLoadIdentity()
     Frame.batch_draw(gcps)
     GameCharacterPortrait.batch_draw_status(gcps)
     glPopMatrix()
     cl = []
     map(cl.extend, [p.control_list for p in gcps])
     Control.do_draw(cl)
예제 #7
0
 def batch_draw(gcps):
     glPushMatrix()
     glLoadIdentity()
     Frame.batch_draw(gcps)
     GameCharacterPortrait.batch_draw_status(gcps)
     glPopMatrix()
     cl = []
     map(cl.extend, [p.control_list for p in gcps])
     Control.do_draw(cl)
예제 #8
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 = card.ui_meta.image_small
        self.init_balloon(card.ui_meta.description)
예제 #9
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 = card.ui_meta.image_small
        self.init_balloon(card.ui_meta.description)
예제 #10
0
 def __init__(self, x0, y0, x1, y1, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     from math import sqrt, atan2, pi
     self.x, self.y = x0, y0
     dx, dy = x1 - x0, y1 - y0
     scale = sqrt(dx * dx + dy * dy) / common_res.ray.width
     self.angle = atan2(dy, dx) / pi * 180
     self.scale = SineInterp(0.0, scale, 0.4)
     self.alpha = ChainInterp(FixedInterp(1.0, 1),
                              CosineInterp(1.0, 0.0, 0.5),
                              on_done=lambda self, desc: self.delete())
예제 #11
0
    def __init__(self, x0, y0, x1, y1, *args, **kwargs):
        Control.__init__(self, *args, **kwargs)
        from math import sqrt, atan2, pi

        self.x, self.y = x0, y0
        dx, dy = x1 - x0, y1 - y0
        scale = sqrt(dx * dx + dy * dy) / L("c-ray").width
        self.angle = atan2(dy, dx) / pi * 180
        self.scale = SineInterp(0.0, scale, 0.4)
        self.alpha = ChainInterp(
            FixedInterp(1.0, 1), CosineInterp(1.0, 0.0, 0.5), on_done=lambda self, desc: self.delete()
        )
예제 #12
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.alpha = 1.0
        self.card = card

        self.ft_anim = False

        self.update()
예제 #13
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.alpha = 1.0
        self.card = card

        self.ft_anim = False

        self.update()
예제 #14
0
파일: view.py 프로젝트: CoolCloud/thbattle
    def __init__(self, game, *a, **k):
        self.game = game
        game.event_observer = UIEventHook

        Control.__init__(self, *a, **k)

        self.char_portraits = None

        self.deck_indicator = DeckIndicator(parent=self, x=30, y=680, width=50, height=25)

        self.handcard_area = HandCardArea(parent=self, x=238, y=9, zindex=3, width=93 * 5 + 42, height=145)

        self.deck_area = PortraitCardArea(
            parent=self, width=1, height=1, x=self.width // 2, y=self.height // 2, zindex=4
        )

        self.btn_afk = Button(parent=self, caption=u"让⑨帮你玩", zindex=1, color=Colors.blue, **r2d((730, 640, 75, 25)))

        self.gameintro_icon = GameIntroIcon(parent=self, game=game, **r2d((780, 610, 25, 25)))

        self.afk = False

        @self.btn_afk.event
        def on_click():
            v = not self.afk
            self.afk = v
            self.btn_afk.color = (Colors.blue, Colors.orange)[v]
            self.btn_afk.update()

        @self.handcard_area.event
        def on_selection_change():
            self.dispatch_event("on_selection_change")

        self.dropcard_area = DropCardArea(parent=self, x=0, y=324, zindex=3, width=820, height=125)

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(self, x=0, y=0, width=0, height=0, zindex=2, **k)

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
예제 #15
0
        def __init__(self, parent=None):
            Control.__init__(self, parent=parent, **r2d((0, 0, 820, 720)))
            self.btn_getready = Button(
                parent=self, caption=u'准备', **r2d((360, 80, 100, 35))
            )

            self.btn_invite = Button(
                parent=self, caption=u'邀请', **r2d((360, 40, 100, 35))
            )

            self.ready = False

            l = []

            class MyPP(PlayerPortrait):
                # this class is INTENTIONALLY put here
                # to make cached avatars get gc'd
                cached_avatar = {}

            for x, y, color in parent.ui_class.portrait_location:
                l.append(MyPP('NONAME', parent=self, x=x, y=y, color=color))
            self.portraits = l

            @self.btn_getready.event
            def on_click():
                if self.ready:
                    Executive.call('cancel_ready', ui_message, [])
                    self.ready = False
                    self.btn_getready.caption = u'准备'
                    self.btn_getready.update()
                else:
                    Executive.call('get_ready', ui_message, [])
                    #self.btn_getready.state = Button.DISABLED
                    self.ready = True
                    self.btn_getready.caption = u'取消准备'
                    self.btn_getready.update()

            @self.btn_invite.event  # noqa
            def on_click():
                GameScreen.InvitePanel(self.parent.game.gameid, parent=self)
예제 #16
0
파일: screens.py 프로젝트: hycxa/thbattle
        def __init__(self, parent=None):
            Control.__init__(self, parent=parent, **r2d((0, 0, 820, 720)))
            self.btn_getready = Button(parent=self, caption=u"准备", **r2d((360, 80, 100, 35)))

            self.btn_invite = Button(parent=self, caption=u"邀请", **r2d((360, 40, 100, 35)))

            self.ready = False

            l = []

            class MyPP(PlayerPortrait):
                # this class is INTENTIONALLY put here
                # to make cached avatars get gc'd
                cached_avatar = {}

            for x, y, color in parent.ui_class.portrait_location:
                l.append(MyPP("NONAME", parent=self, x=x, y=y, color=color))
            self.portraits = l

            @self.btn_getready.event
            def on_click():
                if self.ready:
                    Executive.call("cancel_ready", ui_message, [])
                    self.ready = False
                    self.btn_getready.caption = u"准备"
                    self.btn_getready.update()
                else:
                    Executive.call("get_ready", ui_message, [])
                    # self.btn_getready.state = Button.DISABLED
                    self.ready = True
                    self.btn_getready.caption = u"取消准备"
                    self.btn_getready.update()

            @self.btn_invite.event  # noqa
            def on_click():
                GameScreen.InvitePanel(self.parent.game.gameid, parent=self)
예제 #17
0
파일: view.py 프로젝트: feisuzhu/thbattle
    def __init__(self, game, *a, **k):
        self.selection_change = ObservableEvent()

        self.game = game

        Control.__init__(self, can_focus=True, *a, **k)

        self.keystrokes = '\x00'
        self.char_portraits = None

        self.deck_indicator = DeckIndicator(
            parent=self, x=30, y=660, width=50, height=25,
        )

        self.handcard_area = HandCardArea(
            parent=self, view=self, x=238, y=9, zindex=3,
            width=93*5+42, height=145,
        )

        self.deck_area = PortraitCardArea(
            parent=self, width=1, height=1,
            x=self.width//2, y=self.height//2, zindex=4,
        )

        self.btn_afk = OptionButton(
            parent=self, zindex=1, conf=(
                (u'让⑨帮你玩', Colors.blue, False),
                (u'⑨在帮你玩', Colors.orange, True),
            ), **r2d((30, 625, 75, 25))
        )

        self.gameintro_icon = GameIntroIcon(
            parent=self, game=game,
            **r2d((690, 630, 25, 25))
        )

        self.dropcard_area = DropCardArea(
            parent=self, x=0, y=324, zindex=3,
            width=820, height=125,
        )

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(
                    self, x=0, y=0,
                    width=0, height=0, zindex=2,
                    **k
                )
                self.animations = []

            def delete(self):
                Control.delete(self)
                for a in self.animations:
                    a.delete()

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
        self.action_params = {}
예제 #18
0
파일: view.py 프로젝트: feisuzhu/thbattle
 def delete(self):
     Control.delete(self)
     for a in self.animations:
         a.delete()
예제 #19
0
 def __init__(self, fold_size=4, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.width, self.height = 35*4, 46
     self.fold_size = fold_size
     self.selectable = False
예제 #20
0
 def __init__(self, fold_size=5, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.fold_size = fold_size
     self.view = kwargs['parent']
예제 #21
0
 def __init__(self, fold_size=4, view=None, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.width, self.height = 35*4, 46
     self.fold_size = fold_size
     self.selectable = False
     self.view = view
예제 #22
0
 def __init__(self, fold_size=5, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.fold_size = fold_size
예제 #23
0
 def delete(self):
     Control.delete(self)
     for a in self.animations:
         a.delete()
예제 #24
0
    def __init__(self, game, *a, **k):
        self.selection_change = ObservableEvent()

        self.game = game

        Control.__init__(self, can_focus=True, *a, **k)

        self.keystrokes = '\x00'
        self.char_portraits = None

        self.deck_indicator = DeckIndicator(
            parent=self,
            x=30,
            y=660,
            width=50,
            height=25,
        )

        self.handcard_area = HandCardArea(
            parent=self,
            view=self,
            x=238,
            y=9,
            zindex=3,
            width=93 * 5 + 42,
            height=145,
        )

        self.deck_area = PortraitCardArea(
            parent=self,
            width=1,
            height=1,
            x=self.width // 2,
            y=self.height // 2,
            zindex=4,
        )

        self.btn_afk = OptionButton(parent=self,
                                    zindex=1,
                                    conf=(
                                        (u'让⑨帮你玩', Colors.blue, False),
                                        (u'⑨在帮你玩', Colors.orange, True),
                                    ),
                                    **r2d((30, 625, 75, 25)))

        self.gameintro_icon = GameIntroIcon(parent=self,
                                            game=game,
                                            **r2d((690, 630, 25, 25)))

        self.dropcard_area = DropCardArea(
            parent=self,
            x=0,
            y=324,
            zindex=3,
            width=820,
            height=125,
        )

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(self,
                                 x=0,
                                 y=0,
                                 width=0,
                                 height=0,
                                 zindex=2,
                                 **k)
                self.animations = []

            def delete(self):
                Control.delete(self)
                for a in self.animations:
                    a.delete()

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
        self.action_params = {}
예제 #25
0
 def __init__(self, game, *a, **k):
     Control.__init__(self, *a, **k)
     intro = getattr(game.ui_meta, 'description', None)
     intro and self.init_balloon(intro, width=480)
예제 #26
0
    def __init__(self, game, *a, **k):
        self.game = game
        game.event_observer = UIEventHook

        Control.__init__(self, *a, **k)

        self.char_portraits = None

        self.deck_indicator = DeckIndicator(
            parent=self,
            x=30,
            y=680,
            width=50,
            height=25,
        )

        self.handcard_area = HandCardArea(
            parent=self,
            x=238,
            y=9,
            zindex=3,
            width=93 * 5 + 42,
            height=145,
        )

        self.deck_area = PortraitCardArea(
            parent=self,
            width=1,
            height=1,
            x=self.width // 2,
            y=self.height // 2,
            zindex=4,
        )

        self.btn_afk = Button(parent=self,
                              caption=u'让⑨帮你玩',
                              zindex=1,
                              color=Colors.blue,
                              **r2d((730, 640, 75, 25)))

        self.gameintro_icon = GameIntroIcon(parent=self,
                                            game=game,
                                            **r2d((780, 610, 25, 25)))

        self.afk = False

        @self.btn_afk.event
        def on_click():
            v = not self.afk
            self.afk = v
            self.btn_afk.color = (Colors.blue, Colors.orange)[v]
            self.btn_afk.update()

        @self.handcard_area.event
        def on_selection_change():
            self.dispatch_event('on_selection_change')

        self.dropcard_area = DropCardArea(
            parent=self,
            x=0,
            y=324,
            zindex=3,
            width=820,
            height=125,
        )

        class Animations(pyglet.graphics.Batch, Control):
            def __init__(self, **k):
                pyglet.graphics.Batch.__init__(self)
                Control.__init__(self,
                                 x=0,
                                 y=0,
                                 width=0,
                                 height=0,
                                 zindex=2,
                                 **k)

            def hit_test(self, x, y):
                return False

        self.animations = Animations(parent=self)
        self.selecting_player = 0
예제 #27
0
파일: view.py 프로젝트: feisuzhu/thbattle
 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)
예제 #28
0
 def __init__(self, fold_size=5, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.fold_size = fold_size
     self.view = kwargs['parent']
예제 #29
0
 def __init__(self, fold_size=5, *args, **kwargs):
     Control.__init__(self, *args, **kwargs)
     self.fold_size = fold_size
예제 #30
0
 def __init__(self, *a, **k):
     Control.__init__(self, *a, **k)
     self.selection = []
예제 #31
0
 def __init__(self, *a, **k):
     Control.__init__(self, *a, **k)
     self.selection = []
예제 #32
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)
예제 #33
0
파일: view.py 프로젝트: AojiaoZero/thbattle
 def __init__(self, game, *a, **k):
     Control.__init__(self, *a, **k)
     intro = getattr(game.ui_meta, 'description', None)
     intro and self.init_balloon(intro, width=480)