コード例 #1
0
    def on_start_dealing(self, message):
        world = self.world
        for player in world.players:
            kxg.info("Dealing to player {player}).")

            new_hand = self.draw_cards(6)
            self >> messages.DealToPlayer(player, new_hand)
コード例 #2
0
    def on_execute(self, world):
        for card in self.cards:
            card.in_play = True
        self.player.hand = self.cards[:]

        codes = [card.code for card in self.cards]
        kxg.info("Dealing cards to {self.player}. Cards: {codes}")
コード例 #3
0
ファイル: messages.py プロジェクト: alexmitchell/cribbage
    def on_execute(self, world):
        for card in self.cards:
            card.in_play = True
        self.player.hand = self.cards[:]

        codes = [card.code for card in self.cards]
        kxg.info("Dealing cards to {self.player}. Cards: {codes}")
コード例 #4
0
ファイル: gui.py プロジェクト: alexmitchell/cribbage
    def on_deal_to_player(self, message):
        (card_x, card_y) = self.world.card_size
        if self.player == message.player:
            codes = [card.code for card in self.player.hand]
            kxg.info("Cards deltith to {self.player}. Cards: {codes}")

            for (i, card) in enumerate(self.player.hand):

                self.hand_buttons[i].assign_card(card)
コード例 #5
0
ファイル: gui.py プロジェクト: alexmitchell/cribbage
    def on_deal_to_player(self, message):
        (card_x, card_y) = self.world.card_size
        if self.player == message.player:
            codes = [card.code for card in self.player.hand]
            kxg.info("Cards deltith to {self.player}. Cards: {codes}")

            for (i, card) in enumerate(self.player.hand):

                self.hand_buttons[i].assign_card(card)
コード例 #6
0
ファイル: gui.py プロジェクト: kxgames/pie_in_the_sky
    def on_mouse_press(self, x, y, button, modifiers):
        # Send a "ShootBullet" signal when the user left-clicks.
        if button == 1:
            target = self.focus_point
            cannon = self.player.cannons[0]

            direction = (target - cannon.position).unit
            velocity = cannon.muzzle_speed * direction
            position = cannon.position + 40 * direction

            bullet = tokens.Bullet(cannon, position, velocity)

            if self.player.can_shoot(bullet):
                self >> messages.ShootBullet(bullet)
            else:
                kxg.info("Not enough arsenal to shoot bullet!")
コード例 #7
0
    def on_create_player(self, message):
        num_players_joined = len(self.world.players)
        kxg.info("{num_players_joined} of {self.num_players_expected} players created.")

        if num_players_joined == self.num_players_expected:
            self >> messages.StartGame(self.world)
コード例 #8
0
ファイル: 40_test_theaters.py プロジェクト: kxgames/kxg
def log_something():
    kxg.info("Hello World!")