本文整理汇总了Python中pirates.economy.EconomyGlobals.getCargoCategory方法的典型用法代码示例。如果您正苦于以下问题:Python EconomyGlobals.getCargoCategory方法的具体用法?Python EconomyGlobals.getCargoCategory怎么用?Python EconomyGlobals.getCargoCategory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pirates.economy.EconomyGlobals
的用法示例。
在下文中一共展示了EconomyGlobals.getCargoCategory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _createIface
# 需要导入模块: from pirates.economy import EconomyGlobals [as 别名]
# 或者: from pirates.economy.EconomyGlobals import getCargoCategory [as 别名]
def _createIface(self):
self.descText = DirectLabel(parent = self, relief = None, text = self.item.get('Text'), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.02, 0, self.height / 2), text_font = PiratesGlobals.getInterfaceOutlineFont())
self.valueText = DirectLabel(parent = self, relief = None, text = str(self.item.get('Value1')), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (self.width * 0.65000000000000002, 0, self.height / 2), text_font = PiratesGlobals.getInterfaceOutlineFont())
if self.item.get('Type') == 'Title':
self.descText['text_scale'] = 0.055
self.descText['text_fg'] = PiratesGuiGlobals.TextFG1
self.descText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.valueText['text_scale'] = 0.044999999999999998
self.valueText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
if self.item.has_key('Value2'):
self.valueText2 = DirectLabel(parent = self, relief = None, text = str(self.item.get('Value2')), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (self.width * 0.80000000000000004, 0, self.height / 2), text_font = PiratesGlobals.getInterfaceOutlineFont())
if self.valueText2:
self.valueText2['text_scale'] = 0.044999999999999998
self.valueText2['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
elif self.item.get('Type') == 'Entry':
self.descText['text_pos'] = (self.width * 0.059999999999999998, 0, 0)
if self.item.has_key('Value2'):
self.valueText2 = DirectLabel(parent = self, relief = None, text = str(self.item.get('Value2')), text_align = TextNode.ALeft, text_scale = 0.050000000000000003, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (self.width * 0.80000000000000004, 0, self.height / 2), text_font = PiratesGlobals.getInterfaceOutlineFont())
elif self.item.get('Type') == 'Space':
self.descText['text_scale'] = 0.02
self.descText['text'] = ' '
self.valueText['text_scale'] = 0.02
self.valueText['text'] = ' '
elif self.item.get('Type') == 'Button':
self.descText['text_pos'] = (self.width * 0.059999999999999998, 0, 0)
self.valueText['text'] = ' '
self.button = DirectButton(parent = self, relief = DGG.RIDGE, text = self.item.get('Text'), text_align = TextNode.ALeft, text_scale = PiratesGuiGlobals.TextScaleLarge, text_fg = PiratesGuiGlobals.TextFG1, text_shadow = PiratesGuiGlobals.TextShadow, frameColor = PiratesGuiGlobals.ButtonColor1, command = self.item.get('Value2'), pos = (self.width * 0.65000000000000002, 0, self.height / 2), borderWidth = (0.01, 0.01), pad = (0.0050000000000000001, 0.0050000000000000001), textMayChange = 1)
if self.item.get('State') == 'off':
self.button['state'] = DGG.DISABLED
self.button['text_fg'] = PiratesGuiGlobals.TextFG3
elif self.item.get('State') == 'oneShot':
self.button.bind(DGG.B1RELEASE, self.disableButton)
elif self.item.get('Type') == 'Cargo':
itemId = self.item.get('Value1')
iconId = EconomyGlobals.getCargoCategory(itemId)
if not iconId:
self.notify.error('Invalid Item in Cargo! item: %s' % (self.item,))
icon = self.icons.get(iconId)
self.descText['geom'] = self.getCargoIcon(icon[0])
self.descText['geom_scale'] = 0.089999999999999997 * self.height * 10
self.descText['geom_pos'] = (0.050000000000000003, 0, 0.01)
self.descText['text_pos'] = (0.23999999999999999, 0, 0)
self.descText['text'] = icon[1]
self.descText['text_fg'] = PiratesGuiGlobals.TextFG2
self.descText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.descText['text_scale'] = 0.050000000000000003 * self.height * 10
self.descText.setTransparency(1)
self.valueText['text'] = PLocalizer.UnknownGoldValue
self.valueText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.valueText['text_scale'] = 0.050000000000000003 * self.height * 10
icon = self.icons.get(ItemId.CARGO_CRATE)
self.descText2 = DirectLabel(parent = self, relief = None, text = '?', text_align = TextNode.ACenter, text_scale = 0.050000000000000003 * self.height * 10, text_fg = PiratesGuiGlobals.TextFG2, text_shadow = PiratesGuiGlobals.TextShadow, textMayChange = 1, pos = (0.080000000000000002, 0, self.height / 2), geom = self.getCargoIcon(icon[0]), geom_scale = 0.089999999999999997 * self.height * 10, geom_pos = (0.10000000000000001, 0, 0.01), text_pos = (0.10000000000000001, 0, 0), geom_color = Vec4(0, 0, 0, 1), text_font = PiratesGlobals.getInterfaceOutlineFont())
elif self.item.get('Type') == 'Gold':
amount = self.item.get('Value2')
itemName = PLocalizer.LootGold % amount
self.descText['geom'] = self.getGoldIcon()
self.descText['geom_scale'] = 0.14999999999999999 * self.height * 10
self.descText['geom_pos'] = (0.050000000000000003, 0, 0.01)
self.descText['text_pos'] = (0.23999999999999999, 0, 0)
self.descText['text'] = itemName
self.descText['text_fg'] = PiratesGuiGlobals.TextFG2
self.descText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.descText['text_scale'] = 0.050000000000000003 * self.height * 10
self.descText.setTransparency(1)
self.valueText['text'] = ' '
elif self.item.get('Type') == 'Weapon':
itemId = self.item.get('Value1')
itemName = PLocalizer.InventoryTypeNames.get(itemId)
iconName = EconomyGlobals.getItemIcons(itemId)
self.descText['geom'] = self.getWeaponIcon(iconName)
self.descText['geom_scale'] = 0.089999999999999997 * self.height * 10
self.descText['geom_pos'] = (0.050000000000000003, 0, 0.01)
self.descText['text_pos'] = (0.23999999999999999, 0, 0)
self.descText['text'] = itemName
self.descText['text_fg'] = PiratesGuiGlobals.TextFG2
self.descText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.descText['text_scale'] = 0.050000000000000003 * self.height * 10
self.descText.setTransparency(1)
self.valueText['text'] = ' '
elif self.item.get('Type') == 'Ammo':
itemId = self.item.get('Value1')
amount = self.item.get('Value2')
itemName = '%s %s' % (amount, PLocalizer.InventoryTypeNames.get(itemId))
iconName = WeaponGlobals.getSkillIcon(itemId)
self.descText['geom'] = self.getAmmoIcon(iconName)
self.descText['geom_scale'] = 0.089999999999999997 * self.height * 10
self.descText['geom_pos'] = (0.050000000000000003, 0, 0.01)
self.descText['text_pos'] = (0.23999999999999999, 0, 0)
self.descText['text'] = itemName
self.descText['text_fg'] = PiratesGuiGlobals.TextFG2
self.descText['text_font'] = PiratesGlobals.getInterfaceOutlineFont()
self.descText['text_scale'] = 0.050000000000000003 * self.height * 10
self.descText.setTransparency(1)
self.valueText['text'] = ' '