Beispiel #1
0
    async def cmd____play(self, msg):
        if msg.chat_id > 0:  # нельзя играть одному
            await self.telebot.sendMessage(
                msg.chat_id,
                f"{msg.sender.first_name}, игру можно создать только в групповом чате не менее, чем на 4 человек."
            )
            return

        if self.app["games"].get(msg.chat_id,
                                 None) is not None:  # нельзя пересоздать игру
            return

        assert msg.chat_id < 0
        game = Game(msg.chat_id, self.app)
        game.add_player(msg.sender.id)
        self.app["games"][msg.chat_id] = game

        await self.telebot.sendMessage(
            msg.chat_id,
            f"*{msg.sender.first_name} {msg.sender.last_name}* желает начать новую игру.",
            reply_markup={
                "inline_keyboard": [[{
                    "text": "✔️ Присоединиться",
                    "callback_data": "/play:join"
                }, {
                    "text": "👎 Отказаться",
                    "callback_data": "/play:decline"
                }]]
            })
        # await self.sendAnimation("https://eva-bot.ru/res/small_timer_00_30.gif")
        self.app.loop.create_task(
            self.set_timeout_function(msg.chat_id, game.start, timer=1))
        return
Beispiel #2
0
os.environ['draw_unlock'] = 'resources/buttons/comprar_mais.png'
os.environ['draw_lock'] = 'resources/buttons/comprar_mais_lock.png'
os.environ['backgound_grid'] = 'resources/static/game_background_grid.png'
os.environ['end_turn'] = 'resources/buttons/end_turn.png'

from app.game.Game import *

game_state = 2
qntd_jogos = 1
close_game = False
game_list = []
for i in range(qntd_jogos):
    if close_game:
        break
    jogo = Game()
    jogo.add_player('G', 0)
    jogo.add_player('S', 1)
    end_game = False
    mouse_offset = (0, 0)
    tile_moving = -1
    for k in range(14):
        for player in jogo.players:
            player.doneMeld = False
            player.draw(jogo.deck)
            jogo.reset_player_tiles_position(player)
            player.sort_hand_rep()
    while not end_game and not close_game:
        is_moving_piece = False
        for player in jogo.players:
            if close_game or end_game:
                break