can now join game and begin polling gamestate

This commit is contained in:
2023-04-27 23:19:40 -07:00
parent c513a08b28
commit 8efc5a9d9e
3 changed files with 208 additions and 12 deletions

View File

@@ -57,6 +57,20 @@ class GameFrame(wx.Frame):
self.app = app
self.panel = wx.Panel(self)
self.SetMinSize(Constants.minimum_window_size)
self.last_lobby_state = []
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.get_game_status, self.timer)
self.timer.Start(500)
def get_game_status(self, event=None):
if connection_check() and self.app.in_game:
self.app.parse_response(send(f"game get_status {self.app.game_id}"))
if self.app.lobby == self.last_lobby_state:
# If the current lobby state is the same as the last one, don't update the list control
return
# Save the new lobby state
self.last_lobby_state = self.app.lobby
class LobbyFrame(wx.Frame):
@@ -116,7 +130,7 @@ class LobbyFrame(wx.Frame):
# Save the new lobby state
self.last_lobby_state = self.app.lobby
def highlight_current_player(self):
def highlight_current_player(self, event=None):
if self.current_player_index is not None:
self.list_ctrl.Select(self.current_player_index)
else: