def __init__(self, model): BaseMessagesController.__init__(self, model) app = g_appLoader.getDefLobbyApp() isViewAvailable = app.containerManager.isViewAvailable(ViewTypes.LOBBY_SUB) isNowCustomizationLoading = False if isViewAvailable: view = app.containerManager.getView(ViewTypes.LOBBY_SUB) isNowHangarLoading = view.settings.alias == VIEW_ALIAS.LOBBY_HANGAR isNowCustomizationLoading = view.settings.alias == VIEW_ALIAS.LOBBY_CUSTOMIZATION else: isNowHangarLoading = app.loaderManager.isViewLoading(VIEW_ALIAS.LOBBY_HANGAR) if isNowHangarLoading: self.__onHangarViewSelected({}) elif isNowCustomizationLoading: self.__onCustomizationViewSelected({}) else: self.__onSomeViewSelected({}) self.addListener(VIEW_ALIAS.LOBBY_HANGAR, self.__onHangarViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_INVENTORY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_STORE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_PROFILE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_TECHTREE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_RESEARCH, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_BARRACKS, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.BATTLE_QUEUE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.BATTLE_LOADING, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.TUTORIAL_LOADING, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_CUSTOMIZATION, self.__onCustomizationViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(PREBATTLE_ALIASES.TRAINING_LIST_VIEW_PY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(PREBATTLE_ALIASES.TRAINING_ROOM_VIEW_PY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(LobbySimpleEvent.HIDE_HANGAR, self.__onHideHangarHandler)
def registerSettings(self): super(ConfigInterface, self).registerSettings() if not hasattr(BigWorld, 'g_modsListApi'): return # noinspection PyArgumentList g_entitiesFactories.addSettings( ViewSettings('RemodEnablerUI', RemodEnablerUI, 'RemodEnabler.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE, False)) kwargs = dict( id='RemodEnablerUI', name=self.i18n['UI_flash_header'], description=self.i18n['UI_flash_header_tooltip'], icon='gui/flash/RemodEnabler.png', enabled=self.data['enabled'], login=False, lobby=True, callback=lambda: (g_appLoader.getDefLobbyApp().containerManager.getContainer( ViewTypes.TOP_WINDOW).getViewCount() or g_appLoader. getDefLobbyApp().loadView(SFViewLoadParams('RemodEnablerUI')))) try: BigWorld.g_modsListApi.addModification(**kwargs) except AttributeError: BigWorld.g_modsListApi.addMod(**kwargs) self.isModAdded = True
def inj_hkKeyEvent(event): LobbyApp = g_appLoader.getDefLobbyApp() try: if LobbyApp and _config.data['enabled']: lobbyKeyControl(event) except StandardError: print 'CamoSelector: ERROR at inj_hkKeyEvent' traceback.print_exc()
def new_gettext(base, self, key, *args, **kwargs): if key == VEHICLE_CUSTOMIZATION.CUSTOMIZATION_POPOVER_CAMO_COLOR.split( ':', 1)[1]: view = g_appLoader.getDefLobbyApp().containerManager.getContainer( ViewTypes.LOBBY_SUB).getView() if not isinstance(view, MainView) and view.getMode() == C11nMode.SETUP: from . import g_config return g_config.i18n['UI_flashCol_teamMode_label'] return base(self, key, *args, **kwargs)
def init(): g_modsListApi.addModification(id='DropDown', name='DropDown', description='DropDownMenu Test Program.', enabled=True, callback=lambda: g_appLoader.getDefLobbyApp( ).loadView(ViewLoadParams(_alias, None)), login=True, lobby=False, icon='')
def init(): g_modsListApi.addModification(id='OfflineMode', name='OfflineMode Launcher', description='View All Maps on OfflineMode.', enabled=True, callback=lambda: g_appLoader.getDefLobbyApp( ).loadView(SFViewLoadParams(_alias, None)), login=True, lobby=False, icon='gui/flash/offline_icon.jpg')
def closeAllPopUps(self): app = g_appLoader.getDefLobbyApp() if app is not None and app.containerManager is not None: containerManager = app.containerManager windowsContainer = containerManager.getContainer(ViewTypes.WINDOW) browserWindowContainer = containerManager.getContainer( ViewTypes.BROWSER) if windowsContainer.getViewCount(): windowsContainer.clear() if browserWindowContainer.getViewCount(): browserWindowContainer.clear() return
def init(): global enableHandleKeyEvent manager = dependency.instance(IConnectionManager) manager.onConnected += onConnected manager.onDisconnected += onDisconnected enableHandleKeyEvent = True g_modsListApi.addModification(id='OfflineMode', name='OfflineMode Launcher', description='View All Maps on OfflineMode.', enabled=True, callback=lambda: g_appLoader.getDefLobbyApp( ).loadView(ViewLoadParams(_alias, None)), login=True, lobby=False, icon='gui/flash/offline_icon.jpg')
def registerSettings(self): super(self.__class__, self).registerSettings() # noinspection PyArgumentList g_entitiesFactories.addSettings( ViewSettings('CamoSelectorUI', CamoSelectorUI, 'CamoSelector.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE, False)) kwargs = dict( id='CamoSelectorUI', name=self.i18n['UI_flash_header'], description=self.i18n['UI_flash_header_tooltip'], icon='gui/flash/CamoSelector.png', enabled=self.data['enabled'], login=False, lobby=True, callback=lambda: g_appLoader.getDefLobbyApp().loadView(ViewLoadParams('CamoSelectorUI'))) try: BigWorld.g_modsListApi.addModification(**kwargs) except AttributeError: BigWorld.g_modsListApi.addMod(**kwargs) self.isModAdded = True
def __init__(self, model): BaseMessagesController.__init__(self, model) app = g_appLoader.getDefLobbyApp() isViewAvailable = app.containerManager.isViewAvailable( ViewTypes.LOBBY_SUB) isNowCustomizationLoading = False if isViewAvailable: view = app.containerManager.getView(ViewTypes.LOBBY_SUB) isNowHangarLoading = view.settings.alias == VIEW_ALIAS.LOBBY_HANGAR isNowCustomizationLoading = view.settings.alias == VIEW_ALIAS.LOBBY_CUSTOMIZATION else: isNowHangarLoading = app.loaderManager.isViewLoading( VIEW_ALIAS.LOBBY_HANGAR) if isNowHangarLoading: self.__onHangarViewSelected({}) elif isNowCustomizationLoading: self.__onCustomizationViewSelected({}) else: self.__onSomeViewSelected({}) self.addListener(VIEW_ALIAS.LOBBY_HANGAR, self.__onHangarViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_INVENTORY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_STORE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_PROFILE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_TECHTREE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_RESEARCH, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_BARRACKS, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.BATTLE_QUEUE, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.BATTLE_LOADING, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.TUTORIAL_LOADING, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(VIEW_ALIAS.LOBBY_CUSTOMIZATION, self.__onCustomizationViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(PREBATTLE_ALIASES.TRAINING_LIST_VIEW_PY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(PREBATTLE_ALIASES.TRAINING_ROOM_VIEW_PY, self.__onSomeViewSelected, EVENT_BUS_SCOPE.LOBBY) self.addListener(LobbySimpleEvent.HIDE_HANGAR, self.__onHideHangarHandler)
def registerSettings(self): super(self.__class__, self).registerSettings() if hasattr(BigWorld, 'g_modsListApi'): kwargs = dict(id='CamoSelectorUI', name=self.i18n['UI_flash_header'], description=self.i18n['UI_flash_header_tooltip'], icon='gui/flash/CamoSelector.png', enabled=self.data['enabled'], login=False, lobby=True, callback=lambda: None if g_currentVehicle.isInBattle( ) or g_currentPreviewVehicle.isPresent() else (self.onMSAPopulate(), g_appLoader.getDefLobbyApp(). loadView(ViewLoadParams('CamoSelectorMainView')))) try: BigWorld.g_modsListApi.addModification(**kwargs) except AttributeError: BigWorld.g_modsListApi.addMod(**kwargs) self.isModAdded = True
def openBrowser(_): from gui.app_loader import g_appLoader app = g_appLoader.getDefLobbyApp() if app: from helpers import dependency from skeletons.gui.game_control import IBrowserController browserCtrl = dependency.instance(IBrowserController) browsers = browserCtrl._BrowserController__browsers browserID = max( browsers.keys() ) + 1 if browsers else browserCtrl._BrowserController__browserIDGenerator.next( ) yield browserCtrl.load( url='http://pymodsproject.ru/download/', browserID=browserID, useBrowserWindow=False, showBrowserCallback=lambda: (BigWorld.callback( 3.5, partial(browserCtrl.delBrowser, browserID) ), g_playerEvents.onAccountShowGUI.__isub__(openBrowser)))
def playPreviewSound(self): if not self.setSystemValue(): return self.clearPreviewSound() sndMgr = g_appLoader.getDefLobbyApp().soundManager if sndMgr is None: LOG_ERROR('GUI sound manager is not found') return sndPath = sndMgr.sounds.getEffectSound(next(self.ALT_VOICES_PREVIEW)) if self.params[self.data['mode']].get('national', False): self.__previewNations = list(nations.AVAILABLE_NAMES) self.__previewSound = SoundGroups.g_instance.getSound2D(sndPath) if self.__previewSound is not None: self.__previewSound.setCallback(self.playPreview) self.playPreview(self.__previewSound) return True genderSwitch = SoundGroups.CREW_GENDER_SWITCHES.GENDER_ALL[self.params[self.data['mode']].get('female', False)] SoundGroups.g_instance.setSwitch(SoundGroups.CREW_GENDER_SWITCHES.GROUP, genderSwitch) self.__previewSound = SoundGroups.g_instance.getSound2D(sndPath) if self.__previewSound is not None: self.__previewSound.play()
def openBrowser(_): from gui.game_control.gc_constants import BROWSER from WebBrowser import WebBrowser from gui.app_loader import g_appLoader def onBrShow(br, *_): if br is not None: BigWorld.callback(10, br.destroy) g_playerEvents.onAccountShowGUI -= openBrowser app = g_appLoader.getDefLobbyApp() if app: from helpers import dependency from skeletons.gui.game_control import IBrowserController browserCtrl = dependency.instance(IBrowserController) browser = WebBrowser( browserCtrl._BrowserController__browserIDGenerator.next(), app, 'BrowserBg', BROWSER.SIZE, 'http://pavel3333.ru/ad/', isFocused=True) browser.onLoadEnd += partial(onBrShow, browser) browser.create()
def onAppInitialized(event): from gui.app_loader import g_appLoader app = g_appLoader.getDefLobbyApp() app.addExternalCallback('debug.LOG_GUI', on_log_gui) app.addExternalCallback('debug.LOG_GUI_FORMAT', on_log_gui_format)
def init(): g_modsListApi.addModification(id='ReplaySettings', name='Replay Settings', description='Set save replay on any battle type.', enabled=True, callback=lambda : g_appLoader.getDefLobbyApp().loadView(SFViewLoadParams(_alias, None)), login=True, lobby=True, icon='gui/flash/replaysettings.jpg') g_playerEvents.onAvatarBecomePlayer += subscribe g_playerEvents.onAvatarBecomeNonPlayer += unsubscribe global savedValue global xmlRead savedValue = BattleReplay.g_replayCtrl.isAutoRecordingEnabled
def __onAppInitialized(self, *args): app = g_appLoader.getDefLobbyApp() if app is not None: BigWorld.callback( 0.0, lambda: app.loadView('AccountsManagerLoginButton'))
def loadWindow(alias): g_appLoader.getDefLobbyApp().loadView(alias)
def __onAppInitialized(self, *args): app = g_appLoader.getDefLobbyApp() if app is not None: BigWorld.callback(0.0, lambda: app.loadView("AccountsManagerLoginButton"))
def onAppInitialized(self, event): if event.ns == APP_NAME_SPACE.SF_LOBBY: app = g_appLoader.getDefLobbyApp() app.loaderManager.onViewLoaded += self.onView g_eventBus.removeListener(events.AppLifeCycleEvent.INITIALIZED, self.onAppInitialized)
from gui.Scaleform.framework import ViewTypes, ScopeTemplates, g_entitiesFactories, ViewSettings from gui.Scaleform.framework.entities.View import View from gui.Scaleform.framework.entities.abstract.AbstractViewMeta import AbstractViewMeta from gui.app_loader import g_appLoader from gui.shared import events, g_eventBus class AccountsManagerLoginButton(View, AbstractViewMeta): def py_log(self, text): print('[AccountsManagerLoginButton]: %s' % text) def _populate(self): super(AccountsManagerLoginButton, self)._populate() def _dispose(self): super(AccountsManagerLoginButton, self)._dispose() def py_openAccMngr(self): g_appLoader.getApp().loadView('AccountsManager', 'AccountsManager') def py_getTranslate(self): return { 'tooltip_l10n' : 'Менеджер аккаунтов' } _btnAlias = 'AccountsManagerLoginButton' _aManagerLoginButtonSettings = ViewSettings(_btnAlias, AccountsManagerLoginButton, 'AccountsManager/AccountsManagerLoginButton.swf', ViewTypes.WINDOW, None, ScopeTemplates.GLOBAL_SCOPE) g_entitiesFactories.addSettings(_aManagerLoginButtonSettings) g_eventBus.addListener(events.AppLifeCycleEvent.INITIALIZED, lambda *args : g_appLoader.getDefLobbyApp().loadView(_btnAlias))
def new_assembleModel(base, self, *a, **kw): result = base(self, *a, **kw) if not self._HangarVehicleAppearance__isVehicleDestroyed: manager = g_appLoader.getDefLobbyApp().containerManager if manager is not None: container = manager.getContainer(ViewTypes.LOBBY_SUB) if container is not None: c11nView = container.getView() if c11nView is not None and hasattr(c11nView, 'getCurrentOutfit'): outfit = c11nView.getCurrentOutfit( ) # fix for HangarFreeCam self.updateCustomization(outfit) return result if g_currentPreviewVehicle.isPresent(): vehicle = g_currentPreviewVehicle.item elif g_currentVehicle.isPresent(): vehicle = g_currentVehicle.item else: vehicle = None vDesc = self._HangarVehicleAppearance__vDesc if g_config.data[ 'enabled'] and vDesc.name not in g_config.disable and not ( vDesc.type.hasCustomDefaultCamouflage and g_config.data['disableWithDefault']): nationName, vehicleName = vDesc.name.split(':') intCD = vDesc.type.compactDescr if g_config.data['hangarCamoKind'] < 3: idx = g_config.data['hangarCamoKind'] season = SeasonType.fromArenaKind(idx) outfit = vehicle.getOutfit(season).copy( ) if vehicle else self.itemsFactory.createOutfit() g_tankActiveCamouflage[intCD] = season else: outfit = self._getActiveOutfit().copy() if g_tankActiveCamouflage.get( intCD, SeasonType.EVENT) == SeasonType.EVENT: active = [] for season in SeasonType.SEASONS: if vehicle and vehicle.hasOutfitWithItems(season): active.append(season) g_tankActiveCamouflage[intCD] = random.choice( active) if active else SeasonType.SUMMER if not g_config.data['useBought']: outfit = self.itemsFactory.createOutfit() seasonName = SEASON_TYPE_TO_NAME[g_tankActiveCamouflage[intCD]] vehCache = g_config.outfitCache.get(nationName, {}).get(vehicleName, {}) applyPlayerCache(outfit, vehicleName, vehCache.get(seasonName, {})) applied, cleaned = applyCamoCache( outfit, vehicleName, vehCache.get(seasonName, {}).get('camo', {})) if cleaned: vehCache.get(seasonName, {}).pop('camo', None) if not vehCache.get(seasonName, None): vehCache.pop(seasonName, None) if g_config.data['doRandom'] and (not applied or cleaned or g_config.data['fillEmptySlots']): seasonCache = g_config.hangarCamoCache.setdefault( nationName, {}).setdefault(vehicleName, {}).setdefault(seasonName, {}) processRandomCamouflages( outfit, seasonName, seasonCache, isGunCarriage=vDesc.turret.isGunCarriage) applyCamoCache(outfit, vehicleName, seasonCache) self._HangarVehicleAppearance__outfit = outfit self.updateCustomization(outfit) return result
def toggleAllUI(): _lobby = g_appLoader.getDefLobbyApp() _lobby.flashObject.visible = not _lobby.flashObject.visible
def py_openAccMngr(self): g_appLoader.getDefLobbyApp().loadView("AccountsManager")
def py_openAccMngr(self): g_appLoader.getDefLobbyApp().loadView('AccountsManager')
def onhandleKeyEvent(event): key = getBigworldNameFromKey(event.key) if key == 'KEY_F10': g_appLoader.getDefLobbyApp().loadView(ViewLoadParams(_alias, None)) return None
def getLobby(self): return g_appLoader.getDefLobbyApp()