本文整理汇总了Python中gui.prb_control.context.PrbCtrlRequestCtx.getCtrlType方法的典型用法代码示例。如果您正苦于以下问题:Python PrbCtrlRequestCtx.getCtrlType方法的具体用法?Python PrbCtrlRequestCtx.getCtrlType怎么用?Python PrbCtrlRequestCtx.getCtrlType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.prb_control.context.PrbCtrlRequestCtx
的用法示例。
在下文中一共展示了PrbCtrlRequestCtx.getCtrlType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _PrebattleDispatcher
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import getCtrlType [as 别名]
#.........这里部分代码省略.........
def join(self, ctx, callback=None):
if self.__validateJoinOp(ctx):
result = yield self.unlock(ctx)
ctx.setForced(result)
if result:
entry = self.__factories.createEntry(ctx)
if entry:
LOG_DEBUG("Request to join", ctx)
self.__requestCtx = ctx
entry.join(ctx, callback=callback)
else:
LOG_ERROR("Entry not found", ctx)
if callback is not None:
callback(False)
else:
if callback is not None:
callback(False)
yield lambda callback=None: callback
return
@async
def leave(self, ctx, callback=None):
if ctx.getRequestType() != _RQ_TYPE.LEAVE:
LOG_ERROR("Invalid context to leave prebattle/unit", ctx)
if callback is not None:
callback(False)
return
elif self.__requestCtx.isProcessing():
LOG_ERROR("Request is processing", self.__requestCtx)
if callback is not None:
callback(False)
return
else:
ctrlType = ctx.getCtrlType()
formation = self.__collection.getItem(ctx.getCtrlType())
if formation is not None:
if formation.hasLockedState():
entityType = formation.getEntityType()
SystemMessages.pushI18nMessage(
messages.getLeaveDisabledMessage(ctrlType, entityType), type=SystemMessages.SM_TYPE.Warning
)
if callback is not None:
callback(False)
return
LOG_DEBUG("Request to leave formation", ctx)
self.__requestCtx = ctx
formation.leave(ctx, callback=callback)
else:
LOG_ERROR("Functional not found", ctx)
if callback is not None:
callback(False)
return
@async
@process
def unlock(self, unlockCtx, callback=None):
state = self.getFunctionalState()
result = True
if not state.isIntroMode:
canDoLeave = True
elif unlockCtx.hasFlags(FUNCTIONAL_FLAG.SWITCH):
if state.ctrlTypeID == unlockCtx.getCtrlType() and state.entityTypeID != unlockCtx.getEntityType():
canDoLeave = True
unlockCtx.removeFlags(FUNCTIONAL_FLAG.SWITCH)
else:
canDoLeave = False