Permalink
Browse files

track's selection

  • Loading branch information...
cflavio committed Jul 10, 2018
1 parent 1f4ef2b commit 281e473b5e374a772b9fee3cb0490ec64de39de4
Showing with 16 additions and 6 deletions.
  1. +1 −1 menu/menu.py
  2. +7 −0 menu/multiplayer/multiplayerfrm.py
  3. +5 −4 menu/trackpage.py
  4. +2 −0 yorg/client.py
  5. +1 −1 yorg/fsm.py
@@ -53,7 +53,7 @@ def on_push_page(self, page_code, args=[]):
page.gui.attach(self.on_track_selected)
if page_code == 'trackpageserver':
self.eng.log('track page server')
page = TrackPageServer(args[0])
page = TrackPageServer(args[0], args[1])
page.gui.attach(self.on_track_selected)
if page_code == 'new_season':
self.eng.log('new season')
@@ -383,6 +383,7 @@ def on_invite_answer(self, from_, roomname, val):
nick = self.yorg_client.myid
self.create_match_frm(roomname, False)
self.notify('on_create_room', roomname, nick)
self.yorg_client.attach(self.on_track_selected_msg)
else:
self.eng.client.send(['declined', self.yorg_client.myid, from_])
#self.eng.xmpp.client.send_message(
@@ -407,6 +408,12 @@ def process_msg_client(self, data_lst, sender):
self.users_frm.set_size(False)
self.msg_frm.show()
def on_track_selected_msg(self, track):
self.eng.log_mgr.log('track selected: ' + track)
self.notify('on_start_match_client', track)
self.users_frm.set_size(False)
self.msg_frm.show()
def on_declined(self, msg):
self.eng.log('on declined')
self.users_frm.on_declined(msg)
@@ -9,8 +9,9 @@
class TrackPageGui(ThanksPageGui):
def __init__(self, mediator, trackpage_props):
def __init__(self, mediator, trackpage_props, room):
self.props = trackpage_props
self.room = room
ThanksPageGui.__init__(self, mediator, trackpage_props.gameprops.menu_args)
def build(self):
@@ -55,16 +56,16 @@ class TrackPageGuiServer(TrackPageGui):
def on_track(self, track):
self.notify('on_track_selected', track)
self.notify('on_push_page', 'carpageserver', [self.props])
self.eng.server.send([NetMsgs.track_selected, track])
self.eng.client.send(['track_selected', track, self.room])
class TrackPage(Page):
gui_cls = TrackPageGui
def __init__(self, trackpage_props):
def __init__(self, trackpage_props, room):
init_lst = [
[('event', self.event_cls, [self])],
[('gui', self.gui_cls, [self, trackpage_props])]]
[('gui', self.gui_cls, [self, trackpage_props, room])]]
GameObject.__init__(self, init_lst)
PageFacade.__init__(self)
# invoke Page's __init__
@@ -44,6 +44,8 @@ def on_msg(self, data_lst, sender):
self.notify('on_declined', data_lst[1])
if data_lst[0] == 'presence_available_room':
self.notify('on_presence_available_room', data_lst[1], data_lst[2])
if data_lst[0] == 'track_selected':
self.notify('on_track_selected_msg', data_lst[1])
def find_usr(self, uid):
return [usr for usr in self.users if usr.uid == uid][0]
@@ -88,7 +88,7 @@ def on_presence_unavailable_room(self, msg):
self.__menu.enable(False)
def on_start_match(self):
self.__menu.logic.on_push_page('trackpageserver', [self.__menu_props])
self.__menu.logic.on_push_page('trackpageserver', [self.__menu_props, self.mediator.logic.mp_frm.msg_frm.curr_match_room])
def on_start_match_client(self, track):
self.mediator.logic.mp_frm.on_track_selected()

0 comments on commit 281e473

Please sign in to comment.