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)
def run(): global m global v global c global clock m = mvc.Model() v = mvc.View() c = mvc.Controller() clock = framerate.FrameRate(FRAME_RATE) mList = [] vList = [] cList = [] if DEBUG_MODE: debugLoop = True while debugLoop: changeMVC(debug_m.Model(), debug_v.View(), menu_c.Controller(), screen) while not m.advance(): proceed(clock) if m.debugMenu.value() == 1: goBattle(battle_m.testData(), None) elif m.debugMenu.value() == 2: currMap = gamemap.getMap("00") changeMVC(mapdebug_m.Model(currMap), mapdebug_v.View(), mapdebug_c.Controller(), screen) while not m.advance(): proceed(clock) elif m.debugMenu.value() == 3: goCharacterSelection(None, True) elif m.debugMenu.value() == 4: debugLoop = False elif m.debugMenu.value() == 5: sys.exit() goTitle() fade = True while 1: goMainMenu(fade) fade = False
def parseNetMessage(self, msg, p): if msg[0] == 'm': wasRandom = (msg[1] == 'r') map = gamemap.getMap(msg[2:4]) self.selectMap(map, wasRandom) elif msg[0] == 'c': panelNum = int(msg[2:4]) self.characterPanels[panelNum].setData("") elif msg[0] == 'r': panelNum = int(msg[1]) panel = self.readyPanels[panelNum] panel.setData(ReadyData(not panel.data.value)) self.goPanel = None self.createGoPanel() elif msg[0] == 's': self.starting = True