• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python storage.storage_getter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中messenger.storage.storage_getter函数的典型用法代码示例。如果您正苦于以下问题:Python storage_getter函数的具体用法?Python storage_getter怎么用?Python storage_getter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了storage_getter函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: __updateUsersData

    def __updateUsersData(self, userDBIDs):
        diff = []
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        for userDBID in userDBIDs:
            data = findFirst(lambda d: d['creator'].get('dbID') == userDBID, self.collection)
            if data is not None:
                clubDBID = data['cfdUnitID']
                try:
                    index = self.mapping[clubDBID]
                    item = self.collection[index]
                except (KeyError, IndexError):
                    LOG_ERROR('Item not found', clubDBID)
                    continue

                creator = userGetter(userDBID)
                creatorVO = makeUserVO(creator, colorGetter)
                creatorName = creator.getName()
                item.update({'creatorName': creatorName,
                 'rating': self.getGuiUserRating(userDBID)})
                if creator.hasValidName():
                    item['creator'] = creatorVO
                diff.append(index)

        if len(diff):
            self.updateItems(diff)
        return
开发者ID:webiumsk,项目名称:WOT-0.9.15-CT,代码行数:27,代码来源:rally_dps.py


示例2: buildList

    def buildList(self, selectedID, result):
        self.clear()
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        pNameGetter = g_lobbyContext.getPeripheryName
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        for unitItem in result:
            creator = unitItem.creator
            if creator:
                dbID = creator.dbID
                creatorVO = makePlayerVO(creator, userGetter(dbID), colorGetter)
            else:
                creatorVO = None
            cfdUnitID = unitItem.cfdUnitID
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            self.collection.append({'cfdUnitID': cfdUnitID,
             'unitMgrID': unitItem.unitMgrID,
             'creator': creatorVO,
             'creatorName': creatorVO.get('userName', ''),
             'rating': ratingFormatter(unitItem.rating),
             'playersCount': unitItem.playersCount,
             'commandSize': unitItem.commandSize,
             'inBattle': unitItem.state.isInArena(),
             'isFreezed': unitItem.state.isLocked(),
             'isRestricted': unitItem.isRosterSet,
             'description': unitItem.description,
             'peripheryID': unitItem.peripheryID,
             'server': pNameGetter(unitItem.peripheryID)})

        return self._selectedIdx
开发者ID:Infernux,项目名称:Projects,代码行数:34,代码来源:rally_dps.py


示例3: _getSlotsData

def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    if app:
        isPlayerSpeaking = app.voiceChatManager.isPlayerSpeaking
    else:
        isPlayerSpeaking = lambda dbID: False
    if unitState.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unitState.isSortie():
        makeVO = makeSortiePlayerVO
    else:
        makeVO = makePlayerVO
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            if vehicle:
                if 'vehLevel' in vehicle:
                    slotLevel = vehicle['vehLevel']
                if 'vehTypeCompDescr' in vehicle:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle['vehTypeCompDescr']), levelsRange)
        slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles)
        playerStatus = getPlayerStatus(slotState, player, unitState.isFortBattle())
        if unit is not None:
            restrictions = makeUnitRosterVO(unit, pInfo, index=index, isSortie=unitState.isSortie(), levelsRange=levelsRange)['conditions']
        else:
            restrictions = []
        isFreezed = unitState.isLocked() or unitState.isInSearch() or unitState.isInQueue() or unitState.isInArena()
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': isFreezed,
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions}
        slots.append(slot)

    return slots
开发者ID:webiumsk,项目名称:WoT,代码行数:58,代码来源:vo_converters.py


示例4: updateList

    def updateList(self, selectedID, result):
        isFullUpdate, diff = False, []
        self._selectedIdx = None
        userGetter = storage_getter("users")().getUser
        colorGetter = g_settings.getColorScheme("rosters").getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        result = set(result)
        removed = set(filter(lambda item: item[1] is None, result))
        isFullUpdate = len(removed)
        for cfdUnitID, unitItem in removed:
            index = self.mapping.pop(cfdUnitID, None)
            if index is not None:
                self.collection.pop(index)
                if cfdUnitID == selectedID:
                    self._selectedIdx = -1
                self.rebuildIndexes()

        if isFullUpdate:
            updated = result.difference(removed)
        else:
            updated = result
        for cfdUnitID, unitItem in updated:
            try:
                index = self.mapping[cfdUnitID]
                item = self.collection[index]
            except (KeyError, IndexError):
                LOG_ERROR("Item not found", unitItem)
                continue

            creator = unitItem.creator
            if creator:
                dbID = creator.dbID
                creatorVO = makePlayerVO(creator, userGetter(dbID), colorGetter)
            else:
                creatorVO = None
            item.update(
                {
                    "creator": creatorVO,
                    "creatorName": creatorVO.get("userName", ""),
                    "rating": ratingFormatter(unitItem.rating),
                    "playersCount": unitItem.playersCount,
                    "commandSize": unitItem.commandSize,
                    "inBattle": unitItem.flags.isInArena() or unitItem.flags.isInPreArena(),
                    "isFreezed": unitItem.flags.isLocked(),
                    "isRestricted": unitItem.isRosterSet,
                    "description": unitItem.description,
                }
            )
            diff.append(index)

        if self._selectedIdx is None and selectedID in self.mapping:
            self._selectedIdx = self.mapping[selectedID]
        if isFullUpdate:
            self.refresh()
        elif len(diff):
            self.updateItems(diff)
        return self._selectedIdx
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:57,代码来源:rally_dps.py


示例5: _buildData

 def _buildData(self, candidates):
     isPlayerSpeaking = self.bwProto.voipController.isPlayerSpeaking
     userGetter = storage_getter('users')().getUser
     colorGetter = g_settings.getColorScheme('rosters').getColors
     mapping = map(lambda pInfo: (pInfo, userGetter(pInfo.dbID)), candidates.itervalues())
     sortedList = sorted(mapping, cmp=getUnitCandidatesComparator())
     for pInfo, user in sortedList:
         dbID = pInfo.dbID
         self._mapping[dbID] = len(self._list)
         self._list.append(self._makePlayerVO(pInfo, user, colorGetter, isPlayerSpeaking(dbID)))
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:10,代码来源:rally_dps.py


示例6: updateListItem

 def updateListItem(self, userDBID):
     for item in self.collection:
         creator = item.get('creator', None)
         if creator is None:
             return 
         creatorDBID = creator.get('dbID', None)
         if userDBID == creatorDBID:
             userGetter = storage_getter('users')().getUser
             colorGetter = g_settings.getColorScheme('rosters').getColors
             colors = colorGetter(userGetter(creatorDBID).getGuiType())
             creator['colors'] = colors
             self.refresh()
             return 
开发者ID:Infernux,项目名称:Projects,代码行数:13,代码来源:rally_dps.py


示例7: _buildData

 def _buildData(self, candidates):
     if self.app is not None:
         isPlayerSpeaking = self.app.voiceChatManager.isPlayerSpeaking
     else:
         isPlayerSpeaking = lambda dbID: False
     userGetter = storage_getter('users')().getUser
     colorGetter = g_settings.getColorScheme('rosters').getColors
     mapping = map(lambda pInfo: (pInfo, userGetter(pInfo.dbID)), candidates.itervalues())
     sortedList = sorted(mapping, cmp=getUnitCandidatesComparator())
     for (pInfo, user,) in sortedList:
         dbID = pInfo.dbID
         self._mapping[dbID] = len(self._list)
         self._list.append(self._makePlayerVO(pInfo, user, colorGetter, isPlayerSpeaking(dbID)))
开发者ID:Infernux,项目名称:Projects,代码行数:13,代码来源:rally_dps.py


示例8: updateList

    def updateList(self, selectedID, result):
        (isFullUpdate, diff,) = (False, [])
        self._selectedIdx = None
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        result = set(result)
        removed = set(filter(lambda item: item[1] is None, result))
        isFullUpdate = len(removed)
        for (cfdUnitID, unitItem,) in removed:
            index = self.mapping.pop(cfdUnitID, None)
            if index is not None:
                self.collection.pop(index)
                if cfdUnitID == selectedID:
                    self._selectedIdx = -1
                self.rebuildIndexes()

        if isFullUpdate:
            updated = result.difference(removed)
        else:
            updated = result
        for (cfdUnitID, unitItem,) in updated:
            try:
                index = self.mapping[cfdUnitID]
                item = self.collection[index]
            except (KeyError, IndexError):
                LOG_ERROR('Item not found', unitItem)
                continue
            creator = unitItem.creator
            if creator:
                dbID = creator.dbID
                creatorVO = makePlayerVO(creator, userGetter(dbID), colorGetter)
            else:
                creatorVO = None
            item.update({'creator': creatorVO,
             'rating': ratingFormatter(unitItem.rating),
             'playersCount': unitItem.playersCount,
             'commandSize': unitItem.commandSize,
             'inBattle': unitItem.state.isInArena(),
             'isFreezed': unitItem.state.isLocked(),
             'isRestricted': unitItem.isRosterSet,
             'description': unitItem.description})
            diff.append(index)

        if self._selectedIdx is None and selectedID in self.mapping:
            self._selectedIdx = self.mapping[selectedID]
        if isFullUpdate:
            self.refresh()
        elif len(diff):
            self.updateItems(diff)
        return self._selectedIdx
开发者ID:Infernux,项目名称:Projects,代码行数:51,代码来源:rally_dps.py


示例9: onUnitRosterChanged

 def onUnitRosterChanged(self):
     super(FortBattleRoomWindow, self).onUnitRosterChanged()
     chat = self.chat
     if chat:
         _, unit = self.unitFunctional.getUnit()
         commanderID = unit.getCommanderDBID()
         if commanderID != getPlayerDatabaseID():
             getter = storage_getter('users')
             commander = getter().getUser(commanderID)
             division = getDivisionNameByUnit(unit)
             divisionName = i18n.makeString(I18N_SYSTEM_MESSAGES.unit_notification_divisiontype(division))
             key = I18N_SYSTEM_MESSAGES.UNIT_NOTIFICATION_CHANGEDIVISION
             txt = i18n.makeString(key, name=commander.getName(), division=divisionName)
             chat.addNotification(txt)
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:14,代码来源:fortbattleroomwindow.py


示例10: updateListItem

    def updateListItem(self, userDBID):
        for item in self.collection:
            creator = item.get("creator", None)
            if creator is None:
                return
            creatorDBID = creator.get("dbID", None)
            if userDBID == creatorDBID:
                userGetter = storage_getter("users")().getUser
                colorGetter = g_settings.getColorScheme("rosters").getColors
                colors = colorGetter(userGetter(creatorDBID).getGuiType())
                creator["colors"] = colors
                self.refresh()
                return

        return
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:15,代码来源:rally_dps.py


示例11: buildList

    def buildList(self, selectedID, result, syncUserInfo=True):
        self.clear()
        userGetter = storage_getter("users")().getUser
        colorGetter = g_settings.getColorScheme("rosters").getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        self._lastResult = result
        data = []
        for clubItem in result:
            cfdUnitID = clubItem.getID()
            creatorID = clubItem.getCreatorID()
            rating = self.getUserRating(creatorID)
            creator = self._UserEntityAdapter(creatorID, clubItem, userGetter(creatorID), self)
            creatorName = creator.getName()
            creatorVO = makeUserVO(creator, colorGetter)
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            data.append(
                (
                    rating,
                    {
                        "cfdUnitID": cfdUnitID,
                        "unitMgrID": cfdUnitID,
                        "creator": creatorVO,
                        "creatorName": creatorName,
                        "rating": self.getGuiUserRating(creatorID),
                        "playersCount": clubItem.getMembersCount(),
                        "commandSize": clubItem.getCommandSize(),
                        "inBattle": False,
                        "isFreezed": False,
                        "isRestricted": False,
                        "description": html.escape(clubItem.getShortDescription()),
                        "peripheryID": -1,
                        "server": None,
                        "ladderIcon": getLadderChevron16x16(clubItem.getDivision()),
                        "isStatic": True,
                    },
                )
            )

        self.collection.extend(map(lambda (r, c): c, sorted(data, reverse=True, key=operator.itemgetter(0))))
        if syncUserInfo:
            self.syncUsersInfo()
        return self._selectedIdx
开发者ID:webiumsk,项目名称:WOT-0.9.12,代码行数:46,代码来源:rally_dps.py


示例12: __init__

 def __init__(self, accountsIDs, response, usersCache = None):
     if len(accountsIDs) > 1:
         errors = map(lambda (c, dbID): dbID, response.data.get('errors', []))
     else:
         errors = []
     self._successNames = []
     self._errorNames = []
     self._accountsIDs = accountsIDs
     if usersCache is None:
         usersGetter = storage_getter('users')()
     else:
         usersGetter = usersCache.get
     for dbID in accountsIDs:
         user = usersGetter(dbID)
         if not user:
             continue
         if dbID not in errors:
             self._successNames.append(user.getFullName(dbID))
         else:
             self._errorNames.append(user.getFullName(dbID))
开发者ID:kblw,项目名称:wot_client,代码行数:20,代码来源:formatters.py


示例13: buildList

    def buildList(self, selectedID, result, syncUserInfo = True):
        self.clear()
        userGetter = storage_getter('users')().getUser
        colorGetter = g_settings.getColorScheme('rosters').getColors
        ratingFormatter = BigWorld.wg_getIntegralFormat
        self._selectedIdx = -1
        self._lastResult = result
        data = []
        for clubItem in result:
            cfdUnitID = clubItem.getID()
            creatorID = clubItem.getCreatorID()
            creator = userGetter(creatorID)
            rating = self.getUserRating(creatorID)
            if creator is None:
                creator = self._UserEntityAdapter(creatorID, self)
            creatorName = creator.getName()
            creatorVO = makeUserVO(creator, colorGetter)
            index = len(self.collection)
            if cfdUnitID == selectedID:
                self._selectedIdx = index
            self.mapping[cfdUnitID] = index
            data.append((rating, {'cfdUnitID': cfdUnitID,
              'unitMgrID': cfdUnitID,
              'creator': creatorVO,
              'creatorName': creatorName,
              'rating': ratingFormatter(rating),
              'playersCount': clubItem.getMembersCount(),
              'commandSize': clubItem.getCommandSize(),
              'inBattle': False,
              'isFreezed': False,
              'isRestricted': False,
              'description': html.escape(clubItem.getShortDescription()),
              'peripheryID': -1,
              'server': None,
              'ladderIcon': getLadderChevron16x16(clubItem.getDivision()),
              'isStatic': True}))

        self.collection.extend(map(lambda (r, c): c, sorted(data, reverse=True, key=operator.itemgetter(0))))
        if syncUserInfo:
            self.syncUsersInfo()
        return self._selectedIdx
开发者ID:krzcho,项目名称:WOTDecompiled,代码行数:41,代码来源:rally_dps.py


示例14: _getSlotsData

def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    canTakeSlot = not pInfo.isLegionary()
    if app:
        isPlayerSpeaking = app.voiceChatManager.isPlayerSpeaking
    else:
        isPlayerSpeaking = lambda dbID: False
    if unit.isSquad():
        falloutBattleType = unit.getExtra().eventType
        isFallout = falloutBattleType != FALLOUT_BATTLE_TYPE.UNDEFINED
        falloutCfg = g_eventsCache.getFalloutConfig(falloutBattleType)
    else:
        falloutBattleType = FALLOUT_BATTLE_TYPE.UNDEFINED
        isFallout = False
        falloutCfg = None
    if unit is None:
        makeVO = makePlayerVO
    elif unit.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unit.isSortie():
        makeVO = makeSortiePlayerVO
    elif unit.isClub():
        makeVO = makeStaticFormationPlayerVO
    else:
        makeVO = makePlayerVO
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            isCurrentPlayer = player.isCurrentPlayer()
            if vehicle:
                if 'vehLevel' in vehicle:
                    slotLevel = vehicle['vehLevel']
                if 'vehTypeCompDescr' in vehicle:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle['vehTypeCompDescr']), levelsRange, isCurrentPlayer=isCurrentPlayer)
        if unit is not None and unit.isClub():
            slotLabel = makeStaticSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, pInfo.isLegionary(), unit.isRated())
        else:
            isRequired = falloutBattleType == FALLOUT_BATTLE_TYPE.MULTITEAM
            slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, isRequired=isRequired)
        if unit.isSquad():
            playerStatus = getSquadPlayerStatus(slotState, player)
        else:
            playerStatus = getPlayerStatus(slotState, player)
        if unit is not None:
            restrictions = makeUnitRosterVO(unit, pInfo, index=index, isSortie=unit.isSortie(), levelsRange=levelsRange)['conditions']
        else:
            restrictions = []
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': unitState.isFreezed(),
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign and canTakeSlot,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions,
         'isFallout': isFallout}
        if isFallout:
            vehiclesNotify = [None, None, None]
            selectedVehicles = [None, None, None]
            if player is not None:
                dbID = player.dbID
                isCurrentPlayer = player.isCurrentPlayer()
                if isCurrentPlayer:
                    if falloutBattleType == FALLOUT_BATTLE_TYPE.MULTITEAM:
                        vehiclesNotify[0] = [i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYMULTITEAM)]
                    else:
                        vehiclesNotify[0] = [i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFY, level=text_styles.main(int2roman(falloutCfg.vehicleLevelRequired)))]
                    if len(falloutCfg.allowedLevels) > 1:
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYRANGE, level=text_styles.main(toRomanRangeString(list(falloutCfg.allowedLevels), 1)))
                    else:
                        statusTemplate = i18n.makeString(MESSENGER.DIALOGS_FALLOUTSQUADCHANNEL_VEHICLENOTIFYMULTITEAM)
                    for slotIdx in range(1, falloutCfg.minVehiclesPerPlayer):
                        vehiclesNotify[slotIdx] = statusTemplate

                for idx, (vInvID, vehIntCD) in enumerate(unit.getExtra().accountVehicles.get(dbID, ())):
                    selectedVehicles[idx] = makeVehicleVO(vehicleGetter(vehIntCD), falloutCfg.allowedLevels, isCurrentPlayer=isCurrentPlayer)

            slot['vehiclesNotify'] = vehiclesNotify
            slot['selectedVehicle'] = selectedVehicles
        slots.append(slot)
#.........这里部分代码省略.........
开发者ID:kblw,项目名称:wot_client,代码行数:101,代码来源:vo_converters.py


示例15: isSender

 def isSender(self):
     user = storage_getter('users')().getUser(self.getSenderID())
     if user:
         return user.isCurrentPlayer()
     return False
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:5,代码来源:entities.py


示例16: isIgnored

 def isIgnored(self):
     user = storage_getter('users')().getUser(self.getSenderID())
     if user:
         return user.isIgnored()
     return False
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:5,代码来源:entities.py


示例17: __findClanChannel

 def __findClanChannel(self):
     channel = storage_getter('channels')().getChannelByCriteria(self.__channelCriteria)
     if channel is not None:
         self.__initClanChannel(channel)
     return
开发者ID:aevitas,项目名称:wotsdk,代码行数:5,代码来源:bwclanlistener.py


示例18: _getSlotsData

def _getSlotsData(unitIdx, unit, unitState, pInfo, slotsIter, app = None, levelsRange = None, checkForVehicles = True):
    isPlayerCreator = pInfo.isCreator()
    isPlayerInSlot = pInfo.isInSlot
    slots = []
    userGetter = storage_getter('users')().getUser
    colorGetter = g_settings.getColorScheme('rosters').getColors
    vehicleGetter = g_itemsCache.items.getItemByCD
    canTakeSlot = not pInfo.isLegionary()
    bwPlugin = proto_getter(PROTO_TYPE.BW_CHAT2)(None)
    isPlayerSpeaking = bwPlugin.voipController.isPlayerSpeaking
    falloutCtrl = getFalloutCtrl()
    isFallout = falloutCtrl.isEnabled()
    if isFallout:
        falloutBattleType = falloutCtrl.getBattleType()
        falloutCfg = falloutCtrl.getConfig()
    else:
        falloutBattleType = QUEUE_TYPE.UNKNOWN
        falloutCfg = None
    if unit is None:
        makeVO = makePlayerVO
    elif unit.isFortBattle():
        makeVO = makeClanBattlePlayerVO
    elif unit.isSortie():
        makeVO = makeSortiePlayerVO
    elif unit.isClub():
        makeVO = makeStaticFormationPlayerVO
    else:
        makeVO = makePlayerVO
    rosterSlots = {}
    isDefaultSlot = False
    if unit is not None:
        roster = unit.getRoster()
        rosterSlots = roster.slots
        isDefaultSlot = roster.isDefaultSlot
    for slotInfo in slotsIter:
        index = slotInfo.index
        slotState = slotInfo.state
        player = slotInfo.player
        vehicle = slotInfo.vehicle
        canAssign, vehicles = pInfo.canAssignToSlot(index)
        vehCount = len(vehicles)
        slotLevel = 0
        vehicleVO = None
        slotPlayerUI = None
        if player is not None:
            dbID = player.dbID
            slotPlayerUI = makeVO(player, userGetter(dbID), colorGetter, isPlayerSpeaking(dbID))
            isCurrentPlayer = player.isCurrentPlayer()
            if vehicle:
                slotLevel = vehicle.vehLevel
                if vehicle.vehTypeCompDescr:
                    vehicleVO = makeVehicleVO(vehicleGetter(vehicle.vehTypeCompDescr), levelsRange, isCurrentPlayer=isCurrentPlayer)
        if unit is not None and unit.isClub():
            slotLabel = makeStaticSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, pInfo.isLegionary(), unit.isRated())
        else:
            isRequired = falloutBattleType == QUEUE_TYPE.FALLOUT_MULTITEAM
            slotLabel = makeSlotLabel(unitState, slotState, isPlayerCreator, vehCount, checkForVehicles, isRequired=isRequired)
        if unit.isPrebattlesSquad():
            playerStatus = getSquadPlayerStatus(slotState, player)
        else:
            playerStatus = getPlayerStatus(slotState, player)
        if unit is not None:
            restrictions = makeUnitRosterConditions(rosterSlots, isDefaultSlot, index=index, isSortie=unit.isSortie(), levelsRange=levelsRange)
        else:
            restrictions = []
        slot = {'rallyIdx': unitIdx,
         'isCommanderState': isPlayerCreator,
         'isCurrentUserInSlot': isPlayerInSlot,
         'playerStatus': playerStatus,
         'isClosed': slotState.isClosed,
         'isFreezed': unitState.isFreezed(),
         'slotLabel': slotLabel,
         'player': slotPlayerUI,
         'canBeTaken': canAssign and canTakeSlot,
         'compatibleVehiclesCount': vehCount,
         'selectedVehicle': vehicleVO,
         'selectedVehicleLevel': 1 if slotState.isClosed else slotLevel,
         'restrictions': restrictions,
         'isFallout': isFallout}
        if unit.isSquad():
            if g_eventsCache.isBalancedSquadEnabled():
                isVisibleAdtMsg = player and player.isCurrentPlayer() and not isPlayerCreator and not vehicle and unit and bool(unit.getMemberVehicles(unit.getCommanderDBID()))
                if isVisibleAdtMsg:
                    rangeString = toRomanRangeString(levelsRange, 1)
                    additionMsg = text_styles.main(i18n.makeString(MESSENGER.DIALOGS_SIMPLESQUAD_VEHICLELEVEL, level=rangeString))
                else:
                    additionMsg = ''
                slot.update({'isVisibleAdtMsg': isVisibleAdtMsg,
                 'additionalMsg': additionMsg})
            elif g_eventsCache.isSquadXpFactorsEnabled():
                vehicles = unit.getVehicles()
                levels = unit.getSelectedVehicleLevels()
                isVisibleAdtMsg = False
                additionalMsg = ''
                unitHasXpBonus = True
                unitHasXpPenalty = False
                if vehicles:
                    distance = levels[-1] - levels[0]
                    unitHasXpBonus = distance in g_eventsCache.getSquadBonusLevelDistance()
                    unitHasXpPenalty = distance in g_eventsCache.getSquadPenaltyLevelDistance()
#.........这里部分代码省略.........
开发者ID:webiumsk,项目名称:WOT-0.9.15.1,代码行数:101,代码来源:vo_converters.py



注:本文中的messenger.storage.storage_getter函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python messenger_common_chat2.messageArgs函数代码示例发布时间:2022-05-27
下一篇:
Python g_logOutput.error函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap