def addMarkerModel(self): if self.__model is None or self.__modelOwner is not None: return else: self.__modelOwner = BigWorld.player() self.__modelOwner.addModel(self.__model) if self.__action: try: clipResource = self.__model.deprecatedGetAnimationClipResource( self.__action) spaceID = BigWorld.player().spaceID loader = AnimationSequence.Loader(clipResource, spaceID) animator = loader.loadSync() animator.bindTo( AnimationSequence.ModelWrapperContainer( self.__model, spaceID)) animator.start() self.__animator = animator except ValueError: LOG_ERROR_BOOTCAMP('Action not found', self.__path, self.__action) except EnvironmentError: LOG_ERROR_BOOTCAMP('Player not on the world') return
def addMarkerModel(self): if self.__model is None or self.__modelOwner is not None: return else: self.__modelOwner = BigWorld.player() self.__modelOwner.addModel(self.__model) if self.__action: try: self.__model.action(self.__action)() except ValueError: LOG_ERROR_BOOTCAMP('Action not found', self.__path, self.__action) except EnvironmentError: LOG_ERROR_BOOTCAMP('Player not on the world') return
def _setHighlighting(self, highlightType, doHighlight): eventId = VIEW_ALIAS.BOOTCAMP_ADD_HIGHLIGHT if doHighlight else VIEW_ALIAS.BOOTCAMP_REMOVE_HIGHLIGHT if highlightType in [ INTRO_HIGHLIGHT_TYPE.START_BUTTON, INTRO_HIGHLIGHT_TYPE.WELCOME_START_BUTTON ]: g_eventBus.handleEvent( events.LoadViewEvent( SFViewLoadParams(eventId), ctx=BOOTCAMP_UI_COMPONENTS.START_BATTLE_BUTTON if highlightType == INTRO_HIGHLIGHT_TYPE.START_BUTTON else BOOTCAMP_UI_COMPONENTS.WELCOME_START_BATTLE_BUTTON), EVENT_BUS_SCOPE.BATTLE) elif highlightType == INTRO_HIGHLIGHT_TYPE.ARROWS: for highlightName in ('LoadingRightButton', 'LoadingLeftButton'): g_eventBus.handleEvent( events.LoadViewEvent(SFViewLoadParams(eventId), ctx=highlightName), EVENT_BUS_SCOPE.BATTLE) else: LOG_ERROR_BOOTCAMP( 'Unknown highlight type - {0}'.format(highlightType)) if doHighlight: self._highlightingMask |= 1 << highlightType else: self._highlightingMask &= ~(1 << highlightType)
def __createMarker(self, markerParams): entityID = markerParams['style'] data = self.__entitiesParams.getEntity(entityID) typeID = 1 self.__triggerID += 1 position = markerParams['position'] if position is None: LOG_ERROR_BOOTCAMP('Can not determine position of object', self.__triggerID) return else: indicatorCtrl = None if data.isIndicatorCreate(): worldData = data.getWorldData() offset = worldData.get('offset', Math.Vector3(0, 0, 0)) indicatorCtrl = _DirectionIndicatorCtrl( ('yellow', 'yellow'), Math.Vector3(position[:]) + offset) areaMarker = _AreaMarker( typeID, self.__triggerID, position, _StaticWorldMarker2D(self.__triggerID, data.getWorldData(), position, self.STATIC_MARKER_DIST), _StaticMinimapMarker2D(data.getID(), position), _StaticObjectMarker3D(data.getModelData(), position), _StaticObjectMarker3D(data.getGroundData(), position), indicatorCtrl) areaMarker.switchToSniperMode(self.__switchedToSniperMode) areaMarker.switchToHiddenMode(self.__switchedToHiddenMode) if self.__gui is not None and self.__gui.inited: minimap = self.__gui.getMinimapPlugin() marker2D = self.__gui.getMarkers2DPlugin() areaMarker.attachGUI(marker2D, minimap) self.__markers[markerParams['name']] = areaMarker return
def checkReturnToHangar(self): if self.isLessonSuspended: g_bootcampGarage.highlightLobbyHint('HangarButton', True, True) elif self.isLessonFinished: if self.canGoToBattle: LOG_DEBUG_DEV_BOOTCAMP("checkReturnToHangar - hiding 'HangarButton' highlight (isLessonFinished and canGoToBattle)") g_bootcampGarage.highlightLobbyHint('HangarButton', False, True) else: LOG_DEBUG_DEV_BOOTCAMP("checkReturnToHangar - highlighting 'HangarButton' (isLessonFinished and not canGoToBattle)") g_bootcampGarage.highlightLobbyHint('HangarButton', True, True) elif self.__lessonId == g_bootcamp.getContextIntParameter('randomBattleLesson'): name = 'hideHeaderBattleSelector' if name in self.bootcampCtrl.getLobbySettings(): if self.bootcampCtrl.getLobbySettings()[name]: g_bootcampGarage.highlightLobbyHint('HangarButton', True, True) return try: items = battle_selector_items.getItems() if not items.isSelected('random'): return except: LOG_CURRENT_EXCEPTION_BOOTCAMP() LOG_ERROR_BOOTCAMP('battle_selector_items exception') g_bootcampGarage.highlightLobbyHint('HangarButton', True, True) else: g_bootcampGarage.highlightLobbyHint('HangarButton', True, True)
def attachGUI(self, markers2D, minimap): self.__marker2D.attachGUI(markers2D) indicator = getDirectionIndicator() if indicator is not None: self.__dIndicator.attachGUI(indicator) else: LOG_ERROR_BOOTCAMP('Directional indicator not found', self.__triggerID) return
def _parseEntity(xmlCtx, name, section, flags): parser = _ENTITY_PARSERS.get(name) item = None if parser is not None: item = parser(xmlCtx, section, flags) else: LOG_ERROR_BOOTCAMP('Entity is not supported:', name) return item
def __shouldHighlight(self, highlightType): if self.__autoStart: return False if highlightType == INTRO_HIGHLIGHT_TYPE.START_BUTTON: return True if highlightType == INTRO_HIGHLIGHT_TYPE.ARROWS: return len(self.__tutorialPages) > 1 LOG_ERROR_BOOTCAMP('Unknown highlight type - {0}'.format(highlightType)) return False
def _readMarkerSection(xmlCtx, section, _): markerID = _parseID(xmlCtx, section, 'Specify a marker ID') type = _xml.readString(xmlCtx, section, 'type') marker = None if type in _MARKER_TYPES: parser = _MARKER_TYPES[type] marker = parser(xmlCtx, section, markerID) else: LOG_ERROR_BOOTCAMP('Marker is not supported:', type) return marker
def __readRibbonsSection(self, ribbonsSection): defaultRibbons = self.__defaults['ribbons'] ribbonsSettings = [] ribbonNames = ribbonsSection.asString.split() for ribName in ribbonNames: if ribName in defaultRibbons: ribbonsSettings.append(ribName) LOG_ERROR_BOOTCAMP('Unknown ribbon name (%s)' % ribName) return ribbonsSettings
def __readPanelsSection(self, panelsSection): panels = [] defaultPanels = self.__defaults['panels'] panelNames = panelsSection.asString.split() for name in panelNames: if name in defaultPanels: panels.append(name) LOG_ERROR_BOOTCAMP('Unknown panel name (%s)' % name) return panels
def __onModelLoaded(self, position, resourceRefs): if self.__destroyed: return if self.__path not in resourceRefs.failedIDs: self.__model = resourceRefs[self.__path] self.__model.position = position self.__model.castsShadow = False if self.__isMarkerVisible: self.addMarkerModel() else: LOG_ERROR_BOOTCAMP('Model not found', self.__path)
def _setupPlugins(self, arenaVisitor): setup = super(BootcampMinimapComponent, self)._setupPlugins(arenaVisitor) setup['bootcamp'] = BootcampTargetPlugin try: lessonId = arenaVisitor.getArenaExtraData()['lessonId'] if BATTLE_VIEW_ALIASES.MINIMAP in getBattleSettings(lessonId).hiddenPanels: setup['settings'] = BootcampMinimapDisablePlugin except KeyError: LOG_ERROR_BOOTCAMP("Extra data doesn't contain lessonId") return setup
def __disableControl(self, cd, controlPath): page = '' subpage = '' control = '' if len(controlPath) == 2: page, control = controlPath elif len(controlPath) == 3: page, subpage, control = controlPath try: cd.self.as_disableControlS(page, control, subpage) except Exception: LOG_ERROR_BOOTCAMP('Error: No such page or control?', page, subpage, control) LOG_CURRENT_EXCEPTION()
def __setHighlighting(self, highlightType, doHighlight): eventId = BootcampEvent.ADD_HIGHLIGHT if doHighlight else BootcampEvent.REMOVE_HIGHLIGHT if highlightType == INTRO_HIGHLIGHT_TYPE.START_BUTTON: g_eventBus.handleEvent(events.LoadViewEvent(eventId, None, 'StartBattleButton'), EVENT_BUS_SCOPE.BATTLE) elif highlightType == INTRO_HIGHLIGHT_TYPE.ARROWS: for highlightName in ('LoadingRightButton', 'LoadingLeftButton'): g_eventBus.handleEvent(events.LoadViewEvent(eventId, None, highlightName), EVENT_BUS_SCOPE.BATTLE) else: LOG_ERROR_BOOTCAMP('Unknown highlight type - {0}'.format(highlightType)) if doHighlight: self.__highlightingMask |= 1 << highlightType else: self.__highlightingMask &= ~(1 << highlightType) return
def __disableControl(self, cd, controlPath): """ :param cd: passed from aspect :param controlPath: path to control in Scaleform hierarchy. Either page->control or page->subpage->control. So, controlPath accordingly contains 2 or 3 items: [page, control] or [page, subpage, control] :return: None """ page = '' subpage = '' control = '' if len(controlPath) == 2: page, control = controlPath elif len(controlPath) == 3: page, subpage, control = controlPath try: cd.self.as_disableControlS(page, control, subpage) except: LOG_ERROR_BOOTCAMP('Error: No such page or control?', page, subpage, control) LOG_CURRENT_EXCEPTION()
def handleError(self, data): LOG_ERROR_BOOTCAMP('Video error - {0}'.format(data)) self._onFinish()