Skip to content

Commit

Permalink
fix(network): fixed lobby handover to flayfield
Browse files Browse the repository at this point in the history
  • Loading branch information
HOOK-Hawkins committed Mar 7, 2024
1 parent 56790e7 commit 3652623
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions UI/field_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def _display_widgets(self):
class field_controller():
def __init__(self, view, players):
self.view = view
sub_controller = gamefield_controller(self.view.gamefield)
self.sub_controller = gamefield_controller(self.view.gamefield)
for player_lbl, player in zip(self.view.player, players):
player_lbl.set(player.display_name, player_type.unknown)
self._bind()
Expand All @@ -71,10 +71,10 @@ def error(self, *args):
msg.display()

class Field(base_frame):
def __init__(self, master, *args, start_player, start_symbol, opponent, opponent_symbol, **kwargs):
def __init__(self, master, *args, starting_player, starting_player_symbol, opponent, opponent_symbol, **kwargs):
super().__init__(master)
self._create_widgets()
self.controller = field_controller(self, tuple(start_player, opponent))
self.controller = field_controller(self, [starting_player, opponent])
self._display_widgets()
#self.bind("<<game/turn>>", self.controller.sub_controller.turn)
#self.bind("<<game/end>>", self.controller.end)
Expand Down
2 changes: 1 addition & 1 deletion UI/gamefield.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, view: gamefield):

def _bind(self):
for position, button in self.view.fields.items():
button.config(command=lambda e=position: self._game_input(self, e))
button.config(command=lambda e=position: self._game_input(e))

def draw_field(self, matrix=None, position=None, value=None): #either matrix as a 3x3 list or position and value need to be provided
if matrix != None:
Expand Down
5 changes: 3 additions & 2 deletions UI/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _display_widgets(self,):

def _update_lobby(self):
queue = self.master.in_queue.get()
#print(queue)
self.playerlist = []
for player in queue['player']:
self.playerlist.append([tk.Label(self, text=player.display_name),
tk.Button(self, text='Kick', command=lambda uuid=player.uuid, *args: self.master.out_queue.put({'message_type': 'lobby/kick', 'args' : {'player_to_kick_index': uuid}}))])
Expand All @@ -64,8 +64,9 @@ def _update_lobby(self):
player[1].grid(sticky=tk.E+tk.W+tk.N+tk.S, column=4, row=4+i)


def _start_game(self, event):
def _start_game(self):
queue = self.master.in_queue.get()
print(queue)
self.master.show(Field, **queue)

def on_destroy(self):
Expand Down

0 comments on commit 3652623

Please sign in to comment.