Ejemplo n.º 1
0
 def on_begin(self) -> None:
     # pylint: disable=cyclic-import
     from bastd.mainmenu import MainMenuSession
     from ba._apputils import call_after_ad
     from ba._general import Call
     super().on_begin()
     _ba.unlock_all_input()
     call_after_ad(Call(_ba.new_host_session, MainMenuSession))
Ejemplo n.º 2
0
    def transitioning_out_activity_was_freed(
            self, can_show_ad_on_death: bool) -> None:
        """(internal)"""
        from ba._apputils import garbage_collect, call_after_ad

        # Since things should be generally still right now, it's a good time
        # to run garbage collection to clear out any circular dependency
        # loops. We keep this disabled normally to avoid non-deterministic
        # hitches.
        garbage_collect(session_end=False)

        with _ba.Context(self):
            if can_show_ad_on_death:
                call_after_ad(self.begin_next_activity)
            else:
                _ba.pushcall(self.begin_next_activity)
Ejemplo n.º 3
0
    def __del__(self) -> None:
        from ba._apputils import garbage_collect, call_after_ad

        # If the activity has been run then we should have already cleaned
        # it up, but we still need to run expire calls for un-run activities.
        if not self._expired:
            with _ba.Context('empty'):
                self._expire()

        # Since we're mostly between activities at this point, lets run a cycle
        # of garbage collection; hopefully it won't cause hitches here.
        garbage_collect(session_end=False)

        # Now that our object is officially gonna be dead, tell the session it
        # can fire up the next activity.
        if self._transitioning_out:
            session = self._session()
            if session is not None:
                with _ba.Context(session):
                    if self.can_show_ad_on_death:
                        call_after_ad(session.begin_next_activity)
                    else:
                        _ba.pushcall(session.begin_next_activity)