Example #1
0
 def data_received(self, data):
     d = PacketType.Deserializer()
     d.update(data)
     print("enter data_receive")
     for gamePacket in d.nextPackets():
         if isinstance(gamePacket, gamePackage.GameCommandPacket):
             print(gamePacket.command_line)
             command = gamePacket.command_line
             print("command")
             self.game.command(command)
         elif isinstance(gamePacket, gamePackage.GameInitPacket):
             print("1")
             print(process_game_init(gamePacket))
             print("Game started")
             gameRequirePacket = create_game_require_pay_packet(
                 '9821389123', "ymao22_account", 5)
             self.transport.write(gameRequirePacket.__serialize__())
             print("Game started new")
         elif isinstance(gamePacket, gamePackage.GamePayPacket):
             receipt, receipt_sig = process_game_pay_packet(gamePacket)
             print(receipt)
             print(receipt_sig)
             self.game = escape_room_006.EscapeRoomGame(output=self.send)
             self.game.create_game()
             self.game.start()
             self.loop = asyncio.get_event_loop()
             self.loop.create_task(self.flyingkey_event())
Example #2
0
 async def play(self):
     self.game = er.EscapeRoomGame(output=self.write)
     self.game.create_game()
     self.game.start()
     print("Game started")
     #asyncio.ensure_future(self.game.start())
     await asyncio.wait(
         [asyncio.ensure_future(a) for a in self.game.agents])
Example #3
0
 def connection_made(self, transport):
     print("connection made")
     self.transport = transport
     self.game = escape_room_006.EscapeRoomGame(output=self.send)
     self.game.create_game()
     self.game.start()
     self.loop = asyncio.get_event_loop()
     self.loop.create_task(self.flyingkey_event())