当前位置: 首页>>代码示例>>Python>>正文


Python UnitBase.UnitBase类代码示例

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


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

示例1: _giveLeadership

 def _giveLeadership(self, memberDBID):
     prevRoleFlags = self._players[memberDBID]["role"]
     UnitBase._giveLeadership(self, memberDBID)
     newRoleFlags = self._players[memberDBID]["role"]
     self._creatorDBID = memberDBID
     self.onUnitMembersListChanged()
     self.onUnitPlayerRoleChanged(memberDBID, prevRoleFlags, newRoleFlags)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:7,代码来源:clientunit.py

示例2: _addPlayer

 def _addPlayer(self, accountDBID, **kwargs):
     if (
         "role" in kwargs
         and kwargs["role"] & UNIT_ROLE.CREATOR == UNIT_ROLE.CREATOR
         and self._playerSlots.get(accountDBID) == LEADER_SLOT
     ):
         self._creatorDBID = accountDBID
     UnitBase._addPlayer(self, accountDBID, **kwargs)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:8,代码来源:clientunit.py

示例3: _changePlayerRole

 def _changePlayerRole(self, accountDBID, roleFlags):
     prevRoleFlags = UNIT_ROLE.DEFAULT
     if accountDBID in self._players:
         prevRoleFlags = self._players[accountDBID]["role"]
     UnitBase._changePlayerRole(self, accountDBID, roleFlags)
     if roleFlags & UNIT_ROLE.CREATOR == UNIT_ROLE.CREATOR and self._playerSlots.get(accountDBID) == LEADER_SLOT:
         self._creatorDBID = accountDBID
     self.onUnitPlayerRoleChanged(accountDBID, prevRoleFlags, roleFlags)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:8,代码来源:clientunit.py

示例4: _changePlayerRole

 def _changePlayerRole(self, playerID, roleFlags):
     prevRoleFlags = UNIT_ROLE.DEFAULT
     if playerID in self._players:
         prevRoleFlags = self._players[playerID]['role']
     UnitBase._changePlayerRole(self, playerID, roleFlags)
     if roleFlags & UNIT_ROLE.COMMANDER_UPDATES > 0:
         self._creatorDBID = playerID
     self.onUnitPlayerRoleChanged(playerID, prevRoleFlags, roleFlags)
开发者ID:Infernux,项目名称:Projects,代码行数:8,代码来源:clientunit.py

示例5: _unpackVehicleDict

 def _unpackVehicleDict(self, packedOps):
     nextOps = UnitBase._unpackVehicleDict(self, packedOps)
     try:
         (playerID,) = struct.unpack_from(PLAYER_ID_CHR, packedOps, offset=VEH_LEN_SIZE)
         self.onUnitPlayerVehDictChanged(playerID)
     except struct.error as e:
         LOG_ERROR(e)
     return nextOps
开发者ID:Infernux,项目名称:Projects,代码行数:8,代码来源:clientunit.py

示例6: __init__

 def __init__(self, slotDefs = {}, slotCount = 0, packedRoster = '', packedUnit = ''):
     self.__eManager = Event.EventManager()
     self.onUnitStateChanged = Event.Event(self.__eManager)
     self.onUnitReadyMaskChanged = Event.Event(self.__eManager)
     self.onUnitVehicleChanged = Event.Event(self.__eManager)
     self.onUnitSettingChanged = Event.Event(self.__eManager)
     self.onUnitPlayerRoleChanged = Event.Event(self.__eManager)
     self.onUnitRosterChanged = Event.Event(self.__eManager)
     self.onUnitMembersListChanged = Event.Event(self.__eManager)
     self.onUnitPlayerAdded = Event.Event(self.__eManager)
     self.onUnitPlayerRemoved = Event.Event(self.__eManager)
     self.onUnitPlayersListChanged = Event.Event(self.__eManager)
     self.onUnitPlayerVehDictChanged = Event.Event(self.__eManager)
     self.onUnitPlayerInfoChanged = Event.Event(self.__eManager)
     self.onUnitUpdated = Event.Event(self.__eManager)
     self._creatorDBID = 0L
     UnitBase.__init__(self, slotDefs, slotCount, packedRoster, packedUnit)
开发者ID:Infernux,项目名称:Projects,代码行数:17,代码来源:clientunit.py

示例7: unpackOps

 def unpackOps(self, packedOps = ''):
     invokedOps = UnitBase.unpackOps(self, packedOps)
     if {UNIT_OP.REMOVE_PLAYER, UNIT_OP.ADD_PLAYER} & invokedOps:
         self.onUnitPlayersListChanged()
     if {UNIT_OP.DEL_MEMBER, UNIT_OP.SET_MEMBER} & invokedOps:
         self.onUnitMembersListChanged()
     if UNIT_OP.SET_SLOT in invokedOps:
         self.onUnitRosterChanged()
开发者ID:Infernux,项目名称:Projects,代码行数:8,代码来源:clientunit.py

示例8: unpackOps

 def unpackOps(self, packedOps=""):
     invokedOps = UnitBase.unpackOps(self, packedOps)
     if {UNIT_OP.REMOVE_PLAYER, UNIT_OP.ADD_PLAYER} & invokedOps:
         self.onUnitPlayersListChanged()
     if {UNIT_OP.DEL_MEMBER, UNIT_OP.SET_MEMBER} & invokedOps:
         self.onUnitMembersListChanged()
     if UNIT_OP.SET_SLOT in invokedOps:
         self.onUnitRosterChanged()
     if {UNIT_OP.EXTRAS_UPDATE, UNIT_OP.EXTRAS_RESET} & invokedOps:
         self.onUnitExtraChanged(self._extras)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:10,代码来源:clientunit.py

示例9: __init__

 def __init__(self, limitsDefs = {}, slotDefs = {}, slotCount = 0, packedRoster = '', extrasInit = None, packedUnit = ''):
     self.__eManager = Event.SuspendedEventManager()
     self.onUnitFlagsChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitReadyMaskChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitVehicleChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitVehiclesChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitSettingChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayerRoleChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitRosterChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitMembersListChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayerAdded = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayerRemoved = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayersListChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayerVehDictChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitPlayerInfoChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitExtraChanged = Event.SuspendedEvent(self.__eManager)
     self.onUnitUpdated = Event.SuspendedEvent(self.__eManager)
     self._creatorDBID = 0
     UnitBase.__init__(self, limitsDefs, slotDefs, slotCount, packedRoster, extrasInit, packedUnit)
开发者ID:aevitas,项目名称:wotsdk,代码行数:19,代码来源:client_commonclientunit.py

示例10: _unpackPlayer

 def _unpackPlayer(self, packedOps):
     (playerID, hasPlayer,) = (0, False)
     try:
         (playerID,) = struct.unpack_from(PLAYER_ID_CHR, packedOps)
         filtered = dict(filter(lambda item: item[1].get('role', 0) & UNIT_ROLE.INVITED == 0, self._players.iteritems()))
         hasPlayer = playerID in filtered
     except struct.error as e:
         LOG_ERROR(e)
     nextOps = UnitBase._unpackPlayer(self, packedOps)
     if not hasPlayer and playerID:
         self.onUnitPlayerAdded(playerID, self.getPlayer(playerID))
     if hasPlayer:
         LOG_DEBUG_DEV('onUnitPlayerInfoChanged', playerID, self.getPlayer(playerID))
         self.onUnitPlayerInfoChanged(playerID, self.getPlayer(playerID))
     return nextOps
开发者ID:Infernux,项目名称:Projects,代码行数:15,代码来源:clientunit.py

示例11: _unpackPlayer

    def _unpackPlayer(self, packedOps):
        accountDBID, hasPlayer = 0, False
        try:
            accountDBID, = struct.unpack_from(PLAYER_ID_CHR, packedOps)
            filtered = dict(
                filter(lambda item: item[1].get("role", 0) & UNIT_ROLE.INVITED == 0, self._players.iteritems())
            )
            hasPlayer = accountDBID in filtered
        except struct.error as e:
            LOG_ERROR(e)

        nextOps = UnitBase._unpackPlayer(self, packedOps)
        if not hasPlayer and accountDBID:
            self.onUnitPlayerAdded(accountDBID, self.getPlayer(accountDBID))
        if hasPlayer:
            LOG_DEBUG_DEV("onUnitPlayerInfoChanged", accountDBID, self.getPlayer(accountDBID))
            self.onUnitPlayerInfoChanged(accountDBID, self.getPlayer(accountDBID))
        return nextOps
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:18,代码来源:clientunit.py

示例12: setComment

 def setComment(self, strComment):
     UnitBase.setComment(self, strComment)
     self.onUnitSettingChanged(UNIT_OP.SET_COMMENT, self._strComment)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:3,代码来源:clientunit.py

示例13: _setUnitState

 def _setUnitState(self, state):
     prevState = self._state
     UnitBase._setUnitState(self, state)
     self.onUnitStateChanged(prevState, self._state)
开发者ID:Infernux,项目名称:Projects,代码行数:4,代码来源:clientunit.py

示例14: _removePlayer

 def _removePlayer(self, accountDBID):
     pInfo = self.getPlayer(accountDBID)
     if pInfo:
         self.onUnitPlayerRemoved(accountDBID, pInfo)
     UnitBase._removePlayer(self, accountDBID)
开发者ID:webiumsk,项目名称:WOT-0.9.12-CT,代码行数:5,代码来源:clientunit.py

示例15: _setVehicle

 def _setVehicle(self, playerID, vehTypeCompDescr, vehInvID):
     UnitBase._setVehicle(self, playerID, vehTypeCompDescr, vehInvID)
     self.onUnitVehicleChanged(playerID, vehInvID, vehTypeCompDescr)
开发者ID:Infernux,项目名称:Projects,代码行数:3,代码来源:clientunit.py


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