Beispiel #1
0
def goWaitForConnection(isHost, ipAddress, mapS=None):
    tryAgain = True
    while tryAgain:
        tryAgain = False
        if isHost:
            p = netserver.NetThread()
        else:
            p = netclient.NetThread(ipAddress)
        p.start()
        while not m.either():
            proceedMulti(clock)
            if not p.isAlive():
                if p.flag == "success":
                    m.advanceNow = True
                else:
                    m.backNow = True

        if m.back():
            prev = m.phase
            m.changePhase(5)
            m.reset()
            while not m.advance():
                proceedMulti(clock)
            if m.menu.value() == 1:
                tryAgain = True
                m.changePhase(prev)
                m.reset()
        elif m.advance():
            if isHost:
                netcode.updateSend(p.net.conn, mapS)
            else:
                mapS = netcode.updateRecv(p.net.s, 2)
            theMap = gamemap.getMap(mapS)
            goCharacterSelection(p.net, isHost)
Beispiel #2
0
def goWaitForConnection(isHost, ipAddress, mapS=None):
    tryAgain = True
    while tryAgain:
        tryAgain = False
        if isHost:
            p = netserver.NetThread()
        else:
            p = netclient.NetThread(ipAddress)
        p.start()
        while not m.either():
            proceedMulti(clock)
            if not p.isAlive():
                if p.flag == "success":
                    m.advanceNow = True
                else:
                    m.backNow = True

        if m.back():
            prev = m.phase
            m.changePhase(5)
            m.reset()
            while not m.advance():
                proceedMulti(clock)
            if m.menu.value() == 1:
                tryAgain = True
                m.changePhase(prev)
                m.reset()
        elif m.advance():
            if isHost:
                netcode.updateSend(p.net.conn, mapS)
            else:
                mapS = netcode.updateRecv(p.net.s, 2)
            theMap = gamemap.getMap(mapS)
            goCharacterSelection(p.net, isHost)
Beispiel #3
0
    def transferPregameData(self, playerChars, expected):
        enemyData = []
        for i in range(expected):
            inMsg = netcode.updateRecv(self.s,
                                       CHARACTER_TRANSFER_NET_MESSAGE_SIZE)
            enemyData.append(inMsg)

        for i in playerChars:
           netcode.updateSend(self.s, i.getTextString(True))

        return mapchar.convertNetData(enemyData, 0)
Beispiel #4
0
    def transferPregameData(self, playerChars, expected):
        enemyData = []
        for i in range(expected):
            inMsg = netcode.updateRecv(self.s,
                                       CHARACTER_TRANSFER_NET_MESSAGE_SIZE)
            enemyData.append(inMsg)

        for i in playerChars:
            netcode.updateSend(self.s, i.getTextString(True))

        return mapchar.convertNetData(enemyData, 0)
Beispiel #5
0
    def update(self, outMsg, msgSize=None):
        inMsg = netcode.updateRecv(self.s, msgSize)
        netcode.updateSend(self.s, outMsg)

        return inMsg, 1
Beispiel #6
0
    def update(self, outMsg, msgSize=None):
        netcode.updateSend(self.conn, outMsg)
        inMsg = netcode.updateRecv(self.conn, msgSize)

        return inMsg, 2
Beispiel #7
0
    def update(self, outMsg, msgSize=None):            
        netcode.updateSend(self.conn, outMsg)
        inMsg = netcode.updateRecv(self.conn, msgSize)

        return inMsg, 2
Beispiel #8
0
    def update(self, outMsg, msgSize=None):
        inMsg = netcode.updateRecv(self.s, msgSize)
        netcode.updateSend(self.s, outMsg)

        return inMsg, 1