Fix lag if run from lobby
This commit is contained in:
4
lobby.py
4
lobby.py
@@ -29,6 +29,7 @@ class Lobby:
|
|||||||
|
|
||||||
# Network
|
# Network
|
||||||
self.networkManager = NetworkManager()
|
self.networkManager = NetworkManager()
|
||||||
|
self.isUpdating = True
|
||||||
|
|
||||||
# First
|
# First
|
||||||
self.nameDisplay()
|
self.nameDisplay()
|
||||||
@@ -97,6 +98,7 @@ class Lobby:
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
|
if self.isUpdating:
|
||||||
messages = self.networkManager.requestMessages()
|
messages = self.networkManager.requestMessages()
|
||||||
scores = self.networkManager.requestScores()
|
scores = self.networkManager.requestScores()
|
||||||
|
|
||||||
@@ -169,6 +171,7 @@ class Lobby:
|
|||||||
self.win.iconify()
|
self.win.iconify()
|
||||||
|
|
||||||
# Display
|
# Display
|
||||||
|
self.isUpdating = False
|
||||||
quadraLudi.main(self.win, lambda score: self.playEnd(score))
|
quadraLudi.main(self.win, lambda score: self.playEnd(score))
|
||||||
|
|
||||||
def playEnd(self, score):
|
def playEnd(self, score):
|
||||||
@@ -176,6 +179,7 @@ class Lobby:
|
|||||||
self.win.deiconify()
|
self.win.deiconify()
|
||||||
self.win.focus_force()
|
self.win.focus_force()
|
||||||
self.chatEntry.focus()
|
self.chatEntry.focus()
|
||||||
|
self.isUpdating = True
|
||||||
|
|
||||||
# Send score
|
# Send score
|
||||||
self.sendScore(score)
|
self.sendScore(score)
|
||||||
|
|||||||
Reference in New Issue
Block a user