Пример #1
0
 def __init__(self, frame):
     super(LogitechMonitorBattleColoredScreen, self).__init__(frame)
     self._colorManager = ColorSchemeManager()
     self.__debugCtrl = DebugController()
     self.__timerPresenter = _TimerPresenter(weakref.proxy(self))
     self.__fragsPresenter = _FragsPresenter(weakref.proxy(self))
     self.__messenger = MessengerBattleEntry()
     self.__isPostmortem = False
Пример #2
0
def setGUIEntries(decorator):
    from gui import GUI_SETTINGS
    from messenger.gui.Scaleform.battle_entry import BattleEntry
    from messenger.gui.Scaleform.lobby_entry import LobbyEntry
    from messenger.gui.Scaleform.legacy_entry import LegacyBattleEntry
    decorator.setEntry(MESSENGER_SCOPE.LOBBY, LobbyEntry())
    if GUI_SETTINGS.useAS3Battle:
        decorator.setEntry(MESSENGER_SCOPE.BATTLE, BattleEntry())
    else:
        decorator.setEntry(MESSENGER_SCOPE.BATTLE, LegacyBattleEntry())
Пример #3
0
class LogitechMonitorBattleColoredScreen(LogitechMonitorBattleColoredScreenMeta, IDebugPanel, _ITimerView, _IFragsView):

    def __init__(self, frame):
        super(LogitechMonitorBattleColoredScreen, self).__init__(frame)
        self._colorManager = ColorSchemeManager()
        self.__debugCtrl = DebugController()
        self.__timerPresenter = _TimerPresenter(weakref.proxy(self))
        self.__fragsPresenter = _FragsPresenter(weakref.proxy(self))
        self.__messenger = MessengerBattleEntry()
        self.__isPostmortem = False

    def _onLoaded(self):
        self.__debugCtrl.setViewComponents(weakref.proxy(self))
        self.__debugCtrl.startControl()
        self._colorManager.populateUI(weakref.proxy(self._flashObject))
        self.__timerPresenter.start()
        self.__fragsPresenter.start()
        vehStateCtrl = g_sessionProvider.shared.vehicleState
        self.__isPostmortem = vehStateCtrl and vehStateCtrl.isInPostmortem
        if self.__isPostmortem:
            self.__onPostMortemSwitched()
        if vehStateCtrl is not None:
            vehStateCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
        CommandMapping.g_instance.onMappingChanged += self.setCommands
        self.setCommands()
        self.__messenger.show()
        self.__messenger.enableRecord(False)
        self.__messenger.populateUI(weakref.proxy(self._flashObject))
        return

    def _onUnloaded(self):
        self.__debugCtrl.stopControl()
        self.__debugCtrl.clearViewComponents()
        self.__timerPresenter.stop()
        self.__fragsPresenter.stop()
        ctrl = g_sessionProvider.shared.vehicleState
        if ctrl is not None:
            ctrl.onPostMortemSwitched -= self.__onPostMortemSwitched
        CommandMapping.g_instance.onMappingChanged -= self.setCommands
        self._colorManager.dispossessUI()
        self.__messenger.close(MESSENGER_SCOPE.UNKNOWN)
        self.__messenger.dispossessUI()
        return

    def setCommands(self, *args):
        if self.__isPostmortem:
            return
        else:
            cmdMap = CommandMapping.g_instance
            viewCmdMapping = []
            for command in _VIEW_CMDS:
                commandName = cmdMap.getName(command)
                key = cmdMap.get(commandName)
                viewCmdMapping.append(commandName)
                viewCmdMapping.append(BigWorld.keyToString(key) if key is not None else 'NONE')

            self.as_setCommandMapping(viewCmdMapping)
            return

    def updateDebugInfo(self, ping, fps, isLaggingNow, fpsReplay = -1):
        self.as_updateDebugInfo(fps, ping, isLaggingNow)

    def updateTimer(self, timerDisplayData):
        self.as_setTotalTime(timerDisplayData.level, timerDisplayData.minutes, timerDisplayData.seconds)

    def updateFrags(self, fragsDisplayData):
        label = '{}/{}'.format(fragsDisplayData.allyFrags, fragsDisplayData.enemyFrags)
        self.as_updateFrags(fragsDisplayData.progress, label)

    def __onPostMortemSwitched(self):
        if not g_sessionProvider.getCtx().isPlayerObserver():
            self.__isPostmortem = True
            self.as_hideCommandMapping(True)