當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。