本文整理汇总了Python中pirates.battle.WeaponGlobals.getSkillAmmoInventoryId方法的典型用法代码示例。如果您正苦于以下问题:Python WeaponGlobals.getSkillAmmoInventoryId方法的具体用法?Python WeaponGlobals.getSkillAmmoInventoryId怎么用?Python WeaponGlobals.getSkillAmmoInventoryId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.battle.WeaponGlobals
的用法示例。
在下文中一共展示了WeaponGlobals.getSkillAmmoInventoryId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: isSkillValid
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def isSkillValid(self, skillId):
return WeaponGlobals.getSkillAmmoInventoryId(skillId) in InventoryGlobals.AmmoInGUI
SkillIcons = loader.loadModel('models/textureCards/skillIcons')
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoName = PLocalizer.InventoryTypeNames.get(ammoId)
ammoDescription = PLocalizer.WeaponDescriptions.get(ammoId)
ammoIconName = WeaponGlobals.getSkillIcon(skillId)
ammoIcon = SkillIcons.find('**/%s' % ammoIconName)
skillRepId = WeaponGlobals.getSkillReputationCategoryId(skillId)
if ammoName and ammoDescription and ammoIcon and skillRepId:
return 1
else:
return 0
示例2: getAmmo
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def getAmmo(self, skillId):
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
if ammoId == None:
return None
else:
amount = localAvatar.getInventory().getStackQuantity(ammoId)
return amount
示例3: updateSkillTrayAmounts
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def updateSkillTrayAmounts(self):
if not self.traySkillMap:
return None
if self.weaponMode not in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
return None
if not hasattr(base, 'localAvatar'):
return None
inv = localAvatar.getInventory()
if not inv:
return None
self.numberOfItems = len(self.traySkillMap)
for i in range(self.numberOfItems):
if self.tray[i + 1].greyOut == -1:
continue
skillId = self.traySkillMap[i]
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
ammoAmt = WeaponGlobals.INF_QUANT
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoAmt = inv.getStackQuantity(ammoInvId)
ammoMax = inv.getStackLimit(ammoInvId)
self.tray[i + 1].updateQuantity(ammoAmt)
示例4: setupPlunder
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def setupPlunder(self, plunderList):
for (itemClass, itemId, stackAmount) in plunderList:
itemTuple = [
itemClass,
itemId,
0,
stackAmount]
if itemClass == InventoryType.ItemTypeWeapon:
item = self.manager.makeWeaponItem(itemTuple)
elif itemClass == InventoryType.ItemTypeCharm:
item = self.manager.makeCharmItem(itemTuple)
elif itemClass == InventoryType.ItemTypeConsumable:
item = self.manager.makeConsumableItem(itemTuple, showMax = 0)
elif itemClass == InventoryType.ItemTypeClothing:
item = self.manager.makeClothingItem(itemTuple)
elif itemClass == InventoryType.ItemTypeMoney:
item = self.manager.makeGoldItem(itemTuple)
elif itemClass == InventoryType.TreasureCollection:
item = self.manager.makeTreasureItem(itemTuple)
elif itemClass == InventoryCategory.CARDS:
cardId = itemId
itemTuple[1] -= InventoryType.begin_Cards
item = self.manager.makeCardItem(cardId, itemTuple, imageScaleFactor = 1.8999999999999999)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
item = self.manager.makeAmmoItem(itemId, itemTuple, showMax = 0)
if itemClass in (InventoryType.ItemTypeMoney, InventoryCategory.CARDS, InventoryType.TreasureCollection):
self.addGridCell(self.stackImage, 1.0)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
self.addGridCell(self.stackImage2, 1.0)
else:
self.addGridCell()
self.tryPutIntoFirstOpenCell(item)
示例5: setupCells
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def setupCells(self):
self.gridBackground = self.attachNewNode('grid-background')
WeaponIcons = loader.loadModel('models/gui/gui_icons_weapon')
gui = loader.loadModel('models/gui/toplevel_gui')
chestButtonClosed = gui.find('**/treasure_chest_closed_over')
self.figureOutStackTypes()
if len(self.listOfItemLists) == 0:
return None
self.computeCellSize()
for Z in range(self.gridZ):
for X in range(len(self.listOfItemLists[Z])):
skillId = self.listOfItemLists[Z][X]
if self.subBagTypeToBagId.has_key(skillId) and skillId not in self.subBagTypesCreated:
if self.seperatorOn:
self.seperatorCount += 1
else:
self.seperatorOn = 1
self.gapOn = 1
bagId = self.subBagTypeToBagId[skillId]
cellPos = self.findGridPos(X, Z)
bagCell = self.makeCell(self.cellImage)
bagCell.setPos(cellPos)
bagItem = self.makeAmmoBagItem(skillId, bagId)
self.putIntoCell(bagItem, bagCell)
self.subBagTypesCreated.append(skillId)
bagCell['image'] = None
continue
if skillId in self.subBagTypesCreated:
continue
cellPos = self.findGridPos(X, Z, self.gapOn)
ammoCell = self.getCell()
ammoCell.setPos(cellPos)
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
newItem = self.getItem(skillId, ammoId)
if newItem:
if self.textOffset != None:
newItem.textOffset = self.textOffset
self.putIntoCell(newItem, ammoCell)
ammoCell['image_color'] = (1.0, 1.0, 1.0, 1.0)
else:
ammoCell['image_color'] = (0.5, 0.5, 0.5, 1.0)
self.makeCellBacking(cellPos)
for i in self.cellList:
n = NodePath(i.node().getStateDef(0)).getChild(0)
if i.getNumChildren() > 1:
n2 = NodePath(i.getChild(1).node().getStateDef(0)).getChild(0)
newGeomC = n2.copyTo(self.gridBackground)
newGeomC.setPos(i.getPos())
n2.hide()
NodePath(i.node().getStateDef(2)).hide()
n.hide()
self.gridBackground.flattenStrong()
示例6: isSkillValid
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def isSkillValid(self, skillId):
ammoId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoName = PLocalizer.InventoryTypeNames.get(ammoId)
ammoDescription = PLocalizer.WeaponDescriptions.get(ammoId)
ammoIconName = WeaponGlobals.getSkillIcon(skillId)
ammoIcon = self.SkillIcons.find("**/%s" % ammoIconName)
skillRepId = WeaponGlobals.getSkillReputationCategoryId(skillId)
stackLimit = localAvatar.getInventory().getStackLimit(ammoId)
if ammoName and ammoDescription and ammoIcon and stackLimit:
return 1
else:
return 0
示例7: makeStackItem
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def makeStackItem(self, itemTuple, showMax = 1):
itemCategory = itemTuple[0]
itemId = itemTuple[1]
if itemCategory == InventoryType.ItemTypeMoney:
item = self.makeGoldItem(itemTuple)
elif itemCategory == InventoryType.TreasureCollection:
item = self.makeTreasureItem(itemTuple)
elif itemCategory == InventoryCategory.CARDS:
cardId = itemId
itemTuple[1] -= InventoryType.begin_Cards
item = self.makeCardItem(cardId, itemTuple, imageScaleFactor = 1.8999999999999999)
elif itemCategory == InventoryCategory.WEAPON_PISTOL_AMMO:
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
item = self.makeAmmoItem(itemId, itemTuple, showMax = 0)
else:
item = InventoryUIStackItem.InventoryUIStackItem(self, itemTuple, showMax = showMax)
InventoryUIManager.testItemCount += 1
return item
示例8: setupItems
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def setupItems(self, itemList):
for itemId in itemList:
itemClass = ItemGlobals.getClass(itemId)
itemType = EconomyGlobals.getItemType(itemId)
itemTuple = [
itemClass,
itemId,
0,
0]
item = None
if itemClass == InventoryType.ItemTypeWeapon:
item = self.manager.makeWeaponItem(itemTuple)
elif itemClass == InventoryType.ItemTypeCharm:
item = self.manager.makeCharmItem(itemTuple)
elif itemClass == InventoryType.ItemTypeConsumable:
itemTuple[3] = 1
item = self.manager.makeConsumableItem(itemTuple, showMax = 0)
elif itemClass == InventoryType.ItemTypeClothing:
item = self.manager.makeClothingItem(itemTuple)
elif itemClass == InventoryType.ItemTypeMoney:
item = self.manager.makeGoldItem(itemTuple)
elif itemClass == InventoryType.TreasureCollection:
item = self.manager.makeTreasureItem(itemTuple)
elif itemClass == InventoryType.ItemTypeJewelry:
item = self.manager.makeJewelryItem(itemTuple)
elif itemClass == InventoryType.ItemTypeTattoo:
item = self.manager.makeTattooItem(itemTuple)
elif itemClass == InventoryCategory.CARDS:
cardId = itemId
itemTuple[1] -= InventoryType.begin_Cards
item = self.manager.makeCardItem(cardId, itemTuple, imageScaleFactor = 1.8999999999999999)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
item = self.manager.makeAmmoItem(itemId, itemTuple, showMax = 0)
elif itemType in [
EconomyGlobals.ItemType.DAGGERAMMO,
EconomyGlobals.ItemType.PISTOLAMMO,
EconomyGlobals.ItemType.GRENADEAMMO,
EconomyGlobals.ItemType.CANNONAMMO]:
itemTuple = [
0,
itemId,
0,
EconomyGlobals.getItemQuantity(itemId)]
skillId = WeaponGlobals.getSkillIdForAmmoSkillId(itemId)
item = self.manager.makeAmmoItem(skillId, itemTuple, showMax = 0)
elif itemType in [
EconomyGlobals.ItemType.PISTOL_POUCH,
EconomyGlobals.ItemType.DAGGER_POUCH,
EconomyGlobals.ItemType.GRENADE_POUCH,
EconomyGlobals.ItemType.CANNON_POUCH,
EconomyGlobals.ItemType.FISHING_POUCH]:
item = self.manager.makePouchItem(itemTuple)
elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
itemTuple[1] = WeaponGlobals.getSkillAmmoInventoryId(itemId)
itemTuple[3] = EconomyGlobals.getItemQuantity(itemId)
item = self.manager.makeFishingItem(itemId, itemTuple, showMax = 0)
if itemClass in (InventoryType.ItemTypeMoney, InventoryCategory.CARDS, InventoryType.TreasureCollection):
self.addGridCell(self.stackImage, 1.0)
elif itemClass == InventoryCategory.WEAPON_PISTOL_AMMO:
self.addGridCell(self.stackImage2, 1.0)
elif itemType in (EconomyGlobals.ItemType.FISHING_LURE,):
self.addGridCell(self.stackImage, 1.0)
else:
self.addGridCell()
if item:
self.tryPutIntoFirstOpenCell(item)
item.showResaleValue = False
if self.zCount == self.gridZ:
break
while self.zCount < self.gridZ:
self.addGridCell()
示例9: updateSkillTrayStates
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def updateSkillTrayStates(self):
if not self.traySkillMap:
return None
if not hasattr(base, 'localAvatar'):
return None
inv = localAvatar.getInventory()
if not inv:
return None
self.numberOfItems = len(self.traySkillMap)
for i in range(self.numberOfItems):
skillId = self.traySkillMap[i]
greyOut = 0
if self.tray[i + 1].greyOut == -1:
continue
if self.tray[i + 1].showQuantity:
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
quantity = WeaponGlobals.INF_QUANT
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
quantity = inv.getStackQuantity(ammoInvId)
if quantity == 0:
greyOut = 1
if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
greyOut = 1
if localAvatar.ship:
if (skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight) and not (localAvatar.ship.broadside):
greyOut = 1
elif localAvatar.guiMgr.combatTray.skillDisabled(skillId):
greyOut = 1
rep = WeaponGlobals.getSkillReputationCategoryId(skillId)
if rep == InventoryType.DollRep:
haveFriendly = localAvatar.getFriendlyStickyTargets()
haveHostile = localAvatar.getHostileStickyTargets()
if haveFriendly and not haveHostile:
if not WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
elif not haveFriendly and haveHostile:
if WeaponGlobals.isFriendlyFire(skillId):
greyOut = 1
if self.tray[i + 1].greyOut != greyOut:
if hasattr(self.tray[i + 1], 'skillButton'):
self.tray[i + 1].greyOut = greyOut
if greyOut == 1:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.tray[i + 1].skillRing.meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
elif greyOut == 2:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
elif greyOut == 3:
self.tray[i + 1].setGeomColor(0.5, 0.5, 0.5, 1.0)
else:
self.tray[i + 1].setGeomColor(1, 1, 1, 1)
if self.tray[i + 1].showRing:
self.tray[i + 1].skillRing.meterFaceHalf1.clearColorScale()
self.tray[i + 1].skillRing.meterFaceHalf2.clearColorScale()
if self.isPowerRecharged:
self.continuePowerRechargeEffect()
continue
示例10: updateSkillTray
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
#.........这里部分代码省略.........
else:
image = self.SkillIcons.find('**/base')
button = DirectButton(parent = self.skillTray, relief = None, state = DGG.DISABLED, image = image, image_pos = (0.0, 0.0, 0.059999999999999998), image_scale = 0.12, image_color = (0.20000000000000001, 0.20000000000000001, 0.20000000000000001, 0.55000000000000004), sortOrder = 100, pos = (x, 0, -0.0))
button.setTransparency(1)
button.showQuantity = False
button.greyOut = -1
button.showRing = False
button.skillStatus = False
if locked:
lock = DirectFrame(parent = button, relief = None, image = self.lockArt, image_scale = 0.14000000000000001, image_pos = (0.050000000000000003, 0, 0.035000000000000003))
button['state'] = DGG.NORMAL
button['command'] = base.localAvatar.guiMgr.showNonPayer
button['extraArgs'] = [
'Restricted_Radial_Menu',
5]
self.tray[i + 1] = button
x = x + 0.14999999999999999
if i < self.numberOfItems - 1:
offset = offset + 0.01
self.skillTray.setX(self.skillTray.getX() - 0.074999999999999997)
i < self.numberOfItems - 1
if self.origMap[i][1] == True:
skillId = self.traySkillMap[i]
if linkedSkillIds.has_key(skillId):
skillId = linkedSkillIds[skillId]
name = PLocalizer.InventoryTypeNames[skillId]
hotkey = str(i + 1)
totalRechargeTime = base.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
timeSpentRecharging = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
if not timeSpentRecharging:
timeSpentRecharging = 0
if weaponMode not in (WeaponGlobals.CANNON, WeaponGlobals.FIREARM, WeaponGlobals.GRENADE, WeaponGlobals.STAFF, WeaponGlobals.DEFENSE_CANNON) and skillId in WeaponGlobals.SpecialSkills or WeaponGlobals.getSkillReputationCategoryId(skillId) not in (InventoryType.PistolRep, InventoryType.WandRep, InventoryType.CannonRep, InventoryType.GrenadeRep, InventoryType.DefenseCannonRep):
showRing = True
else:
showRing = False
locked = self.origMap[i][2]
if weaponMode == WeaponGlobals.DEFENSE_CANNON:
button = AmmoSkillButton(skillId, i, self.callback, 99, 0, showQuantity = True, showHelp = False, showRing = showRing, hotkey = hotkey, name = name, showLock = locked)
else:
button = SkillButton(skillId, self.callback, 0, 0, showQuantity = False, showHelp = False, showRing = showRing, hotkey = hotkey, name = name, showLock = locked)
button.skillStatus = True
if locked:
button.skillButton['command'] = base.localAvatar.guiMgr.showNonPayer
button.skillButton['extraArgs'] = [
'Restricted_Radial_Menu',
5]
if showRing:
button.skillRing.meterFaceHalf1.setScale(0.95999999999999996)
button.skillRing.meterFaceHalf2.setScale(0.95999999999999996)
button.reparentTo(self.skillTray)
button.setPos(x, 0, 0.070000000000000007)
self.tray[i + 1] = button
if weaponMode in (WeaponGlobals.CANNON, WeaponGlobals.FIREARM, WeaponGlobals.GRENADE, WeaponGlobals.STAFF):
lastAmmo = localAvatar.guiMgr.combatTray.lastAmmoSkillId.get(localAvatar.currentWeaponId)
if lastAmmo is not None:
if lastAmmo == skillId:
button.toggleButton(True)
elif self.tray[1].skillStatus is True:
self.tray[1].toggleButton(True)
if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
inv = localAvatar.getInventory()
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
ammoAmt = WeaponGlobals.INF_QUANT
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoAmt = inv.getStackQuantity(ammoInvId)
ammoMax = inv.getStackLimit(ammoInvId)
button.showQuantity = True
button.updateQuantity(ammoAmt)
x = x + 0.17000000000000001
if i < self.numberOfItems - 1:
if weaponMode == WeaponGlobals.DEFENSE_CANNON:
self.skillTray.setX(self.skillTray.getX() - 0.072499999999999995)
else:
self.skillTray.setX(self.skillTray.getX() - 0.085000000000000006)
i < self.numberOfItems - 1
currentX = self.skillTray.getX()
self.skillTray.setX(currentX + float(offset))
if self.repMeter:
self.repMeter.setPos(-currentX, 0.0, -0.11)
self.updateSkillTrayStates()
if weaponMode == WeaponGlobals.DEFENSE_CANNON:
self.setMoveUpValue(0.34499999999999997)
else:
self.resetMoveUpVale()
self.showSkillTray()
示例11: radialMenuHeartBeat
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def radialMenuHeartBeat(self, task):
if base.mouseWatcherNode.hasMouse():
mouseData = base.win.getPointer(0)
curX = mouseData.getX()
curY = mouseData.getY()
else:
curX = 0
curY = 0
hLItem = RingMatch(self.numberOfItems, curX - self.mouseBasePosX, curY - self.mouseBasePosY)
if hLItem != self.hiLiteItem:
if hLItem < 1:
self.radialHelp.hide()
else:
self.radialHelp['text'] = PLocalizer.InventoryTypeNames[self.radialSkillMap[hLItem - 1]]
basePos = self.radial[hLItem].getPos()
self.radialHelp.setPos(basePos[0] + 0.059999999999999998, basePos[1], basePos[2] - 0.040000000000000001)
self.radialHelp.show()
if self.hiLiteItem != -1:
self.rframe[self.hiLiteItem].rollover(False)
self.hiLiteItem = hLItem
if self.hiLiteItem > 0:
self.rframe[self.hiLiteItem].rollover(True)
count = 0
for skillId in self.radialSkillMap:
greyOut = 0
count += 1
if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
inv = localAvatar.getInventory()
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
greyOut = 0
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoAmt = inv.getStackQuantity(ammoInvId)
if ammoAmt <= 0:
greyOut = 1
if localAvatar.mojo < -1 * WeaponGlobals.getMojoCost(skillId):
greyOut = 1
if skillId == InventoryType.SailBroadsideLeft or skillId == InventoryType.SailBroadsideRight:
if not localAvatar.ship.broadside:
greyOut = 1
range = localAvatar.cr.battleMgr.getModifiedRechargeTime(localAvatar, skillId)
value = localAvatar.skillDiary.getTimeSpentRecharging(skillId)
if not value:
value = range
elif value >= range:
if self.rstatus[count] == 3:
startScale = self.rframe[count].getScale()
startColor = Vec4(1, 1, 1, 1)
glowColor = Vec4(0.0, 0.75, 0.0, 1.0)
buttomFrame = self.rframe[count]
self.rframe[count].update(value, range)
if value < range:
greyOut = 3
if self.rep == InventoryType.DollRep:
haveFriendly = localAvatar.getFriendlyStickyTargets()
haveHostile = localAvatar.getHostileStickyTargets()
if haveFriendly and not haveHostile:
if not WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
greyOut = 1
elif not haveFriendly and haveHostile:
if WeaponGlobals.isFriendlyFire(self.radialSkillMap[count - 1]):
greyOut = 1
if self.rstatus[count] != greyOut:
self.rstatus[count] = greyOut
if greyOut == 2:
self.radial[count].setColorScale(0.69999999999999996, 0.69999999999999996, 0.69999999999999996, 1.0)
elif greyOut == 1:
self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.rframe[count].meterFaceHalf1.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
self.rframe[count].meterFaceHalf2.setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
elif greyOut == 3:
self.radial[count].setColorScale(0.40000000000000002, 0.40000000000000002, 0.40000000000000002, 1.0)
else:
self.radial[count].setColorScale(1, 1, 1, 1)
self.radial[count].setAlphaScale(1)
self.rframe[count].meterFaceHalf1.setColorScale(1, 1, 1, 1.0)
self.rframe[count].meterFaceHalf2.setColorScale(1, 1, 1, 1.0)
greyOut == 2
return Task.cont
示例12: __init__
# 需要导入模块: from pirates.battle import WeaponGlobals [as 别名]
# 或者: from pirates.battle.WeaponGlobals import getSkillAmmoInventoryId [as 别名]
def __init__(self, rep, weaponMode):
self.rep = rep
self.weaponMode = weaponMode
localAvatar.cr.targetMgr.reticle.hide()
if self.weaponMode in (WeaponGlobals.MELEE, WeaponGlobals.COMBAT, WeaponGlobals.THROWING):
target = base.cr.targetMgr.takeAim(localAvatar)
if target:
localAvatar.guiMgr.combatTray.beginAimAssist(target)
base.win.movePointer(0, base.win.getXSize() / 2, base.win.getYSize() / 2)
localAvatar.guiMgr.setSeaChestAllowed(False)
self.radial = { }
self.rframe = { }
self.ammoAmt = { }
self.rstatus = { }
self.rstatus[0] = 0
self.rframe[0] = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
skillRing = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
skillRing.reparentTo(aspect2d)
skillRing.setPos(0.01, 0, 0.01)
if not self.SkillIcons:
self.SkillIcons = loader.loadModel('models/textureCards/skillIcons')
icons = loader.loadModel('models/gui/gui_icons_weapon')
icons.reparentTo(self.SkillIcons)
if self.rep == InventoryType.DollRep and localAvatar.hasStickyTargets():
asset = getSkillIconName(self.rep, 1)
else:
asset = getSkillIconName(self.rep, 0)
self.radial[0] = DirectFrame(parent = aspect2d, relief = None, image = self.SkillIcons.find('**/%s' % asset), image_scale = ImageScale(self.rep), image_pos = (0.059999999999999998, 0, 0.059999999999999998), pos = (-0.050000000000000003, 0, -0.050000000000000003), sortOrder = 10)
self.radial[0].setTransparency(1)
origMap = ActiveSkills(self.rep, 2)
self.radialSkillMap = Freebooter.pruneFreebooterSkills(origMap)
self.numberOfItems = len(self.radialSkillMap)
for i in range(self.numberOfItems):
(x, y) = InnerRingOffset(i + 1)
self.rstatus[i + 1] = 0
self.rframe[i + 1] = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
skillRing = SkillRing(Vec4(1, 0.80000000000000004, 0.5, 1), Vec4(0, 0, 0, 1.0))
skillRing.reparentTo(aspect2d)
skillRing.setPos(0.01 + x, 0, 0.01 + y)
asset = getSkillIconName(self.radialSkillMap[i], 0)
self.radial[i + 1] = DirectFrame(parent = aspect2d, relief = None, image = self.SkillIcons.find('**/%s' % asset), image_pos = (0.059999999999999998, 0, 0.059999999999999998), image_scale = ImageScale(self.rep), sortOrder = 100, pos = (-0.050000000000000003 + x, 0, -0.050000000000000003 + y))
self.radial[i + 1].setTransparency(1)
if self.weaponMode in (WeaponGlobals.FIREARM, WeaponGlobals.THROWING, WeaponGlobals.CANNON, WeaponGlobals.GRENADE):
inv = localAvatar.getInventory()
skillId = self.radialSkillMap[i]
maxQuant = WeaponGlobals.getSkillMaxQuantity(skillId)
if maxQuant == WeaponGlobals.INF_QUANT and WeaponGlobals.canUseInfiniteAmmo(localAvatar.currentWeaponId, skillId) or WeaponGlobals.canUseInfiniteAmmo(localAvatar.getCurrentCharm(), skillId):
amtstr = '++'
else:
ammoInvId = WeaponGlobals.getSkillAmmoInventoryId(skillId)
ammoAmt = inv.getStackQuantity(ammoInvId)
ammoMax = inv.getStackLimit(ammoInvId)
amtstr = '%d' % ammoAmt
self.ammoAmt[i + 1] = DirectLabel(parent = aspect2d, relief = None, text = amtstr, text_align = TextNode.ACenter, text_scale = 0.029999999999999999, text_fg = (0.69999999999999996, 1.0, 1.0, 1), text_font = PiratesGlobals.getPirateBoldOutlineFont(), pos = (x + 0.059999999999999998, 0, y + 0.040000000000000001), textMayChange = 1)
continue
self.mouseBasePosX = base.win.getXSize() / 2
self.mouseBasePosY = base.win.getYSize() / 2
self.radialHelp = DirectLabel(parent = aspect2d, relief = None, text = '', text_align = TextNode.ACenter, text_scale = 0.040000000000000001, text_fg = (0.94999999999999996, 1.0, 1.0, 1), text_shadow = PiratesGuiGlobals.TextShadow, pos = (0, 0, 0), textMayChange = 1)
self.radialHelp.hide()
self.radial[0].show()
self.rframe[0].show()
self.hiLiteItem = 0
taskMgr.add(self.radialMenuHeartBeat, 'radialMenuHeartBeat', priority = 40)
messenger.send('openedSpecialMenu')