本文整理匯總了Python中gui.shared.gui_items.Tankman.getRoleUserName方法的典型用法代碼示例。如果您正苦於以下問題:Python Tankman.getRoleUserName方法的具體用法?Python Tankman.getRoleUserName怎麽用?Python Tankman.getRoleUserName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gui.shared.gui_items.Tankman
的用法示例。
在下文中一共展示了Tankman.getRoleUserName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _successHandler
# 需要導入模塊: from gui.shared.gui_items import Tankman [as 別名]
# 或者: from gui.shared.gui_items.Tankman import getRoleUserName [as 別名]
def _successHandler(self, code, ctx = None):
msgType = SM_TYPE.FinancialTransactionWithGold
vehicle = g_itemsCache.items.getItemByCD(self.__vehTypeCompDescr)
if ctx == EQUIP_TMAN_CODE.OK:
auxData = makeI18nSuccess('change_tankman_role/installed', vehicle=vehicle.shortUserName)
elif ctx == EQUIP_TMAN_CODE.NO_FREE_SLOT:
roleStr = Tankman.getRoleUserName(SKILL_NAMES[self.__roleIdx])
auxData = makeI18nSuccess('change_tankman_role/slot_is_taken', vehicle=vehicle.shortUserName, role=roleStr)
else:
auxData = makeI18nSuccess('change_tankman_role/no_vehicle')
return makeI18nSuccess('change_tankman_role/success', money=formatPrice((0, self.__changeRoleCost)), type=msgType, auxData=auxData)
示例2: onVehicleSelected
# 需要導入模塊: from gui.shared.gui_items import Tankman [as 別名]
# 或者: from gui.shared.gui_items.Tankman import getRoleUserName [as 別名]
def onVehicleSelected(self, vehTypeCompDescr):
self.__selectedVehicleCD = int(vehTypeCompDescr)
selectedVehicle = self.__items.getItemByCD(self.__selectedVehicleCD)
data = []
for role in selectedVehicle.descriptor.type.crewRoles:
mainRole = role[0]
criteria = REQ_CRITERIA.TANKMAN.NATIVE_TANKS([self.__selectedVehicleCD]) | REQ_CRITERIA.TANKMAN.ROLES([mainRole])
roleTankmen = self.__items.getTankmen(criteria).values()
sameTankmen = len(roleTankmen)
roleSlotIsTaken = _isRoleSlotTaken(roleTankmen, selectedVehicle, mainRole)
roleStr = Tankman.getRoleUserName(mainRole)
isAvailable = self.__tankman.descriptor.role != mainRole
data.append({'id': mainRole,
'name': roleStr,
'icon': Tankman.getRoleMediumIconPath(mainRole),
'available': isAvailable,
'warningHeader': _getTooltipHeader(sameTankmen, isAvailable),
'warningBody': _getTooltipBody(sameTankmen, isAvailable, roleSlotIsTaken, roleStr, selectedVehicle)})
self.as_setRolesS(data)