示例#1
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager()
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier()
     return
示例#2
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager(self)
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier(self)
     if self.__peripheriesHandler is None:
         self.__peripheriesHandler = _PrbPeripheriesHandler(self)
示例#3
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager(self)
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier(self)
     if self.__peripheriesHandler is None:
         self.__peripheriesHandler = _PrbPeripheriesHandler(self)
     if self.__storage is None:
         self.__storage = PrbStorageDecorator()
         self.__storage.init()
     return
示例#4
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager()
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier()
     return
示例#5
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager(self)
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier(self)
     if self.__peripheriesHandler is None:
         self.__peripheriesHandler = _PrbPeripheriesHandler(self)
示例#6
0
 def init(self):
     if self.__invitesManager is None:
         self.__invitesManager = InvitesManager(self)
         self.__invitesManager.init()
     if self.__autoNotifier is None:
         self.__autoNotifier = AutoInvitesNotifier(self)
     if self.__peripheriesHandler is None:
         self.__peripheriesHandler = _PrbPeripheriesHandler(self)
     if self.__storage is None:
         self.__storage = PrbStorageDecorator()
         self.__storage.init()
     return
示例#7
0
class _PrbControlLoader(object):
    __slots__ = ('__prbDispatcher', '__invitesManager', '__autoNotifier',
                 '__peripheriesHandler', '__storage', '__isEnabled')

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__peripheriesHandler = None
        self.__storage = None
        self.__isEnabled = False
        return

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager(self)
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier(self)
        if self.__peripheriesHandler is None:
            self.__peripheriesHandler = _PrbPeripheriesHandler(self)
        if self.__storage is None:
            self.__storage = PrbStorageDecorator()
            self.__storage.init()
        return

    def fini(self):
        self.__removeDispatcher()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.fini()
            self.__autoNotifier = None
        if self.__peripheriesHandler is not None:
            self.__peripheriesHandler.fini()
            self.__peripheriesHandler = None
        if self.__storage is not None:
            self.__storage.fini()
            self.__storage = None
        return

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def getPeripheriesHandler(self):
        return self.__peripheriesHandler

    def getStorage(self):
        return self.__storage

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                self.__doStart()
        return

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        if self.__isEnabled:
            self.__doStart()
        return

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
        if self.__storage is not None:
            self.__storage.clear()
        return

    def __doStart(self):
        self.__storage.swap()
        self.__prbDispatcher.start()
        self.__invitesManager.start()
        self.__autoNotifier.start()
        self.__peripheriesHandler.activate()

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None
        return
示例#8
0
class _PrbControlLoader(object):
    __slots__ = ('__prbDispatcher', '__invitesManager', '__autoNotifier', '__isEnabled')

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__isEnabled = False
        return

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager()
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier()
        return

    def fini(self):
        self.__removeDispatcher()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
            self.__autoNotifier = None
        return

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                self.__prbDispatcher.start(context.StartDispatcherCtx.fetch())
                self.__autoNotifier.start()
        return

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None
        return

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        self.__invitesManager.onAccountShowGUI()
        if self.__isEnabled:
            self.__prbDispatcher.start(context.StartDispatcherCtx(**ctx))
            self.__autoNotifier.start()
        return

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
        return
示例#9
0
class _PrbControlLoader(object):
    __slots__ = ('__prbDispatcher', '__invitesManager', '__autoNotifier', '__peripheriesHandler', '__isEnabled', '__prbSettings')

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbSettings = ({}, {})
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__peripheriesHandler = None
        self.__isEnabled = False
        return

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager(self)
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier(self)
        if self.__peripheriesHandler is None:
            self.__peripheriesHandler = _PrbPeripheriesHandler(self)
        return

    def fini(self):
        self.__removeDispatcher()
        self.__clearPrbSettings()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.fini()
            self.__autoNotifier = None
        if self.__peripheriesHandler is not None:
            self.__peripheriesHandler.fini()
            self.__peripheriesHandler = None
        return

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def getPeripheriesHandler(self):
        return self.__peripheriesHandler

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                ctxUpdate, settings = self.__prbSettings
                self.__doStart(StartDispatcherCtx.fetch(prbSettings=settings, **ctxUpdate))
        return

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        if self.__isEnabled:
            ctxUpdate, settings = self.__prbSettings
            ctx.update(ctxUpdate)
            self.__doStart(StartDispatcherCtx(prbSettings=settings, **ctx))
        return

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__savePrbSettings()
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__clearPrbSettings()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
        return

    def __doStart(self, ctx):
        self.__prbDispatcher.start(ctx)
        self.__invitesManager.start()
        self.__autoNotifier.start()
        self.__peripheriesHandler.activate()
        self.__clearPrbSettings()

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None
        return

    def __savePrbSettings(self):
        if self.__prbDispatcher is not None:
            ctx, settings = self.__prbSettings
            for func in self.__prbDispatcher.getFunctionalCollection().getIterator():
                if functional.isStatefulFunctional(func):
                    funcCtx, funcStates = func.getStates()
                    ctx.update(funcCtx)
                    settings[func.getEntityType()] = funcStates

        return

    def __clearPrbSettings(self):
        self.__prbSettings = ({}, {})
示例#10
0
class _PrbControlLoader(object):
    __slots__ = (
        "__prbDispatcher",
        "__invitesManager",
        "__autoNotifier",
        "__peripheriesHandler",
        "__storage",
        "__isEnabled",
    )

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__peripheriesHandler = None
        self.__storage = None
        self.__isEnabled = False
        return

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager(self)
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier(self)
        if self.__peripheriesHandler is None:
            self.__peripheriesHandler = _PrbPeripheriesHandler(self)
        if self.__storage is None:
            self.__storage = PrbStorageDecorator()
            self.__storage.init()
        return

    def fini(self):
        self.__removeDispatcher()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.fini()
            self.__autoNotifier = None
        if self.__peripheriesHandler is not None:
            self.__peripheriesHandler.fini()
            self.__peripheriesHandler = None
        if self.__storage is not None:
            self.__storage.fini()
            self.__storage = None
        return

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def getPeripheriesHandler(self):
        return self.__peripheriesHandler

    def getStorage(self):
        return self.__storage

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                self.__doStart()
        return

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        if self.__isEnabled:
            self.__doStart()
        return

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
        if self.__storage is not None:
            self.__storage.clear()
        return

    def __doStart(self):
        self.__storage.swap()
        self.__prbDispatcher.start()
        self.__invitesManager.start()
        self.__autoNotifier.start()
        self.__peripheriesHandler.activate()

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None
        return
示例#11
0
class _PrbControlLoader(object):
    __slots__ = ('__prbDispatcher', '__invitesManager', '__autoNotifier',
                 '__peripheriesHandler', '__isEnabled', '__prbSettings')

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbSettings = ({}, {})
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__peripheriesHandler = None
        self.__isEnabled = False

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager(self)
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier(self)
        if self.__peripheriesHandler is None:
            self.__peripheriesHandler = _PrbPeripheriesHandler(self)

    def fini(self):
        self.__removeDispatcher()
        self.__clearPrbSettings()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.fini()
            self.__autoNotifier = None
        if self.__peripheriesHandler is not None:
            self.__peripheriesHandler.fini()
            self.__peripheriesHandler = None

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def getPeripheriesHandler(self):
        return self.__peripheriesHandler

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                ctxUpdate, settings = self.__prbSettings
                self.__doStart(
                    StartDispatcherCtx.fetch(prbSettings=settings,
                                             **ctxUpdate))

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        if self.__isEnabled:
            ctxUpdate, settings = self.__prbSettings
            ctx.update(ctxUpdate)
            self.__doStart(StartDispatcherCtx(prbSettings=settings, **ctx))

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__savePrbSettings()
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__clearPrbSettings()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()

    def __doStart(self, ctx):
        self.__prbDispatcher.start(ctx)
        self.__invitesManager.start()
        self.__autoNotifier.start()
        self.__peripheriesHandler.activate()
        self.__clearPrbSettings()

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None

    def __savePrbSettings(self):
        if self.__prbDispatcher is not None:
            ctx, settings = self.__prbSettings
            for func in self.__prbDispatcher.getFunctionalCollection(
            ).getIterator():
                if functional.isStatefulFunctional(func):
                    funcCtx, funcStates = func.getStates()
                    ctx.update(funcCtx)
                    settings[func.getEntityType()] = funcStates

    def __clearPrbSettings(self):
        self.__prbSettings = ({}, {})
示例#12
0
class _PrbControlLoader(object):
    __slots__ = ('__prbDispatcher', '__invitesManager', '__autoNotifier',
                 '__isEnabled')

    def __init__(self):
        super(_PrbControlLoader, self).__init__()
        self.__prbDispatcher = None
        self.__invitesManager = None
        self.__autoNotifier = None
        self.__isEnabled = False
        return

    def init(self):
        if self.__invitesManager is None:
            self.__invitesManager = InvitesManager()
            self.__invitesManager.init()
        if self.__autoNotifier is None:
            self.__autoNotifier = AutoInvitesNotifier()
        return

    def fini(self):
        self.__removeDispatcher()
        if self.__invitesManager is not None:
            self.__invitesManager.fini()
            self.__invitesManager = None
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
            self.__autoNotifier = None
        return

    def getDispatcher(self):
        return self.__prbDispatcher

    def getInvitesManager(self):
        return self.__invitesManager

    def getAutoInvitesNotifier(self):
        return self.__autoNotifier

    def isEnabled(self):
        return self.__isEnabled

    def setEnabled(self, enabled):
        if self.__isEnabled ^ enabled:
            self.__isEnabled = enabled
            if self.__isEnabled and self.__prbDispatcher is not None:
                self.__prbDispatcher.start(context.StartDispatcherCtx.fetch())
                self.__autoNotifier.start()
        return

    def __removeDispatcher(self):
        if self.__prbDispatcher is not None:
            self.__prbDispatcher.stop()
            self.__prbDispatcher = None
        return

    def onAccountShowGUI(self, ctx):
        if self.__prbDispatcher is None:
            self.__prbDispatcher = _PrebattleDispatcher()
        self.__invitesManager.onAccountShowGUI()
        if self.__isEnabled:
            self.__prbDispatcher.start(context.StartDispatcherCtx(**ctx))
            self.__autoNotifier.start()
        return

    def onAvatarBecomePlayer(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__invitesManager.onAvatarBecomePlayer()

    def onDisconnected(self):
        self.__isEnabled = False
        self.__removeDispatcher()
        self.__autoNotifier.stop()
        if self.__invitesManager is not None:
            self.__invitesManager.clear()
        if self.__autoNotifier is not None:
            self.__autoNotifier.stop()
        return