Permalink
Browse files

multiplayer's car selection

  • Loading branch information...
cflavio committed Oct 10, 2017
1 parent a75bc97 commit 9ebb959fbd3f35135f50ce9d5d7d28dbece95ae8
Showing with 35 additions and 7 deletions.
  1. +2 −6 menu/carpage.py
  2. +8 −0 menu/menu.py
  3. +2 −0 yorg/fsm.py
  4. +22 −0 yorg/logic.py
  5. +1 −1 yyagl
View
@@ -136,9 +136,7 @@ def process(k):
self.eng.server.send(packet)
self.eng.log_mgr.log('start race: ' + str(packet))
curr_car = self.current_cars[self]
# manage as event
#game.logic.season = SingleRaceSeason()
#game.fsm.demand('Race', self.track_path, curr_car, packet[2:])
self.notify('on_car_start_server', self.track_path, curr_car, packet)
def process_srv(self, data_lst, sender):
if data_lst[0] != NetMsgs.car_request: return
@@ -194,9 +192,7 @@ def process_client(self, data_lst, sender):
btn.enable()
if data_lst[0] == NetMsgs.start_race:
self.eng.log_mgr.log('start_race: ' + str(data_lst))
# manage as event
#game.logic.season = SingleRaceSeason()
#game.fsm.demand('Race', self.track_path, self.car, data_lst[2:])
self.notify('on_car_start_client', self.track_path, self.car, data_lst)
class CarPage(Page):
View
@@ -47,10 +47,12 @@ def on_push_page(self, page_code, args=[]):
page.gui.attach(self.on_car_selected)
if page_code == 'carpageserver':
page = CarPageServer(args[0], self.mdt.track)
page.gui.attach(self.on_car_start_server)
page.gui.attach(self.on_car_selected)
if page_code == 'carpageclient':
page = CarPageClient(args[0], self.mdt.track)
page.gui.attach(self.on_car_selected)
page.gui.attach(self.on_car_start_client)
if page_code == 'driver_page':
page = DriverPage(args[0], args[1], args[2])
page.gui.attach(self.on_driver_selected)
@@ -82,6 +84,12 @@ def on_track_selected(self, track):
def on_car_selected(self, car):
self.mdt.gui.notify('on_car_selected', car)
def on_car_start_server(self, track, car, packet):
self.mdt.gui.notify('on_car_start_server', track, car, packet)
def on_car_start_client(self, track, car, packet):
self.mdt.gui.notify('on_car_start_client', track, car, packet)
def on_car_selected_season(self, car):
self.mdt.gui.notify('on_car_selected_season', car)
View
@@ -35,6 +35,8 @@ def enterMenu(self):
methods = [self.mdt.logic.on_input_back,
self.mdt.logic.on_options_back,
self.mdt.logic.on_car_selected,
self.mdt.logic.on_car_start_server,
self.mdt.logic.on_car_start_client,
self.mdt.logic.on_car_selected_season,
self.mdt.logic.on_driver_selected,
self.mdt.logic.on_continue]
View
@@ -90,6 +90,28 @@ def on_car_selected(self, car):
self.season.attach_obs(self.mdt.event.on_season_cont)
self.season.start()
def on_car_start_server(self, track, car, packet):
dev = self.mdt.options['development']
self.season = SingleRaceSeason(self.__season_props(
self.mdt.gameprops, car,
self.mdt.options['settings']['cars_number'], True, 0, 0, 0,
dev['race_start_time'], dev['countdown_seconds']))
self.season.attach_obs(self.mdt.event.on_season_end)
self.season.attach_obs(self.mdt.event.on_season_cont)
self.season.start()
self.mdt.fsm.demand('Race', track, car, self.season.logic.drivers)
def on_car_start_client(self, track, car, packet):
dev = self.mdt.options['development']
self.season = SingleRaceSeason(self.__season_props(
self.mdt.gameprops, car,
self.mdt.options['settings']['cars_number'], True, 0, 0, 0,
dev['race_start_time'], dev['countdown_seconds']))
self.season.attach_obs(self.mdt.event.on_season_end)
self.season.attach_obs(self.mdt.event.on_season_cont)
self.season.start()
self.mdt.fsm.demand('Race', track, car, self.season.logic.drivers)
def on_car_selected_season(self, car):
dev = self.mdt.options['development']
self.season = Season(self.__season_props(
2 yyagl
Submodule yyagl updated 1 files
+1 −1 engine/gui/page.py

0 comments on commit 9ebb959

Please sign in to comment.