本文整理汇总了Python中gui.shared.utils.plugins.PluginsCollection类的典型用法代码示例。如果您正苦于以下问题:Python PluginsCollection类的具体用法?Python PluginsCollection怎么用?Python PluginsCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginsCollection类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, appNS):
self.__ns = appNS
self.__soundManager = None
self.__arena = BigWorld.player().arena
self.__plugins = PluginsCollection(self)
plugins = {}
if hasFlags():
plugins['flagNotification'] = FlagNotificationPlugin
if hasRespawns() and not BattleReplay.g_replayCtrl.isPlaying:
plugins['respawnView'] = RespawnViewPlugin
if hasResourcePoints():
plugins['resources'] = ResourcePointsPlugin
self.__plugins.addPlugins(plugins)
BattleWindow.__init__(self, 'battle.swf')
self.__isHelpWindowShown = False
self.__cameraMode = None
self.component.wg_inputKeyMode = 1
self.component.position.z = DEPTH_OF_Battle
self.movie.backgroundAlpha = 0
self.addFsCallbacks({'battle.leave': self.onExitBattle})
self.addExternalCallbacks({'battle.showCursor': self.cursorVisibility,
'battle.tryLeaveRequest': self.tryLeaveRequest,
'battle.populateFragCorrelationBar': self.populateFragCorrelationBar,
'Battle.UsersRoster.Appeal': self.onDenunciationReceived,
'Battle.selectPlayer': self.selectPlayer,
'battle.helpDialogOpenStatus': self.helpDialogOpenStatus,
'battle.initLobbyDialog': self._initLobbyDialog,
'battle.reportBug': self.reportBug})
self.__dynSquadListener = None
BigWorld.wg_setRedefineKeysMode(False)
self.onPostmortemVehicleChanged(BigWorld.player().playerVehicleID)
return
示例2: createPlugins
def createPlugins(manager):
if not isinstance(manager, IMarkersManager):
raise AssertionError('Class of manager must extends IMarkersManager')
visitor = g_sessionProvider.arenaVisitor
setup = {'equipments': EquipmentsMarkerPlugin}
if visitor.hasFlags():
setup['vehicles_flags'] = VehicleAndFlagsMarkerPlugin
setup['absorption'] = AbsorptionMarkersPlugin
elif visitor.hasRespawns():
setup['vehicles'] = RespawnableVehicleMarkerPlugin
else:
setup['vehicles'] = VehicleMarkerPlugin
if visitor.hasRepairPoints():
setup['repairs'] = RepairsMarkerPlugin
if visitor.hasResourcePoints():
setup['resources'] = ResourceMarkerPlugin
setup['safe_zone'] = visitor.hasGasAttack() and GasAttackSafeZonePlugin
plugins = PluginsCollection(manager)
plugins.addPlugins(setup)
return plugins
示例3: __init__
def __init__(self, parentUI):
self.__ui = parentUI
self.__flashObject = None
self.__cds = [None] * PANEL_MAX_LENGTH
self.__mask = 0
self.__keys = {}
self.__currentOrderIdx = -1
self.__plugins = PluginsCollection(self)
plugins = {}
if hasRage():
plugins['rageBar'] = _RageBarPlugin
self.__plugins.addPlugins(plugins)
示例4: __init__
def __init__(self, appNS):
self.__ns = appNS
self.__isVisible = True
self.__soundManager = None
self.__arena = BigWorld.player().arena
self.__crosshairPanel = None
components = _COMPONENTS_TO_CTRLS[:]
self.__plugins = PluginsCollection(self)
plugins = {}
visitor = g_sessionProvider.arenaVisitor
if visitor.hasFlags():
components.append((BATTLE_CTRL_ID.FLAG_NOTS, ('fallout/flagsNots',)))
plugins['flagNotification'] = FlagNotificationPlugin
if visitor.hasRepairPoints():
plugins['repairTimer'] = RepairTimerPlugin
if visitor.hasRespawns() and (constants.IS_DEVELOPMENT or not BattleReplay.g_replayCtrl.isPlaying):
components.append((BATTLE_CTRL_ID.RESPAWN, ('fallout/respawn',)))
plugins['respawnView'] = RespawnViewPlugin
if visitor.hasResourcePoints():
plugins['resources'] = ResourcePointsPlugin
if visitor.hasGasAttack():
components.append((BATTLE_CTRL_ID.GAS_ATTACK, ('fallout/gasAttack',)))
plugins['gasAttack'] = GasAttackPlugin
g_sessionProvider.registerViewComponents(*components)
self.__plugins.addPlugins(plugins)
self.__denunciator = BattleDenunciator()
self.__timerSounds = {}
for timer, sounds in self.VEHICLE_DEATHZONE_TIMER_SOUND.iteritems():
self.__timerSounds[timer] = {}
for level, sound in sounds.iteritems():
self.__timerSounds[timer][level] = SoundGroups.g_instance.getSound2D(sound)
self.__timerSound = None
BattleWindow.__init__(self, 'battle.swf')
self.__isHelpWindowShown = False
self.__cameraMode = None
self.component.wg_inputKeyMode = 1
self.component.position.z = DEPTH_OF_Battle
self.movie.backgroundAlpha = 0
self.addFsCallbacks({'battle.leave': self.onExitBattle})
self.addExternalCallbacks({'battle.showCursor': self.cursorVisibility,
'battle.tryLeaveRequest': self.tryLeaveRequest,
'battle.populateFragCorrelationBar': self.populateFragCorrelationBar,
'Battle.UsersRoster.Appeal': self.onDenunciationReceived,
'Battle.selectPlayer': self.selectPlayer,
'battle.helpDialogOpenStatus': self.helpDialogOpenStatus,
'battle.initLobbyDialog': self._initLobbyDialog,
'battle.reportBug': self.reportBug})
self.__dynSquadListener = None
BigWorld.wg_setRedefineKeysMode(False)
self.onPostmortemVehicleChanged(BigWorld.player().playerVehicleID)
return
示例5: __init__
def __init__(self):
super(CrosshairPanel, self).__init__('crosshairPanel.swf', className=_CROSSHAIR_PANEL_COMPONENT, path=SCALEFORM_SWF_PATH_V3)
self.__plugins = PluginsCollection(self)
self.__plugins.addPlugins({'core': CorePlugin,
'settings': SettingsPlugin,
'events': EventBusPlugin,
'ammo': AmmoPlugin,
'vehicleState': VehicleStatePlugin,
'targetDistance': TargetDistancePlugin,
'gunMarkerDistance': GunMarkerDistancePlugin})
self.__viewID = CROSSHAIR_VIEW_ID.UNDEFINED
self.__zoomFactor = 0.0
self.__distance = 0
self.__hasAmmo = True
self.__configure()
self.__daapiBridge = DAAPIRootBridge(rootPath='root.g_modeMC', initCallback='registerCrosshairPanel')
self.__daapiBridge.setPyScript(weakref.proxy(self))
示例6: __init__
def __init__(self, parentUI):
Flash.__init__(self, self.__SWF_FILE_NAME)
self.component.wg_inputKeyMode = 2
self.component.position.z = DEPTH_OF_VehicleMarker
self.component.drawWithRestrictedViewPort = False
self.movie.backgroundAlpha = 0
self.colorManager = ColorSchemeManager._ColorSchemeManager()
self.colorManager.populateUI(weakref.proxy(self))
self.__plugins = PluginsCollection(self)
plugins = {'equipments': _EquipmentsMarkerPlugin}
if isEventBattle():
plugins.update({'flags': _FlagsMarkerPlugin,
'repairs': _RepairsMarkerPlugin})
self.__plugins.addPlugins(plugins)
self.__ownUI = None
self.__parentUI = parentUI
self.__markers = dict()
return
示例7: __init__
def __init__(self, parentUI):
Flash.__init__(self, _MARKERS_MANAGER_SWF)
self.component.wg_inputKeyMode = 2
self.component.position.z = DEPTH_OF_VehicleMarker
self.component.drawWithRestrictedViewPort = False
self.movie.backgroundAlpha = 0
self.colorManager = ColorSchemeManager._ColorSchemeManager()
self.colorManager.populateUI(weakref.proxy(self))
self.__plugins = PluginsCollection(self)
plugins = {'equipments': _EquipmentsMarkerPlugin}
if arena_info.hasFlags():
plugins['flags'] = _FlagsMarkerPlugin
if arena_info.hasRepairPoints():
plugins['repairs'] = _RepairsMarkerPlugin
if arena_info.hasResourcePoints():
plugins['resources'] = _ResourceMarkerPlugin
self.__plugins.addPlugins(plugins)
self.__ownUI = None
self.__parentUI = parentUI
self.__markers = {}
示例8: Battle
class Battle(BattleWindow):
teamBasesPanel = property(lambda self: self.__teamBasesPanel)
timersBar = property(lambda self: self.__timersBar)
consumablesPanel = property(lambda self: self.__consumablesPanel)
damagePanel = property(lambda self: self.__damagePanel)
markersManager = property(lambda self: self.__markersManager)
vErrorsPanel = property(lambda self: self.__vErrorsPanel)
vMsgsPanel = property(lambda self: self.__vMsgsPanel)
pMsgsPanel = property(lambda self: self.__pMsgsPanel)
minimap = property(lambda self: self.__minimap)
radialMenu = property(lambda self: self.__radialMenu)
damageInfoPanel = property(lambda self: self.__damageInfoPanel)
fragCorrelation = property(lambda self: self.__fragCorrelation)
statsForm = property(lambda self: self.__statsForm)
leftPlayersPanel = property(lambda self: self.__leftPlayersPanel)
rightPlayersPanel = property(lambda self: self.__rightPlayersPanel)
ribbonsPanel = property(lambda self: self.__ribbonsPanel)
ppSwitcher = property(lambda self: self.__ppSwitcher)
indicators = property(lambda self: self.__indicators)
VEHICLE_DESTROY_TIMER = {'ALL': 'all',
constants.VEHICLE_MISC_STATUS.VEHICLE_DROWN_WARNING: 'drown',
constants.VEHICLE_MISC_STATUS.VEHICLE_IS_OVERTURNED: 'overturn'}
VEHICLE_DEATHZONE_TIMER = {'ALL': 'all',
constants.DEATH_ZONES.STATIC: 'death_zone',
constants.DEATH_ZONES.GAS_ATTACK: 'gas_attack'}
VEHICLE_DEATHZONE_TIMER_SOUND = {constants.DEATH_ZONES.GAS_ATTACK: ({'warning': 'fallout_gaz_sphere_warning',
'critical': 'fallout_gaz_sphere_timer'}, {'warning': '/GUI/fallout/fallout_gaz_sphere_warning',
'critical': '/GUI/fallout/fallout_gaz_sphere_timer'})}
DENUNCIATIONS = {'bot': constants.DENUNCIATION.BOT,
'flood': constants.DENUNCIATION.FLOOD,
'offend': constants.DENUNCIATION.OFFEND,
'notFairPlay': constants.DENUNCIATION.NOT_FAIR_PLAY,
'forbiddenNick': constants.DENUNCIATION.FORBIDDEN_NICK,
'swindle': constants.DENUNCIATION.SWINDLE,
'blackmail': constants.DENUNCIATION.BLACKMAIL}
__cameraVehicleID = -1
__stateHandlers = {VEHICLE_VIEW_STATE.FIRE: '_setFireInVehicle',
VEHICLE_VIEW_STATE.SHOW_DESTROY_TIMER: '_showVehicleTimer',
VEHICLE_VIEW_STATE.HIDE_DESTROY_TIMER: '_hideVehicleTimer',
VEHICLE_VIEW_STATE.SHOW_DEATHZONE_TIMER: 'showDeathzoneTimer',
VEHICLE_VIEW_STATE.HIDE_DEATHZONE_TIMER: 'hideDeathzoneTimer',
VEHICLE_VIEW_STATE.OBSERVED_BY_ENEMY: '_showSixthSenseIndicator'}
def __init__(self, appNS):
self.__ns = appNS
self.__soundManager = None
self.__arena = BigWorld.player().arena
self.__plugins = PluginsCollection(self)
plugins = {}
if hasFlags():
plugins['flagNotification'] = FlagNotificationPlugin
if hasRepairPoints():
plugins['repairTimer'] = RepairTimerPlugin
if hasRespawns() and not BattleReplay.g_replayCtrl.isPlaying:
plugins['respawnView'] = RespawnViewPlugin
if hasResourcePoints():
plugins['resources'] = ResourcePointsPlugin
if hasGasAttack():
plugins['gasAttack'] = GasAttackPlugin
self.__plugins.addPlugins(plugins)
self.__timerSounds = {}
for timer, sounds in self.VEHICLE_DEATHZONE_TIMER_SOUND.iteritems():
self.__timerSounds[timer] = {}
for level, sound in sounds[FMOD.enabled].iteritems():
self.__timerSounds[timer][level] = SoundGroups.g_instance.getSound2D(sound)
self.__timerSound = None
BattleWindow.__init__(self, 'battle.swf')
self.__isHelpWindowShown = False
self.__cameraMode = None
self.component.wg_inputKeyMode = 1
self.component.position.z = DEPTH_OF_Battle
self.movie.backgroundAlpha = 0
self.addFsCallbacks({'battle.leave': self.onExitBattle})
self.addExternalCallbacks({'battle.showCursor': self.cursorVisibility,
'battle.tryLeaveRequest': self.tryLeaveRequest,
'battle.populateFragCorrelationBar': self.populateFragCorrelationBar,
'Battle.UsersRoster.Appeal': self.onDenunciationReceived,
'Battle.selectPlayer': self.selectPlayer,
'battle.helpDialogOpenStatus': self.helpDialogOpenStatus,
'battle.initLobbyDialog': self._initLobbyDialog,
'battle.reportBug': self.reportBug})
self.__dynSquadListener = None
BigWorld.wg_setRedefineKeysMode(False)
self.onPostmortemVehicleChanged(BigWorld.player().playerVehicleID)
return
@property
def appNS(self):
return self.__ns
def getRoot(self):
return self.__battle_flashObject
def getCameraVehicleID(self):
return self.__cameraVehicleID
def populateFragCorrelationBar(self, _):
if self.__fragCorrelation is not None:
self.__fragCorrelation.populate()
#.........这里部分代码省略.........
示例9: CrosshairPanel
class CrosshairPanel(Flash.Flash, CrosshairPanelMeta):
"""Class is UI component of crosshair panel. It provides access to Action Script."""
def __init__(self):
super(CrosshairPanel, self).__init__('crosshairPanel.swf', className=_CROSSHAIR_PANEL_COMPONENT, path=SCALEFORM_SWF_PATH_V3)
self.__plugins = PluginsCollection(self)
self.__plugins.addPlugins({'core': CorePlugin,
'settings': SettingsPlugin,
'events': EventBusPlugin,
'ammo': AmmoPlugin,
'vehicleState': VehicleStatePlugin,
'targetDistance': TargetDistancePlugin,
'gunMarkerDistance': GunMarkerDistancePlugin})
self.__viewID = CROSSHAIR_VIEW_ID.UNDEFINED
self.__zoomFactor = 0.0
self.__distance = 0
self.__hasAmmo = True
self.__configure()
self.__daapiBridge = DAAPIRootBridge(rootPath='root.g_modeMC', initCallback='registerCrosshairPanel')
self.__daapiBridge.setPyScript(weakref.proxy(self))
def close(self):
if self.__daapiBridge is not None:
self.__daapiBridge.clear()
self.__daapiBridge = None
super(CrosshairPanel, self).close()
return
def isVisible(self):
"""Is component visible.
:return: bool.
"""
return self.component.visible
def setVisible(self, visible):
"""Sets visibility of component.
:param visible: bool.
"""
self.component.visible = visible
def getViewID(self):
"""Gets current view ID of panel.
:return: integer containing of CROSSHAIR_VIEW_ID.
"""
return self.__viewID
def setViewID(self, viewID):
"""Sets view ID of panel to change view presentation.
:param viewID:
"""
if viewID != self.__viewID:
self.__viewID = viewID
self.as_setViewS(viewID)
def getSize(self):
"""Gets size of crosshair panel.
:return: tuple(width, height).
"""
return self.component.size
def setSize(self, width, height):
"""Sets size of crosshair panel in pixels.
:param width: integer containing width of panel.
:param height: integer containing height of panel.
"""
self.component.size = (width, height)
def setPosition(self, x, y):
"""Sets position of crosshair panel in pixels.
:param x: integer containing x coordinate of center in pixels.
:param y: integer containing y coordinate of center in pixels.
"""
self.as_recreateDeviceS(x, y)
def getScale(self):
"""Gets scale factor.
:return: float containing scale factor.
"""
return self.movie.stage.scaleX
def setScale(self, scale):
"""Sets scale factor.
:param scale: float containing new scale factor.
"""
self.movie.stage.scaleX = scale
self.movie.stage.scaleY = scale
def getZoom(self):
"""Gets current zoom factor of player's camera.
:return: float containing zoom factor.
"""
return self.__zoomFactor
def setZoom(self, zoomFactor):
"""Gets current zoom factor of player's camera.
:param zoomFactor: float containing zoom factor.
"""
if zoomFactor == self.__zoomFactor:
return
self.__zoomFactor = zoomFactor
#.........这里部分代码省略.........
示例10: MarkersManager
class MarkersManager(Flash):
def __init__(self, parentUI):
Flash.__init__(self, _MARKERS_MANAGER_SWF)
self.component.wg_inputKeyMode = 2
self.component.position.z = DEPTH_OF_VehicleMarker
self.component.drawWithRestrictedViewPort = False
self.movie.backgroundAlpha = 0
self.colorManager = ColorSchemeManager._ColorSchemeManager()
self.colorManager.populateUI(weakref.proxy(self))
self.__plugins = PluginsCollection(self)
plugins = {'equipments': _EquipmentsMarkerPlugin}
if arena_info.hasFlags():
plugins['flags'] = _FlagsMarkerPlugin
if arena_info.hasRepairPoints():
plugins['repairs'] = _RepairsMarkerPlugin
if arena_info.hasResourcePoints():
plugins['resources'] = _ResourceMarkerPlugin
if arena_info.hasGasAttack():
plugins['safe_zone'] = _GasAttackSafeZonePlugin
self.__plugins.addPlugins(plugins)
self.__ownUI = None
self.__parentUI = parentUI
self.__markers = {}
return
def setScaleProps(self, minScale = 40, maxScale = 100, defScale = 100, speed = 3.0):
if constants.IS_DEVELOPMENT:
self.__ownUI.scaleProperties = (minScale,
maxScale,
defScale,
speed)
def setAlphaProps(self, minAlpha = 40, maxAlpha = 100, defAlpha = 100, speed = 3.0):
if constants.IS_DEVELOPMENT:
self.__ownUI.alphaProperties = (minAlpha,
maxAlpha,
defAlpha,
speed)
def start(self):
self.active(True)
self.__ownUI = GUI.WGVehicleMarkersCanvasFlash(self.movie)
self.__ownUI.wg_inputKeyMode = 2
self.__ownUI.scaleProperties = GUI_SETTINGS.markerScaleSettings
self.__ownUI.alphaProperties = GUI_SETTINGS.markerBgSettings
self.__ownUIProxy = weakref.ref(self.__ownUI)
self.__ownUIProxy().markerSetScale(g_settingsCore.interfaceScale.get())
g_settingsCore.interfaceScale.onScaleChanged += self.updateMarkersScale
self.__parentUI.component.addChild(self.__ownUI, 'vehicleMarkersManager')
self.__markersCanvasUI = self.getMember('vehicleMarkersCanvas')
self.__plugins.init()
ctrl = g_sessionProvider.getFeedback()
if ctrl is not None:
ctrl.onVehicleMarkerAdded += self.__onVehicleMarkerAdded
ctrl.onVehicleMarkerRemoved += self.__onVehicleMarkerRemoved
ctrl.onVehicleFeedbackReceived += self.__onVehicleFeedbackReceived
functional = g_sessionProvider.getDynSquadFunctional()
if functional is not None:
functional.onPlayerBecomeSquadman += self.__onPlayerBecomeSquadman
self.__plugins.start()
g_eventBus.addListener(GameEvent.SHOW_EXTENDED_INFO, self.__handleShowExtendedInfo, scope=_SCOPE)
g_eventBus.addListener(GameEvent.GUI_VISIBILITY, self.__handleGUIVisibility, scope=_SCOPE)
return
def destroy(self):
g_eventBus.removeListener(GameEvent.SHOW_EXTENDED_INFO, self.__handleShowExtendedInfo, scope=_SCOPE)
g_eventBus.removeListener(GameEvent.GUI_VISIBILITY, self.__handleGUIVisibility, scope=_SCOPE)
self.__plugins.stop()
g_settingsCore.interfaceScale.onScaleChanged -= self.updateMarkersScale
ctrl = g_sessionProvider.getFeedback()
if ctrl is not None:
ctrl.onVehicleMarkerAdded -= self.__onVehicleMarkerAdded
ctrl.onVehicleMarkerRemoved -= self.__onVehicleMarkerRemoved
ctrl.onVehicleFeedbackReceived -= self.__onVehicleFeedbackReceived
functional = g_sessionProvider.getDynSquadFunctional()
if functional is not None:
functional.onPlayerBecomeSquadman -= self.__onPlayerBecomeSquadman
if self.__parentUI is not None:
setattr(self.__parentUI.component, 'vehicleMarkersManager', None)
self.__plugins.fini()
self.__parentUI = None
self.__ownUI = None
self.__markersCanvasUI = None
self.colorManager.dispossessUI()
self.close()
return
def _createVehicleMarker(self, isAlly, mProv):
markerLinkage = 'VehicleMarkerAlly' if isAlly else 'VehicleMarkerEnemy'
if arena_info.hasFlags():
markerID = self.__ownUI.addFalloutMarker(mProv, markerLinkage)
else:
markerID = self.__ownUI.addMarker(mProv, markerLinkage)
return markerID
def addVehicleMarker(self, vProxy, vInfo, guiProps):
vTypeDescr = vProxy.typeDescriptor
maxHealth = vTypeDescr.maxHealth
mProv = vProxy.model.node('HP_gui')
#.........这里部分代码省略.........
示例11: ConsumablesPanel
class ConsumablesPanel(object):
def __init__(self, parentUI):
self.__ui = parentUI
self.__flashObject = None
self.__cds = [None] * PANEL_MAX_LENGTH
self.__mask = 0
self.__keys = {}
self.__currentOrderIdx = -1
self.__plugins = PluginsCollection(self)
plugins = {}
if hasRage():
plugins['rageBar'] = _RageBarPlugin
self.__plugins.addPlugins(plugins)
return
def start(self):
self.__flashObject = self.__ui.getMember('_level0.consumablesPanel')
if self.__flashObject:
self.__flashObject.resync()
self.__flashObject.script = self
self.__plugins.init()
self.__plugins.start()
props = _FalloutSlotViewProps(useStandardLayout=not hasRage())
self.__flashObject.setProperties(isEventBattle(), props._asdict())
self.__addListeners()
else:
LOG_ERROR('Display object is not found in the swf file.')
def destroy(self):
self.__plugins.stop()
self.__plugins.fini()
self.__removeListeners()
self.__keys.clear()
self.__ui = None
if self.__flashObject is not None:
self.__flashObject.script = None
self.__flashObject = None
return
def bindCommands(self):
keys = {}
slots = []
for idx, bwKey, sfKey, handler in self.__getKeysGenerator():
if handler:
keys[bwKey] = handler
slots.append((idx, bwKey, sfKey))
self.__flashObject.setKeysToSlots(slots)
self.__keys.clear()
self.__keys = keys
def onClickedToSlot(self, bwKey):
self.__handleBWKey(int(bwKey))
def onPopUpClosed(self):
keys = {}
for idx, bwKey, _, handler in self.__getKeysGenerator():
if handler:
keys[bwKey] = handler
self.__keys.clear()
self.__keys = keys
ctrl = g_sessionProvider.getVehicleStateCtrl()
ctrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
@property
def flashObject(self):
return self.__flashObject
def __callFlash(self, funcName, args = None):
self.__ui.call('battle.consumablesPanel.%s' % funcName, args)
def __addListeners(self):
vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
vehicleCtrl.onPostMortemSwitched += self.__onPostMortemSwitched
vehicleCtrl.onRespawnBaseMoving += self.__onRespawnBaseMoving
ammoCtrl = g_sessionProvider.getAmmoCtrl()
ammoCtrl.onShellsAdded += self.__onShellsAdded
ammoCtrl.onShellsUpdated += self.__onShellsUpdated
ammoCtrl.onNextShellChanged += self.__onNextShellChanged
ammoCtrl.onCurrentShellChanged += self.__onCurrentShellChanged
ammoCtrl.onGunReloadTimeSet += self.__onGunReloadTimeSet
ammoCtrl.onGunReloadTimeSetInPercent += self.__onGunReloadTimeSetInPercent
eqCtrl = g_sessionProvider.getEquipmentsCtrl()
eqCtrl.onEquipmentAdded += self.__onEquipmentAdded
eqCtrl.onEquipmentUpdated += self.__onEquipmentUpdated
eqCtrl.onEquipmentCooldownInPercent += self.__onEquipmentCooldownInPercent
optDevicesCtrl = g_sessionProvider.getOptDevicesCtrl()
optDevicesCtrl.onOptionalDeviceAdded += self.__onOptionalDeviceAdded
optDevicesCtrl.onOptionalDeviceUpdated += self.__onOptionalDeviceUpdated
g_eventBus.addListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE)
def __removeListeners(self):
g_eventBus.removeListener(GameEvent.CHOICE_CONSUMABLE, self.__handleConsumableChoice, scope=EVENT_BUS_SCOPE.BATTLE)
vehicleCtrl = g_sessionProvider.getVehicleStateCtrl()
vehicleCtrl.onPostMortemSwitched -= self.__onPostMortemSwitched
vehicleCtrl.onRespawnBaseMoving -= self.__onRespawnBaseMoving
vehicleCtrl.onVehicleStateUpdated -= self.__onVehicleStateUpdated
ammoCtrl = g_sessionProvider.getAmmoCtrl()
#.........这里部分代码省略.........
示例12: MarkersManager
class MarkersManager(Flash, IDynSquadEntityClient):
__SWF_FILE_NAME = 'VehicleMarkersManager.swf'
MARKER_POSITION_ADJUSTMENT = Vector3(0.0, 12.0, 0.0)
class DAMAGE_TYPE:
FROM_UNKNOWN = 0
FROM_ALLY = 1
FROM_ENEMY = 2
FROM_SQUAD = 3
FROM_PLAYER = 4
def __init__(self, parentUI):
Flash.__init__(self, self.__SWF_FILE_NAME)
self.component.wg_inputKeyMode = 2
self.component.position.z = DEPTH_OF_VehicleMarker
self.component.drawWithRestrictedViewPort = False
self.movie.backgroundAlpha = 0
self.colorManager = ColorSchemeManager._ColorSchemeManager()
self.colorManager.populateUI(weakref.proxy(self))
self.__plugins = PluginsCollection(self)
plugins = {'equipments': _EquipmentsMarkerPlugin}
if isEventBattle():
plugins.update({'flags': _FlagsMarkerPlugin,
'repairs': _RepairsMarkerPlugin})
self.__plugins.addPlugins(plugins)
self.__ownUI = None
self.__parentUI = parentUI
self.__markers = dict()
return
def updateSquadmanVeh(self, vID):
handle = getattr(BigWorld.entity(vID), 'marker', None)
if handle is not None:
self.invokeMarker(handle, 'setEntityName', [PLAYER_ENTITY_NAME.squadman.name()])
return
def showExtendedInfo(self, value):
self.__invokeCanvas('setShowExInfoFlag', [value])
for handle in self.__markers.iterkeys():
self.invokeMarker(handle, 'showExInfo', [value])
def setScaleProps(self, minScale = 40, maxScale = 100, defScale = 100, speed = 3.0):
if constants.IS_DEVELOPMENT:
self.__ownUI.scaleProperties = (minScale,
maxScale,
defScale,
speed)
def setAlphaProps(self, minAlpha = 40, maxAlpha = 100, defAlpha = 100, speed = 3.0):
if constants.IS_DEVELOPMENT:
self.__ownUI.alphaProperties = (minAlpha,
maxAlpha,
defAlpha,
speed)
def start(self):
self.active(True)
self.__ownUI = GUI.WGVehicleMarkersCanvasFlash(self.movie)
self.__ownUI.wg_inputKeyMode = 2
self.__ownUI.scaleProperties = GUI_SETTINGS.markerScaleSettings
self.__ownUI.alphaProperties = GUI_SETTINGS.markerBgSettings
self.__ownUIProxy = weakref.ref(self.__ownUI)
self.__ownUIProxy().markerSetScale(g_settingsCore.interfaceScale.get())
g_settingsCore.interfaceScale.onScaleChanged += self.updateMarkersScale
self.__parentUI.component.addChild(self.__ownUI, 'vehicleMarkersManager')
self.__markersCanvasUI = self.getMember('vehicleMarkersCanvas')
self.__plugins.init()
self.__plugins.start()
def destroy(self):
self.__plugins.stop()
g_settingsCore.interfaceScale.onScaleChanged -= self.updateMarkersScale
if self.__parentUI is not None:
setattr(self.__parentUI.component, 'vehicleMarkersManager', None)
self.__plugins.fini()
self.__parentUI = None
self.__ownUI = None
self.__markersCanvasUI = None
self.colorManager.dispossessUI()
self.close()
return
def createMarker(self, vProxy):
vInfo = dict(vProxy.publicInfo)
battleCtx = g_sessionProvider.getCtx()
if battleCtx.isObserver(vProxy.id):
return -1
isFriend = vInfo['team'] == BigWorld.player().team
vehID = vProxy.id
vInfoEx = g_sessionProvider.getArenaDP().getVehicleInfo(vehID)
vTypeDescr = vProxy.typeDescriptor
maxHealth = vTypeDescr.maxHealth
mProv = vProxy.model.node('HP_gui')
tags = set(vTypeDescr.type.tags & VEHICLE_CLASS_TAGS)
vClass = tags.pop() if len(tags) > 0 else ''
entityName = battleCtx.getPlayerEntityName(vehID, vInfoEx.team)
entityType = 'ally' if BigWorld.player().team == vInfoEx.team else 'enemy'
speaking = False
if GUI_SETTINGS.voiceChat:
speaking = VoiceChatInterface.g_instance.isPlayerSpeaking(vInfoEx.player.accountDBID)
#.........这里部分代码省略.........
示例13: Battle
class Battle(BattleWindow):
teamBasesPanel = property(lambda self: self.__teamBasesPanel)
timersBar = property(lambda self: self.__timersBar)
consumablesPanel = property(lambda self: self.__consumablesPanel)
damagePanel = property(lambda self: self.__damagePanel)
markersManager = property(lambda self: self.__markersManager)
vErrorsPanel = property(lambda self: self.__vErrorsPanel)
vMsgsPanel = property(lambda self: self.__vMsgsPanel)
pMsgsPanel = property(lambda self: self.__pMsgsPanel)
minimap = property(lambda self: self.__minimap)
radialMenu = property(lambda self: self.__radialMenu)
damageInfoPanel = property(lambda self: self.__damageInfoPanel)
fragCorrelation = property(lambda self: self.__fragCorrelation)
statsForm = property(lambda self: self.__statsForm)
leftPlayersPanel = property(lambda self: self.__leftPlayersPanel)
rightPlayersPanel = property(lambda self: self.__rightPlayersPanel)
ribbonsPanel = property(lambda self: self.__ribbonsPanel)
ppSwitcher = property(lambda self: self.__ppSwitcher)
VEHICLE_DESTROY_TIMER = {'ALL': 'all',
constants.VEHICLE_MISC_STATUS.VEHICLE_DROWN_WARNING: 'drown',
constants.VEHICLE_MISC_STATUS.VEHICLE_IS_OVERTURNED: 'overturn'}
VEHICLE_DEATHZONE_TIMER = {'ALL': 'all',
constants.DEATH_ZONES.STATIC: 'death_zone',
constants.DEATH_ZONES.GAS_ATTACK: 'gas_attack'}
VEHICLE_DEATHZONE_TIMER_SOUND = {constants.DEATH_ZONES.GAS_ATTACK: {'warning': 'fallout_gaz_sphere_warning',
'critical': 'fallout_gaz_sphere_timer'}}
__cameraVehicleID = -1
__stateHandlers = {VEHICLE_VIEW_STATE.FIRE: '_setFireInVehicle',
VEHICLE_VIEW_STATE.SHOW_DESTROY_TIMER: '_showVehicleTimer',
VEHICLE_VIEW_STATE.HIDE_DESTROY_TIMER: '_hideVehicleTimer',
VEHICLE_VIEW_STATE.SHOW_DEATHZONE_TIMER: 'showDeathzoneTimer',
VEHICLE_VIEW_STATE.HIDE_DEATHZONE_TIMER: 'hideDeathzoneTimer',
VEHICLE_VIEW_STATE.OBSERVED_BY_ENEMY: '_showSixthSenseIndicator'}
def __init__(self, appNS):
g_sessionProvider.registerViewComponents(*_COMPONENTS_TO_CTRLS)
self.__ns = appNS
self.__soundManager = None
self.__arena = BigWorld.player().arena
self.__plugins = PluginsCollection(self)
plugins = {}
if hasFlags():
plugins['flagNotification'] = FlagNotificationPlugin
if hasRepairPoints():
plugins['repairTimer'] = RepairTimerPlugin
if hasRespawns() and (constants.IS_DEVELOPMENT or not BattleReplay.g_replayCtrl.isPlaying):
plugins['respawnView'] = RespawnViewPlugin
if hasResourcePoints():
plugins['resources'] = ResourcePointsPlugin
if hasGasAttack():
plugins['gasAttack'] = GasAttackPlugin
self.__plugins.addPlugins(plugins)
self.__denunciator = BattleDenunciator()
self.__timerSounds = {}
for timer, sounds in self.VEHICLE_DEATHZONE_TIMER_SOUND.iteritems():
self.__timerSounds[timer] = {}
for level, sound in sounds.iteritems():
self.__timerSounds[timer][level] = SoundGroups.g_instance.getSound2D(sound)
self.__timerSound = None
BattleWindow.__init__(self, 'battle.swf')
self.__isHelpWindowShown = False
self.__cameraMode = None
self.component.wg_inputKeyMode = 1
self.component.position.z = DEPTH_OF_Battle
self.movie.backgroundAlpha = 0
self.addFsCallbacks({'battle.leave': self.onExitBattle})
self.addExternalCallbacks({'battle.showCursor': self.cursorVisibility,
'battle.tryLeaveRequest': self.tryLeaveRequest,
'battle.populateFragCorrelationBar': self.populateFragCorrelationBar,
'Battle.UsersRoster.Appeal': self.onDenunciationReceived,
'Battle.selectPlayer': self.selectPlayer,
'battle.helpDialogOpenStatus': self.helpDialogOpenStatus,
'battle.initLobbyDialog': self._initLobbyDialog,
'battle.reportBug': self.reportBug})
self.__dynSquadListener = None
BigWorld.wg_setRedefineKeysMode(False)
self.onPostmortemVehicleChanged(BigWorld.player().playerVehicleID)
return
@property
def appNS(self):
return self.__ns
@property
def soundManager(self):
return self.__soundManager
def attachCursor(self, flags = 0):
return g_cursorDelegator.activateCursor()
def detachCursor(self):
return g_cursorDelegator.detachCursor()
def syncCursor(self, flags = 0):
pass
def getRoot(self):
return self.__battle_flashObject
#.........这里部分代码省略.........