Esempio n. 1
0
    def init(self):
        SoundManager.se_suppress()
        self.game_event = ObservableEvent()

        self.game_event += self.on_game_event

        n = len(self.game.players)
        ports = self.char_portraits = [
            GameCharacterPortrait(parent=self, color=color,
                                  x=x, y=y, tag_placement=tp)
            for x, y, tp, color in self.gcp_location[:n]
        ]

        pl = self.game.players
        shift = pl.index(self.game.me)
        for i, c in enumerate(ports):
            self.game_event += c.on_game_event
            p = pl[(shift + i) % n]
            c.player = p
            c.update()

        ports[0].equipcard_area.selectable = True  # it's TheChosenOne

        self.begin_select_player()
        self.end_select_player()
        self.skill_box = SkillSelectionBox(
            parent=self, x=161, y=9, width=70, height=22*6-4
        )

        SoundManager.switch_bgm('thb-bgm_game')

        self.more_init()
Esempio n. 2
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 = {}
Esempio n. 3
0
 def __init__(self, *a, **k):
     dict.__init__(self, *a, **k)
     dict.__setattr__(self, 'setting_change', ObservableEvent())