本文整理汇总了Python中gui.prb_control.context.PrbCtrlRequestCtx.stopProcessing方法的典型用法代码示例。如果您正苦于以下问题:Python PrbCtrlRequestCtx.stopProcessing方法的具体用法?Python PrbCtrlRequestCtx.stopProcessing怎么用?Python PrbCtrlRequestCtx.stopProcessing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.prb_control.context.PrbCtrlRequestCtx
的用法示例。
在下文中一共展示了PrbCtrlRequestCtx.stopProcessing方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RandomQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
class RandomQueueFunctional(PreQueueFunctional):
def __init__(self, settings = None):
super(RandomQueueFunctional, self).__init__(QUEUE_TYPE.RANDOMS, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedRandom,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedRandom,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueRandomFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromRandomQueue,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(RandomQueueFunctional, self).init(ctx)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
if self.isInQueue():
g_eventDispatcher.loadBattleQueue()
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
super(RandomQueueFunctional, self).fini(woEvents)
@vehicleAmmoCheck
def join(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if isParentControlActivated():
g_eventDispatcher.showParentControlNotification()
if callback:
callback(False)
return
if not hasattr(BigWorld.player(), 'enqueueRandom'):
if callback:
callback(False)
LOG_ERROR('Player can not join to random queue')
return
mapID = ctx.getDemoArenaTypeID()
if mapID:
LOG_DEBUG('Demonstrator mapID:', ArenaType.g_cache[mapID].geometryName)
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().enqueueRandom(ctx.getVehicleInventoryID(), gameplaysMask=ctx.getGamePlayMask(), arenaTypeID=mapID)
LOG_DEBUG('Player is joining to random queue', ctx)
def leave(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if hasattr(BigWorld.player(), 'dequeueRandom'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueRandom()
else:
super(RandomQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from random queue')
def isInQueue(self):
return isInRandomQueue()
def hasGUIPage(self):
return True
def doAction(self, action = None, dispatcher = None):
result = False
def _leavePreQueue():
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
if not self.isInQueue():
def _joinResponse(success):
if not success:
_leavePreQueue()
self.join(pre_queue_ctx.JoinRandomQueueCtx(action.mapID if action else 0, waitingID='prebattle/join'), callback=_joinResponse)
else:
_leavePreQueue()
return result
def onEnqueued(self):
super(RandomQueueFunctional, self).onEnqueued()
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadBattleQueue()
g_eventDispatcher.updateUI()
def onDequeued(self):
super(RandomQueueFunctional, self).onDequeued()
self.__requestCtx.stopProcessing(True)
g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
g_eventDispatcher.loadHangar()
#.........这里部分代码省略.........
示例2: _PrebattleDispatcher
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
#.........这里部分代码省略.........
return
def pe_onArenaJoinFailure(self, errorCode, _):
SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode), type=SystemMessages.SM_TYPE.Error)
def pe_onKickedFromArena(self, reasonCode):
self.__collection.reset()
SystemMessages.pushMessage(messages.getKickReasonMessage(reasonCode), type=SystemMessages.SM_TYPE.Error)
def pe_onPrebattleAutoInvitesChanged(self):
if GUI_SETTINGS.specPrebatlesVisible:
isHidden = areSpecBattlesHidden()
if isHidden:
g_eventDispatcher.removeSpecBattlesFromCarousel()
else:
g_eventDispatcher.addSpecBattlesToCarousel()
g_eventDispatcher.updateUI()
def pe_onPrebattleJoined(self):
clientPrb = getClientPrebattle()
if clientPrb:
prbFunctional = self.getFunctional(CTRL_ENTITY_TYPE.PREBATTLE)
if prbFunctional:
if self.__requestCtx and self.__requestCtx.getPrbType() == prbFunctional.getPrbType():
exit = FUNCTIONAL_EXIT.PREBATTLE
else:
exit = FUNCTIONAL_EXIT.NO_FUNC
prbFunctional.setExit(exit)
else:
LOG_ERROR('Prebattle functional is not found')
self.__factories.createFunctional(self, CreateFunctionalCtx(CTRL_ENTITY_TYPE.PREBATTLE))
else:
LOG_ERROR('ClientPrebattle is not defined')
self.__requestCtx.stopProcessing(result=False)
def pe_onPrebattleJoinFailure(self, errorCode):
SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode), type=SystemMessages.SM_TYPE.Error)
self.__requestCtx.stopProcessing(result=False)
g_eventDispatcher.updateUI()
def pe_onPrebattleLeft(self):
if self.__nextPrbFunctional:
self.__nextPrbFunctional()
self.__nextPrbFunctional = None
return
else:
prbFunctional = self.getFunctional(CTRL_ENTITY_TYPE.PREBATTLE)
prbType = 0
if prbFunctional and prbFunctional.getExit() not in (FUNCTIONAL_EXIT.NO_FUNC,
FUNCTIONAL_EXIT.BATTLE_TUTORIAL,
FUNCTIONAL_EXIT.RANDOM,
FUNCTIONAL_EXIT.SWITCH,
FUNCTIONAL_EXIT.SQUAD,
FUNCTIONAL_EXIT.FALLOUT):
prbType = prbFunctional.getPrbType()
self._changePrbFunctional(prbType=prbType, stop=False)
return
def pe_onKickedFromPrebattle(self, _):
self._changePrbFunctional(funcExit=FUNCTIONAL_EXIT.NO_FUNC, stop=False)
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock):
if isParentControlActivated():
self.__collection.reset()
key = '#system_messages:gameSessionControl/korea/{0:>s}'
if isPlayTimeBan:
示例3: HistoricalQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
#.........这里部分代码省略.........
priceIndex, _ = self.getSelectedPrice(histBattleID, vehicleID)
if historicalBattle is not None and vehicleID is not None:
if historicalBattle.isFuture():
return (False, '')
if not historicalBattle.canParticipateWith(vehicleID):
return (False, '')
prices = historicalBattle.getShellsLayoutPrice(vehicleID)
selected = priceIndex if priceIndex is not None else len(prices) - 1
enoughGold, enoughCredits = historicalBattle.getShellsLayoutPriceStatus(vehicleID)[selected]
if not enoughGold or not enoughCredits:
return (False, '')
return super(HistoricalQueueFunctional, self).canPlayerDoAction()
else:
return (False, '')
def doAction(self, action = None, dispatcher = None):
result = False
if not self.isInQueue():
histBattleID = self.getSetting(PREQUEUE_SETTING_NAME.BATTLE_ID)
selectedVehicleID = self.getSetting(PREQUEUE_SETTING_NAME.SELECTED_VEHICLE_ID)
_, isCreditsAmmo = self.getSelectedPrice(histBattleID, selectedVehicleID)
self.join(pre_queue_ctx.JoinHistoricalQueueCtx(histBattleID, isCreditsAmmo, waitingID='prebattle/join'))
else:
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
return result
def doSelectAction(self, action):
result = False
if action.actionName == PREBATTLE_ACTION_NAME.HISTORICAL:
g_eventDispatcher.showHistoryBattlesWindow()
result = True
return result
def onEnqueued(self, *args):
super(HistoricalQueueFunctional, self).onEnqueued(*args)
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadBattleQueue()
g_eventDispatcher.updateUI()
def onDequeued(self, *args):
super(HistoricalQueueFunctional, self).onDequeued(*args)
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadHangar()
g_eventDispatcher.updateUI()
self.showGUI()
self.__checkAvailability()
def onEnqueueError(self, errorCode, _):
super(HistoricalQueueFunctional, self).onEnqueueError(errorCode, _)
self.__requestCtx.stopProcessing(False)
SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode), type=SystemMessages.SM_TYPE.Error)
def onKickedFromQueue(self, *args):
super(HistoricalQueueFunctional, self).onKickedFromQueue(*args)
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadHangar()
g_eventDispatcher.updateUI()
SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
self.__checkAvailability()
def onKickedFromArena(self, *args):
super(HistoricalQueueFunctional, self).onKickedFromQueue(*args)
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadHangar()
g_eventDispatcher.updateUI()
SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
self.__checkAvailability()
def onCaptchaInputCanceled(self):
self.__requestCtx.stopProcessing(True)
def getSelectedPrice(self, histBattleID, selectedVehicleID):
return self.getSetting(PREQUEUE_SETTING_NAME.PRICE_INDEX, {}).get(histBattleID, {}).get(selectedVehicleID, (None, True))
def onEventsCacheResync(self):
if isInHistoricalQueue():
return
self.__checkAvailability()
def _applySettings(self, settings):
if PREQUEUE_SETTING_NAME.BATTLE_ID in settings:
historicalBattle = g_eventsCache.getHistoricalBattles().get(settings[PREQUEUE_SETTING_NAME.BATTLE_ID])
g_currentVehicle.setHistoricalBattle(historicalBattle)
def __handleCarouselInited(self, _):
g_eventDispatcher.addHistoryBattlesToCarousel()
def __checkAvailability(self):
if not g_eventsCache.getHistoricalBattles():
LOG_DEBUG('No historical battles available.')
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
return
else:
historicalBattle = g_eventsCache.getHistoricalBattles().get(self._settings[PREQUEUE_SETTING_NAME.BATTLE_ID])
if historicalBattle is None:
LOG_DEBUG('Currently selected historical battle is no longer available.')
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
else:
g_currentVehicle.setHistoricalBattle(historicalBattle)
return
示例4: EventBattlesQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
class EventBattlesQueueFunctional(PreQueueFunctional):
def __init__(self, settings = None):
super(EventBattlesQueueFunctional, self).__init__(QUEUE_TYPE.EVENT_BATTLES, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedEventBattles,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedEventBattles,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueEventBattlesFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromEventBattles,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(EventBattlesQueueFunctional, self).init(ctx)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
if self.isInQueue():
g_eventDispatcher.loadBattleQueue()
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_PAGE)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
super(EventBattlesQueueFunctional, self).fini(woEvents)
@groupAmmoCheck
def join(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if isParentControlActivated():
g_eventDispatcher.showParentControlNotification()
if callback:
callback(False)
return
if not hasattr(BigWorld.player(), 'enqueueEventBattles'):
if callback:
callback(False)
LOG_ERROR('Player can not join to event battles queue')
return
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().enqueueEventBattles(ctx.getVehicleInventoryIDs(), ctx.getBattleType())
LOG_DEBUG('Player is joining to event battles queue', ctx)
def leave(self, ctx, callback = None):
if self.__requestCtx.isProcessing():
LOG_ERROR('Request is processing', self.__requestCtx)
if callback:
callback(False)
return
if hasattr(BigWorld.player(), 'dequeueEventBattles'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueEventBattles()
else:
super(EventBattlesQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from event battles queue')
def isInQueue(self):
return isInEventBattlesQueue()
def hasGUIPage(self):
return True
def doAction(self, action = None, dispatcher = None):
result = False
def _leavePreQueue():
self.leave(pre_queue_ctx.LeavePreQueueCtx(waitingID='prebattle/leave'))
if not self.isInQueue():
def _joinResponse(success):
if not success:
_leavePreQueue()
falloutCtrl = getFalloutCtrl()
self.join(pre_queue_ctx.JoinEventBattlesQueueCtx(map(lambda v: v.invID, falloutCtrl.getSelectedVehicles()), falloutCtrl.getBattleType(), waitingID='prebattle/join'), callback=_joinResponse)
else:
_leavePreQueue()
return result
def onEnqueued(self):
super(EventBattlesQueueFunctional, self).onEnqueued()
self.__requestCtx.stopProcessing(True)
g_eventDispatcher.loadBattleQueue()
g_eventDispatcher.updateUI()
def onDequeued(self):
super(EventBattlesQueueFunctional, self).onDequeued()
self.__requestCtx.stopProcessing(True)
g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
g_eventDispatcher.loadHangar()
def onEnqueueError(self, errorCode, _):
#.........这里部分代码省略.........
示例5: AccountQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
class AccountQueueFunctional(PreQueueFunctional):
def __init__(self, queueType, subscriber, flags = FUNCTIONAL_FLAG.UNDEFINED):
super(AccountQueueFunctional, self).__init__(queueType, subscriber, flags)
self._requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
return super(AccountQueueFunctional, self).init(ctx)
def fini(self, woEvents = False):
self._requestCtx.clear()
super(AccountQueueFunctional, self).fini(woEvents)
def doAction(self, action = None):
if not self.isInQueue():
self.queue(self._makeQueueCtxByAction(action))
else:
self.dequeue(pre_queue_ctx.DequeueCtx(waitingID='prebattle/leave'))
return True
def queue(self, ctx, callback = None):
if ctx is None:
ctx = self._makeQueueCtxByAction()
if self._requestCtx.isProcessing():
LOG_ERROR('Request is processing', self._requestCtx)
if callback is not None:
callback(False)
return
elif self.isInQueue():
LOG_ERROR('Player already is in the queue', self._requestCtx)
if callback is not None:
callback(False)
return
elif self._validateParentControl():
if callback is not None:
callback(False)
return
else:
self._requestCtx = ctx
self._requestCtx.startProcessing(callback)
try:
self._doQueue(ctx)
except (AttributeError, TypeError, NotImplementedError):
LOG_CURRENT_EXCEPTION()
self._requestCtx.stopProcessing(False)
return
def dequeue(self, ctx, callback = None):
if self._requestCtx.isProcessing():
LOG_ERROR('Request is processing', self._requestCtx)
if callback:
callback(False)
return
elif not self.isInQueue():
LOG_ERROR('Player is not in the queue', ctx)
if callback is not None:
callback(False)
return
else:
self._requestCtx = ctx
self._requestCtx.startProcessing(callback)
try:
self._doDequeue(ctx)
except (AttributeError, TypeError, NotImplementedError):
LOG_CURRENT_EXCEPTION()
self._requestCtx.stopProcessing(False)
return
def onEnqueued(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onEnqueued(*args)
def onDequeued(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onDequeued(*args)
def onEnqueueError(self, *args):
self._requestCtx.stopProcessing(False)
super(AccountQueueFunctional, self).onEnqueueError(*args)
def onKickedFromQueue(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onKickedFromQueue(*args)
def onKickedFromArena(self, *args):
self._requestCtx.stopProcessing(True)
super(AccountQueueFunctional, self).onKickedFromArena(*args)
def _doQueue(self, ctx):
raise NotImplementedError('Routine _doQueue must be overridden')
def _doDequeue(self, ctx):
raise NotImplementedError('Routine _doDequeue must be overridden')
def _makeQueueCtxByAction(self, action = None):
raise NotImplementedError('Routine _makeDefQueueCtx must be overridden')
def _validateParentControl(self):
#.........这里部分代码省略.........
示例6: _PrebattleDispatcher
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import stopProcessing [as 别名]
#.........这里部分代码省略.........
def setRequestCtx(self, ctx):
result = True
if self.__requestCtx.isProcessing():
LOG_ERROR("Request is processing", self.__requestCtx)
result = False
else:
self.__requestCtx = ctx
return result
def pe_onArenaJoinFailure(self, errorCode, _):
self.__collection.reset()
SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode), type=SystemMessages.SM_TYPE.Error)
def pe_onKickedFromArena(self, reasonCode):
self.__collection.reset()
SystemMessages.pushMessage(messages.getKickReasonMessage(reasonCode), type=SystemMessages.SM_TYPE.Error)
def pe_onPrebattleAutoInvitesChanged(self):
if GUI_SETTINGS.specPrebatlesVisible:
isHidden = prb_getters.areSpecBattlesHidden()
if isHidden:
g_eventDispatcher.removeSpecBattlesFromCarousel()
else:
g_eventDispatcher.addSpecBattlesToCarousel()
g_eventDispatcher.updateUI()
def pe_onPrebattleJoined(self):
if prb_getters.getClientPrebattle() is not None:
flags = self.__requestCtx.getFlags()
self.__setFunctional(CreateFunctionalCtx(_CTRL_TYPE.PREBATTLE, flags=flags))
else:
LOG_ERROR("ClientPrebattle is not defined")
self.__requestCtx.stopProcessing(result=False)
return
def pe_onPrebattleJoinFailure(self, errorCode):
SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode), type=SystemMessages.SM_TYPE.Error)
self.__requestCtx.stopProcessing(result=False)
self.__requestCtx.clearFlags()
g_eventDispatcher.updateUI()
def pe_onPrebattleLeft(self):
if self.__nextPrbFunctional is not None:
self.__nextPrbFunctional()
self.__nextPrbFunctional = None
return
else:
flags = self.__requestCtx.getFlags()
flags |= FUNCTIONAL_FLAG.LEAVE_ENTITY
prbType = 0
if flags & FUNCTIONAL_FLAG.SWITCH > 0:
prbFunctional = self.getFunctional(_CTRL_TYPE.PREBATTLE)
if prbFunctional is not None:
prbType = prbFunctional.getEntityType()
self.__changePrbFunctional(flags=flags, prbType=prbType, stop=False)
return
def pe_onKickedFromPrebattle(self, _):
self.__changePrbFunctional(stop=True)
def gs_onTillBanNotification(self, isPlayTimeBan, timeTillBlock):
if prb_getters.isParentControlActivated():
self.__collection.reset()
key = "#system_messages:gameSessionControl/korea/{0:>s}"
if isPlayTimeBan: