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


Python PrbCtrlRequestCtx.addFlags方法代码示例

本文整理汇总了Python中gui.prb_control.context.PrbCtrlRequestCtx.addFlags方法的典型用法代码示例。如果您正苦于以下问题:Python PrbCtrlRequestCtx.addFlags方法的具体用法?Python PrbCtrlRequestCtx.addFlags怎么用?Python PrbCtrlRequestCtx.addFlags使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.prb_control.context.PrbCtrlRequestCtx的用法示例。


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

示例1: _PrebattleDispatcher

# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import addFlags [as 别名]

#.........这里部分代码省略.........
            unitFunctional.rejoin()
        else:
            if unitFunctional is not None:
                prbType = unitFunctional.getEntityType()
            else:
                prbType = 0
            self.__changeUnitFunctional(flags=self.__requestCtx.getFlags(), prbType=prbType)
        return

    def unitMgr_onUnitLeft(self, unitMgrID, unitIdx):
        flags = self.__requestCtx.getFlags()
        flags |= FUNCTIONAL_FLAG.LEAVE_ENTITY
        prbType = 0
        if flags & FUNCTIONAL_FLAG.SWITCH > 0:
            unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
            if unitFunctional is not None:
                prbType = unitFunctional.getEntityType()
        self.__changeUnitFunctional(flags=flags, prbType=prbType)
        g_eventDispatcher.updateUI()
        return

    def unitMgr_onUnitRestored(self, unitMgrID, unitIdx):
        unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
        flags = unitFunctional.getFlags()
        pInfo = unitFunctional.getPlayerInfo()
        if flags.isInPreArena() and pInfo.isInSlot:
            g_eventDispatcher.loadHangar()

    def unitMgr_onUnitErrorReceived(self, requestID, unitMgrID, unitIdx, errorCode, errorString):
        unitFunctional = self.getFunctional(_CTRL_TYPE.UNIT)
        if unitFunctional is not None:
            unitFunctional.setLastError(errorCode)
            if errorCode in RETURN_INTRO_UNIT_MGR_ERRORS and unitFunctional.canSwitchToIntro():
                self.__requestCtx.addFlags(FUNCTIONAL_FLAG.SWITCH)
            if errorCode == UNIT_ERROR.CANT_PICK_LEADER:
                self.__requestCtx.removeFlags(FUNCTIONAL_FLAG.SWITCH)
            elif errorCode == UNIT_ERROR.REMOVED_PLAYER:
                if (
                    self.__requestCtx.getCtrlType() == _CTRL_TYPE.UNIT
                    and unitFunctional.getEntityType() != self.__requestCtx.getEntityType()
                ):
                    self.__requestCtx.removeFlags(FUNCTIONAL_FLAG.SWITCH)
        else:
            LOG_ERROR("Unit functional is not found")
        if errorCode not in IGNORED_UNIT_MGR_ERRORS:
            msgType, msgBody = messages.getUnitMessage(errorCode, errorString)
            SystemMessages.pushMessage(msgBody, type=msgType)
            self.__requestCtx.stopProcessing(result=False)
            g_eventDispatcher.updateUI()
        return

    def unitBrowser_onErrorReceived(self, errorCode, errorString):
        if errorCode not in IGNORED_UNIT_BROWSER_ERRORS:
            msgType, msgBody = messages.getUnitBrowserMessage(errorCode, errorString)
            SystemMessages.pushMessage(msgBody, type=msgType)

    def forMgr_onFortStateChanged(self):
        g_eventDispatcher.updateUI()

    def fortMgr_onFortResponseReceived(self, requestID, resultCode, _):
        self.__requestCtx.stopProcessing(result=resultCode in (FORT_ERROR.OK,))
        g_eventDispatcher.updateUI()

    def __startListening(self):
        """
        Subscribes to player events.
开发者ID:aevitas,项目名称:wotsdk,代码行数:70,代码来源:prb_controldispatcher.py


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