本文整理汇总了Python中AvatarInputHandler.CallbackDelayer.CallbackDelayer.delayCallback方法的典型用法代码示例。如果您正苦于以下问题:Python CallbackDelayer.delayCallback方法的具体用法?Python CallbackDelayer.delayCallback怎么用?Python CallbackDelayer.delayCallback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AvatarInputHandler.CallbackDelayer.CallbackDelayer
的用法示例。
在下文中一共展示了CallbackDelayer.delayCallback方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CombatEquipmentManager
# 需要导入模块: from AvatarInputHandler.CallbackDelayer import CallbackDelayer [as 别名]
# 或者: from AvatarInputHandler.CallbackDelayer.CallbackDelayer import delayCallback [as 别名]
#.........这里部分代码省略.........
self.debugDirs.append(nextDir)
self.debugPoints.append(nextPos + Vector3(nextDir.x, 0, nextDir.y) * 10)
self.debugPoints.append(nextPos)
self.debugPolyLine.set(self.debugPoints)
return
def showHittingArea(self, equipmentID, pos, dir, time):
if _ENABLE_DEBUG_LOG:
LOG_DEBUG('===== showHittingArea =====')
LOG_DEBUG(equipmentID)
LOG_DEBUG(pos, dir, time)
correctedCoords = tuple((int(x * 1000.0) for x in pos.tuple()))
areaUID = (int(equipmentID), correctedCoords)
if areaUID in self.__selectedAreas:
return
eq = vehicles.g_cache.equipments()[equipmentID]
if BattleReplay.isPlaying():
BigWorld.callback(0.0, functools.partial(self.__showMarkerCallback, eq, pos, dir, time, areaUID))
else:
self.__showMarkerCallback(eq, pos, dir, time, areaUID)
def __delayedAreaDestroy(self, areaUID):
area = self.__selectedAreas.pop(areaUID, None)
if area is not None:
area.destroy()
return
def __showMarkerCallback(self, eq, pos, dir, time, areaUID):
timer = round(time - BigWorld.serverTime())
area = self.__selectedAreas.pop(areaUID, None)
if area is not None:
area.destroy()
self.__selectedAreas[areaUID] = self.createEquipmentSelectedArea(pos, dir, eq)
self.__callbackDelayer.delayCallback(timer, functools.partial(self.__delayedAreaDestroy, areaUID))
g_sessionProvider.getEquipmentsCtrl().showMarker(eq, pos, dir, timer)
return
@staticmethod
def __calcBombsDistribution(bombsCnt, areaWidth, areaLength):
coeff = areaWidth / areaLength
bombsPerWidth = math.sqrt(bombsCnt * coeff)
bombsPerLength = bombsPerWidth / coeff
return (bombsPerWidth, bombsPerLength)
def showCarpetBombing(self, equipmentID, pos, dir, time):
if _ENABLE_DEBUG_LOG:
LOG_DEBUG('===== showCarpetBombing =====')
LOG_DEBUG(equipmentID)
LOG_DEBUG(pos, dir, time)
bombEquipment = vehicles.g_cache.equipments()[equipmentID]
shellDescr = items.vehicles.getDictDescr(bombEquipment.shellCompactDescr)
shotEffect = vehicles.g_cache.shotEffects[shellDescr['effectsIndex']]
airstrikeID = shotEffect.get('airstrikeID')
if airstrikeID is None:
LOG_ERROR('EquipmentID %s has no airstrike shot effect settings' % equipmentID)
return
else:
areaWidth, areaLength = bombEquipment.areaWidth, bombEquipment.areaLength
if _ENABLE_DEBUG_LOG:
LOG_DEBUG('Ideal', areaWidth, areaLength)
beginExplosionPos = BigWorld.wg_collideSegment(BigWorld.player().spaceID, pos, pos + dir * 1000.0, 18)
if beginExplosionPos is None:
return
beginExplosionPos = beginExplosionPos[0]
flatDir = Vector3(dir)
flatDir.y = 0.0
示例2: DetachedTurret
# 需要导入模块: from AvatarInputHandler.CallbackDelayer import CallbackDelayer [as 别名]
# 或者: from AvatarInputHandler.CallbackDelayer.CallbackDelayer import delayCallback [as 别名]
class DetachedTurret(BigWorld.Entity):
allTurrets = list()
def __init__(self):
self.__vehDescr = vehicles.VehicleDescr(compactDescr=self.vehicleCompDescr)
self.filter = BigWorld.WGTurretFilter()
self.__detachConfirmationTimer = SynchronousDetachment(self)
self.__detachConfirmationTimer.onInit()
self.__detachmentEffects = None
self.__hitEffects = {TankComponentNames.TURRET: None,
TankComponentNames.GUN: None}
self.__reactors = []
self.targetFullBounds = True
self.targetCaps = [1]
self.__isBeingPulledCallback = None
def reload(self):
pass
def prerequisites(self):
prereqs = [self.__vehDescr.turret['models']['exploded'], self.__vehDescr.gun['models']['exploded']]
prereqs += self.__vehDescr.prerequisites()
return prereqs
def onEnterWorld(self, prereqs):
self.model = prereqs[self.__vehDescr.turret['models']['exploded']]
self.__gunModel = prereqs[self.__vehDescr.gun['models']['exploded']]
node = self.model.node('HP_gunJoint', Math.Matrix())
node.attach(self.__gunModel)
self.__detachConfirmationTimer.onEnterWorld()
self.__vehDescr.keepPrereqs(prereqs)
turretDescr = self.__vehDescr.turret
if self.isUnderWater == 0:
self.__detachmentEffects = _TurretDetachmentEffects(self.model, turretDescr['turretDetachmentEffects'], self.isCollidingWithWorld == 1)
self.__reactors.append(self.__detachmentEffects)
else:
self.__detachmentEffects = None
self.__hitEffects[TankComponentNames.TURRET] = turretHitEffects = _HitEffects(self.model)
self.__hitEffects[TankComponentNames.GUN] = gunHitEffects = _HitEffects(self.__gunModel)
self.__reactors.append(turretHitEffects)
self.__reactors.append(gunHitEffects)
self.__componentsDesc = (self.__vehDescr.turret, self.__vehDescr.gun)
for desc in self.__componentsDesc:
desc['hitTester'].loadBspModel()
from AvatarInputHandler.CallbackDelayer import CallbackDelayer
self.__isBeingPulledCallback = CallbackDelayer()
self.__isBeingPulledCallback.delayCallback(self.__checkIsBeingPulled(), self.__checkIsBeingPulled)
DetachedTurret.allTurrets.append(self)
def onLeaveWorld(self):
DetachedTurret.allTurrets.remove(self)
self.__detachConfirmationTimer.cancel()
self.__detachConfirmationTimer = None
for reactor in self.__reactors:
if reactor is not None:
reactor.destroy()
self.__isBeingPulledCallback.destroy()
self.__isBeingPulledCallback = None
def onStaticCollision(self, energy, point, normal):
if self.__detachmentEffects is not None:
surfaceMaterial = calcSurfaceMaterialNearPoint(point, normal, self.spaceID)
effectIdx = surfaceMaterial.effectIdx
groundEffect = True
distToWater = BigWorld.wg_collideWater(self.position, surfaceMaterial.point)
if distToWater != -1:
vel = Math.Vector3(self.velocity).length
if vel < _MIN_COLLISION_SPEED:
groundEffect = False
effectIdx = material_kinds.EFFECT_MATERIAL_INDEXES_BY_NAMES['water']
self.__detachmentEffects.notifyAboutCollision(energy, point, effectIdx, groundEffect, self.isUnderWater)
def showDamageFromShot(self, points, effectsIndex):
(maxHitEffectCode, decodedPoints,) = DamageFromShotDecoder.decodeHitPoints(points, self.__vehDescr)
for shotPoint in decodedPoints:
hitEffects = self.__hitEffects.get(shotPoint.componentName)
if hitEffects is not None:
hitEffects.showHit(shotPoint, effectsIndex)
else:
LOG_ERROR("Detached turret got hit into %s component, but it's impossible" % shotPoint.componentName)
def collideSegment(self, startPoint, endPoint, skipGun = False):
res = None
#.........这里部分代码省略.........