Пример #1
0
 def save(self, zone_data=None, open_street_data=None, **kwargs):
     active_venue = self.active_venue
     if zone_data is not None:
         if active_venue is not None:
             venue_data = zone_data.gameplay_zone_data.venue_data
             if active_venue.active_background_event_id is not None:
                 venue_data.background_situation_id = active_venue.active_background_event_id
             if active_venue.active_special_event_id is not None:
                 venue_data.special_event_id = active_venue.active_special_event_id
             if self._zone_director is not None:
                 zone_director_data = gameplay_serialization.ZoneDirectorData(
                 )
                 self._zone_director.save(zone_director_data,
                                          open_street_data)
                 venue_data.zone_director = zone_director_data
             else:
                 if self._prior_open_street_director_proto is not None:
                     open_street_data.open_street_director = self._prior_open_street_director_proto
                 if self._prior_zone_director_proto is not None:
                     venue_data.zone_director = self._prior_zone_director_proto
Пример #2
0
 def load(self, zone_data=None, **kwargs):
     if zone_data is not None and zone_data.HasField(
             'gameplay_zone_data'
     ) and zone_data.gameplay_zone_data.HasField('venue_data'):
         venue_data = zone_data.gameplay_zone_data.venue_data
         if venue_data.HasField('background_situation_id'):
             self._persisted_background_event_id = venue_data.background_situation_id
         if venue_data.HasField('special_event_id'):
             self._persisted_special_event_id = venue_data.special_event_id
         if venue_data.HasField('zone_director'):
             self._prior_zone_director_proto = gameplay_serialization.ZoneDirectorData(
             )
             self._prior_zone_director_proto.CopyFrom(
                 venue_data.zone_director)
     open_street_id = services.current_zone().open_street_id
     open_street_data = services.get_persistence_service(
     ).get_open_street_proto_buff(open_street_id)
     if open_street_data is not None and open_street_data.HasField(
             'open_street_director'):
         self._prior_open_street_director_proto = gameplay_serialization.OpenStreetDirectorData(
         )
         self._prior_open_street_director_proto.CopyFrom(
             open_street_data.open_street_director)