Example #1
0
 def _enable(self, state, isFirstInit):
     if isFirstInit:
         return
     else:
         ts = state['target']
         if ts['startTime'] is not None:
             self._setTarget(ts['name'], ts['vType'], ts['isFriend'])
             Aim._flashCall(self, 'updateTarget', [ts['dist']])
             self._clearTarget(BigWorld.time() - ts['startTime'])
         hs = state['health']
         self._setHealth(hs['cur'], hs['max'])
         ammoCtrl = g_sessionProvider.getAmmoCtrl()
         if ammoCtrl.isGunReloadTimeInPercent():
             self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False)
         elif self._reloadingHndl.state['startTime'] is not None:
             self._setReloading(
                 self._reloadingHndl.state['duration'],
                 startTime=BigWorld.time() -
                 self._reloadingHndl.state['startTime'],
                 correction=self._reloadingHndl.state['correction'])
         else:
             self._setReloading(self._reloadingHndl.state['duration'], 0,
                                False)
         capacity, burst = state['clip']
         self._setClipParams(capacity, burst)
         self._setAmmoStock(*self._reloadingHndl.ammoStock)
         return
Example #2
0
 def _update(self):
     Aim._update(self)
     if self.__vID is not None:
         vehicle = BigWorld.entity(self.__vID)
         if vehicle is not None:
             playerName = g_sessionProvider.getCtx().getFullPlayerName(vID=self.__vID, showVehShortName=False)
             type = vehicle.typeDescriptor.type.userString
             healthPercent = math.ceil(100.0 * max(0, vehicle.health) / vehicle.typeDescriptor.maxHealth)
             self.__setText(playerName, type, healthPercent)
     Aim._flashCall(self, 'updateTarget', [_g_aimState['target']['dist']])
Example #3
0
 def __setText(self, name, type, health):
     isPlayer = self.__vID == BigWorld.player().playerVehicleID
     caption = makeHtmlString(
         'html_templates:battle/postmortemMessages',
         'player' if isPlayer else 'ally', {
             'message':
             i18n.makeString(
                 INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION_SELF)
             if isPlayer else self.__msgCaption
         })
     Aim._flashCall(
         self, 'updatePlayerInfo',
         [caption % {
             'name': name,
             'type': type,
             'health': health
         }])
Example #4
0
 def _enable(self, state, isFirstInit):
     self.__damageCtrl.enable()
     if isFirstInit:
         return 
     Aim._flashCall(self, 'updateDistance', [self._getAimDistance()])
     hs = state['health']
     self._setHealth(hs['cur'], hs['max'])
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     if ammoCtrl.isGunReloadTimeInPercent():
         self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False)
     else:
         rs = state['reload']
         if rs['startTime'] is not None:
             self._setReloading(rs['duration'], startTime=BigWorld.time() - rs['startTime'], correction=rs['correction'])
         else:
             self._setReloading(rs['duration'], 0, False)
     (capacity, burst,) = state['clip']
     if capacity > 1:
         self._setClipParams(capacity, burst)
     self._setAmmoStock(*state['ammo'])
Example #5
0
 def _enable(self, state, isFirstInit):
     if isFirstInit:
         return
     ts = state['target']
     if ts['startTime'] is not None:
         self._setTarget(ts['name'], ts['vType'], ts['isFriend'])
         Aim._flashCall(self, 'updateTarget', [ts['dist']])
         self._clearTarget(BigWorld.time() - ts['startTime'])
     hs = state['health']
     self._setHealth(hs['cur'], hs['max'])
     ammoCtrl = g_sessionProvider.getAmmoCtrl()
     if ammoCtrl.isGunReloadTimeInPercent():
         self.setReloadingInPercent(ammoCtrl.getGunReloadTime(), False)
     elif self._reloadingHndl.state['startTime'] is not None:
         self._setReloading(self._reloadingHndl.state['duration'], startTime=BigWorld.time() - self._reloadingHndl.state['startTime'], correction=self._reloadingHndl.state['correction'])
     else:
         self._setReloading(self._reloadingHndl.state['duration'], 0, False)
     capacity, burst = state['clip']
     self._setClipParams(capacity, burst)
     self._setAmmoStock(*self._reloadingHndl.ammoStock)
Example #6
0
def createAim(type):
    if not GUI_SETTINGS.isGuiEnabled():
        from gui.development.no_gui.battle import Aim
        return Aim()
    if type == 'strategic':
        return StrategicAim((0, 0.0))
    if type == 'arcade':
        return ArcadeAim((0, 0.15), False)
    if type == 'sniper':
        return ArcadeAim((0, 0.0), True)
    if type == 'postmortem':
        return PostMortemAim((0, 0.0))
    if type == 'falloutdeath':
        return FalloutDeathAim((0, 0.0))
    LOG_ERROR('Undefined aim type. <%s>' % type)
Example #7
0
 def _update(self):
     Aim._update(self)
     Aim._flashCall(self, 'updateTarget', [_g_aimState['target']['dist']])
Example #8
0
 def __init__(self, offset, isPostMortem = False):
     Aim.__init__(self, 'strategic', offset)
     self._distance = 0
Example #9
0
 def setVisible(self, isVisible):
     Aim.setVisible(self, isVisible)
     self.__damageCtrl.setVisible(isVisible)
Example #10
0
 def onRecreateDevice(self):
     Aim.onRecreateDevice(self)
     self.__damageCtrl.onRecreateDevice()
Example #11
0
 def create(self):
     Aim.create(self)
     self.__vID = None
Example #12
0
 def destroy(self):
     Aim.destroy(self)
     self.__damageCtrl.disable()
     self.__damageCtrl = None
Example #13
0
 def __init__(self, offset, isSniper):
     Aim.__init__(self, 'sniper' if isSniper else 'arcade', offset)
     self.__isSniper = isSniper
Example #14
0
 def destroy(self):
     Aim.destroy(self)
Example #15
0
 def _update(self):
     Aim._update(self)
     Aim._flashCall(self, 'updateDistance', [self._getAimDistance()])
Example #16
0
 def __init__(self, offset):
     Aim.__init__(self, 'postmortem', offset)
     self.__msgCaption = i18n.makeString('#ingame_gui:player_messages/postmortem_caption')
Example #17
0
 def __init__(self, offset):
     Aim.__init__(self, 'postmortem', offset)
     self.__msgCaption = i18n.makeString(
         INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION)
Example #18
0
 def _update(self):
     distance = Aim._update(self)
     if distance is not None:
         Aim._flashCall(self, 'updateTarget', [distance])
Example #19
0
 def __init__(self, offset, isSniper):
     Aim.__init__(self, 'sniper' if isSniper else 'arcade', offset)
     self.__isSniper = isSniper
Example #20
0
 def __init__(self, offset):
     Aim.__init__(self, 'postmortem', offset)
     self.__msgCaption = i18n.makeString(INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION)
Example #21
0
 def __init__(self, offset, isPostMortem=False):
     Aim.__init__(self, 'strategic', offset)
     self._distance = 0
Example #22
0
 def create(self):
     Aim.create(self)
     self.__vID = None
     return
Example #23
0
 def create(self):
     Aim.create(self)
     self.__damageCtrl = _DamageIndicatorCtrl(self._offset)
Example #24
0
 def __setText(self, name, type, health):
     isPlayer = self.__vID == BigWorld.player().playerVehicleID
     caption = makeHtmlString('html_templates:battle/postmortemMessages', 'player' if isPlayer else 'ally', {'message': i18n.makeString(INGAME_GUI.PLAYER_MESSAGES_POSTMORTEM_CAPTION_SELF) if isPlayer else self.__msgCaption})
     Aim._flashCall(self, 'updatePlayerInfo', [caption % {'name': name,
       'type': type,
       'health': health}])
Example #25
0
 def destroy(self):
     Aim.destroy(self)
Example #26
0
 def _update(self):
     distance = Aim._update(self)
     if distance is not None:
         Aim._flashCall(self, 'updateTarget', [distance])
     return
Example #27
0
 def __setText(self, name, type, health):
     text = i18n.convert(self.__msgCaption % {'name': name,
      'type': type,
      'health': health})
     Aim._flashCall(self, 'updatePlayerInfo', [text])