本文整理汇总了Python中gui.prb_control.context.PrbCtrlRequestCtx.startProcessing方法的典型用法代码示例。如果您正苦于以下问题:Python PrbCtrlRequestCtx.startProcessing方法的具体用法?Python PrbCtrlRequestCtx.startProcessing怎么用?Python PrbCtrlRequestCtx.startProcessing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gui.prb_control.context.PrbCtrlRequestCtx
的用法示例。
在下文中一共展示了PrbCtrlRequestCtx.startProcessing方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RandomQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import startProcessing [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: EventBattlesQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import startProcessing [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, _):
#.........这里部分代码省略.........
示例3: HistoricalQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import startProcessing [as 别名]
class HistoricalQueueFunctional(PreQueueFunctional, IStatefulFunctional):
def __init__(self, settings = None):
super(HistoricalQueueFunctional, self).__init__(QUEUE_TYPE.HISTORICAL, {QUEUE_EVENT_TYPE.ENQUEUED: g_playerEvents.onEnqueuedHistorical,
QUEUE_EVENT_TYPE.DEQUEUED: g_playerEvents.onDequeuedHistorical,
QUEUE_EVENT_TYPE.ENQUEUE_ERROR: g_playerEvents.onEnqueueHistoricalFailure,
QUEUE_EVENT_TYPE.KICKED_FROM_QUEUE: g_playerEvents.onKickedFromHistoricalQueue,
QUEUE_EVENT_TYPE.KICKED_FROM_ARENA: g_playerEvents.onKickedFromArena}, settings=settings)
self.__requestCtx = PrbCtrlRequestCtx()
def init(self, ctx = None):
result = super(HistoricalQueueFunctional, self).init(ctx=ctx)
g_eventDispatcher.loadHistoryBattles()
g_eventsCache.onSyncCompleted += self.onEventsCacheResync
g_eventBus.addListener(events.ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
g_gameCtrl.captcha.onCaptchaInputCanceled += self.onCaptchaInputCanceled
result = FUNCTIONAL_INIT_RESULT.addIfNot(result, FUNCTIONAL_INIT_RESULT.LOAD_WINDOW)
return result
def fini(self, woEvents = False):
self.__requestCtx = None
if not woEvents:
g_eventDispatcher.unloadHistoryBattles()
else:
g_eventDispatcher.removeHistoryBattlesFromCarousel()
g_gameCtrl.captcha.onCaptchaInputCanceled -= self.onCaptchaInputCanceled
g_eventBus.removeListener(events.ChannelCarouselEvent.CAROUSEL_INITED, self.__handleCarouselInited, scope=EVENT_BUS_SCOPE.LOBBY)
g_eventDispatcher.unloadHistoryBattles()
g_eventsCache.onSyncCompleted -= self.onEventsCacheResync
g_currentVehicle.setHistoricalBattle(None)
super(HistoricalQueueFunctional, self).fini(woEvents=woEvents)
return
def getStates(self):
return ({'isInHistoricalQueue': True}, dict(self._settings))
def isInQueue(self):
return isInHistoricalQueue()
def showGUI(self):
g_eventDispatcher.loadHistoryBattles()
@process
def doLeaveAction(self, dispatcher, ctx = None, showConfirmation = True):
meta = self.getConfirmDialogMeta()
if meta is not None:
isConfirmed = yield DialogsInterface.showDialog(meta)
else:
isConfirmed = yield lambda callback: callback(True)
if isConfirmed:
super(HistoricalQueueFunctional, self).doLeaveAction(dispatcher, ctx=None)
return
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(), 'enqueueHistorical'):
if callback:
callback(False)
LOG_ERROR('Player can not join to history queue')
return
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
invID = ctx.getVehicleInventoryID()
histBattleID = ctx.getHistBattleID()
isCreditsAmmo = ctx.getIsCreditsAmmo()
BigWorld.player().enqueueHistorical(invID, histBattleID=histBattleID, isCreditsAmmo=isCreditsAmmo)
LOG_DEBUG('Player is joining to historical 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(), 'dequeueHistorical'):
if self.isInQueue():
self.__requestCtx = ctx
self.__requestCtx.startProcessing(callback)
BigWorld.player().dequeueHistorical()
else:
super(HistoricalQueueFunctional, self).leave(ctx, callback)
else:
if callback:
callback(False)
LOG_ERROR('Player can not exit from random queue')
def getItemData(self):
battleID = self.getSetting(PREQUEUE_SETTING_NAME.BATTLE_ID)
return g_eventsCache.getHistoricalBattles().get(battleID)
def canPlayerDoAction(self):
#.........这里部分代码省略.........
示例4: AccountQueueFunctional
# 需要导入模块: from gui.prb_control.context import PrbCtrlRequestCtx [as 别名]
# 或者: from gui.prb_control.context.PrbCtrlRequestCtx import startProcessing [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):
#.........这里部分代码省略.........