コード例 #1
0
 def delStrategy(self, rid):
     req = {
         "code": 1015,
         "rid": rid,
         "serial": getSerial(),
     }
     protocol.sendMessage(self.gw_mac, req)
コード例 #2
0
 def delGroup(self, gid):
     req = {
         "code": 1007,
         "gid": gid,
         "serial": getSerial(),
     }
     protocol.sendMessage(self.gw_mac, req)
コード例 #3
0
    def sendControlDict(self, group_name, paraDict):
        # 得到分组 的 信息
        gInfo = self.getInfo(group_name)
        self.gid = gInfo.get("gid")

        #发出请求
        req = {
            "code": 1006,
            "gid": self.gid,
            "serial": getSerial(),
            "streams": paraDict
        }
        protocol.sendMessage(self.gw_mac, req)
コード例 #4
0
ファイル: login_screen.py プロジェクト: Mondobot/Bomberman
	def _login(self):
		user = self.user.value;
		passwd = self.passwd.value;

		if not network.isConnected():
			network.connect()

		# plain silly, we need to remove this
		if network.isConnected():
			ans = protocol.sendMessage(TYPE = protocol.LOGIN, USER = user, PASS = passwd)

			if ans == True:
				state.logged_in = True
				state.in_game_select = True
				return

			else:
				title = "Error"
				err_msg = "Invalid username or password"

		else:
			title, err_msg = network.getError()

		# If the login was incorrect prompt the user
		CustomDialog(title, err_msg).open()
コード例 #5
0
ファイル: game_room.py プロジェクト: Mondobot/Bomberman
	def startGame(self):
		ok = protocol.sendMessage(TYPE = protocol.START)
		print "am trimis start"

		if ok:
			state.in_game_lobby = False
			state.in_game = True
コード例 #6
0
ファイル: game_select.py プロジェクト: Mondobot/Bomberman
	def create(self):
		ok = protocol.sendMessage(TYPE = protocol.CREATE)

		if ok:
			state.in_game_select = False
			state.in_game_lobby = True
			state.game_owner = True

		print "game_ownerrr ", state.game_owner
コード例 #7
0
ファイル: game_select.py プロジェクト: Mondobot/Bomberman
	def join(self):
		if self.selection:
			print "join"
			ok = protocol.sendMessage(TYPE = protocol.JOIN,
									ID = self.selection.gameID)

			if ok:
				state.in_game_select = False
				state.in_game_lobby = True
				state.game_owner = False
コード例 #8
0
 def send2gw(self):
     self.delGroup(self.gid)
     protocol.sendMessage(self.gw_mac, self.gjson)
コード例 #9
0
 def send2gw(self):
     self.delStrategy(self.rid)
     protocol.sendMessage(self.gw_mac, self.sJson)
     return
コード例 #10
0
ファイル: main.py プロジェクト: Mondobot/Bomberman
game_lobby_screen = None
owner = None


# -------- Main Program Loop -----------
while not done:

    
    for event in pygame.event.get(): # User did something
        if event.type == pygame.QUIT: # If user clicked close
            done = True # Flag that we are done so we exit this loop

        elif state.in_game == True and event.type == pygame.KEYUP:
            if not world.players[world.me].walking:
                 if event.key == pygame.K_UP:
                    protocol.sendMessage(TYPE = MOVE, DIR = NORTH)
                 elif event.key == pygame.K_DOWN:
                    protocol.sendMessage(TYPE = MOVE, DIR = SOUTH)
                 elif event.key == pygame.K_RIGHT:
                    protocol.sendMessage(TYPE = MOVE, DIR = EAST)
                 elif event.key == pygame.K_LEFT:
                    protocol.sendMessage(TYPE = MOVE, DIR = WEST)
                 elif event.key == pygame.K_b:
                    protocol.sendMessage(TYPE = DROP)

        elif not state.logged_in:
            login_screen.event(event)

        elif state.in_game_select:
            game_select_screen.event(event)