本文整理汇总了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.