コード例 #1
0
ファイル: dispatcher.py プロジェクト: 19colt87/WOTDecompiled
    def create(self, ctx, callback = None):
        if ctx.getRequestType() is not REQUEST_TYPE.CREATE:
            LOG_ERROR('Invalid context to create prebattle/unit', ctx)
            if callback:
                callback(False)
        elif not self.__requestCtx.isProcessing():
            result = True
            funcs = ((self.__prbFunctional, context.LeavePrbCtx(waitingID='prebattle/leave')), (self.__unitFunctional, context.LeaveUnitCtx(waitingID='prebattle/leave')))
            for func, leaveCtx in funcs:
                if func.isConfirmToChange(exit=ctx.getFuncExit()):
                    result = yield DialogsInterface.showDialog(func.getConfirmDialogMeta())
                    if result:
                        result = yield self.leave(leaveCtx)
                        ctx.setForced(result)

            if result:
                entry = functional.createEntry(ctx)
                if entry:
                    LOG_DEBUG('Request to create prebattle/unit', ctx)
                    self.__requestCtx = ctx
                    entry.create(ctx, callback=callback)
                else:
                    LOG_ERROR('Entry not found', ctx)
                    if callback:
                        callback(False)
            elif callback:
                callback(False)
        else:
            LOG_ERROR('Request is processing', self.__requestCtx)
            if callback:
                callback(False)
        yield lambda callback = None: callback
        return
コード例 #2
0
ファイル: dispatcher.py プロジェクト: v3ss0n/WOTDecompiled
    def join(self, ctx, callback=None):
        if not self.__requestCtx.isProcessing():
            result = True
            for func in (self.__prbFunctional, self.__unitFunctional):
                if func.isPlayerJoined(ctx):
                    LOG_DEBUG('Player already joined', func.getID())
                    func.showGUI()
                    result = False
                    break
                if func.hasLockedState():
                    SystemMessages.pushI18nMessage(
                        '#system_messages:prebattle/hasLockedState',
                        type=SystemMessages.SM_TYPE.Warning)
                    result = False
                    break

            if result:
                funcs = ((self.__prbFunctional,
                          context.LeavePrbCtx(waitingID='prebattle/leave')),
                         (self.__unitFunctional,
                          context.LeaveUnitCtx(waitingID='prebattle/leave')))
                for func, leaveCtx in funcs:
                    if func.isConfirmToChange(exit=ctx.getFuncExit()):
                        result = yield DialogsInterface.showDialog(
                            func.getConfirmDialogMeta())
                        if result:
                            result = yield self.leave(leaveCtx)
                            ctx.setForced(result)

                if result:
                    entry = functional.createEntry(ctx)
                    if entry:
                        LOG_DEBUG('Request to join prebattle/unit', ctx)
                        self.__requestCtx = ctx
                        entry.join(ctx, callback=callback)
                    else:
                        LOG_ERROR('Entry not found', ctx)
                        if callback:
                            callback(False)
                elif callback:
                    callback(False)
            elif callback:
                callback(False)
        else:
            LOG_ERROR('Request is processing', self.__requestCtx)
            if callback:
                callback(False)
        yield lambda callback=None: callback
        return
コード例 #3
0
ファイル: dispatcher.py プロジェクト: 19colt87/WOTDecompiled
    def join(self, ctx, callback = None):
        if not self.__requestCtx.isProcessing():
            result = True
            for func in (self.__prbFunctional, self.__unitFunctional):
                if func.isPlayerJoined(ctx):
                    LOG_DEBUG('Player already joined', func.getID())
                    func.showGUI()
                    result = False
                    break
                if func.hasLockedState():
                    SystemMessages.pushI18nMessage('#system_messages:prebattle/hasLockedState', type=SystemMessages.SM_TYPE.Warning)
                    result = False
                    break

            if result:
                funcs = ((self.__prbFunctional, context.LeavePrbCtx(waitingID='prebattle/leave')), (self.__unitFunctional, context.LeaveUnitCtx(waitingID='prebattle/leave')))
                for func, leaveCtx in funcs:
                    if func.isConfirmToChange(exit=ctx.getFuncExit()):
                        result = yield DialogsInterface.showDialog(func.getConfirmDialogMeta())
                        if result:
                            result = yield self.leave(leaveCtx)
                            ctx.setForced(result)

                if result:
                    entry = functional.createEntry(ctx)
                    if entry:
                        LOG_DEBUG('Request to join prebattle/unit', ctx)
                        self.__requestCtx = ctx
                        entry.join(ctx, callback=callback)
                    else:
                        LOG_ERROR('Entry not found', ctx)
                        if callback:
                            callback(False)
                elif callback:
                    callback(False)
            elif callback:
                callback(False)
        else:
            LOG_ERROR('Request is processing', self.__requestCtx)
            if callback:
                callback(False)
        yield lambda callback = None: callback
        return
コード例 #4
0
ファイル: dispatcher.py プロジェクト: v3ss0n/WOTDecompiled
    def create(self, ctx, callback=None):
        if ctx.getRequestType() is not REQUEST_TYPE.CREATE:
            LOG_ERROR('Invalid context to create prebattle/unit', ctx)
            if callback:
                callback(False)
        elif not self.__requestCtx.isProcessing():
            result = True
            funcs = ((self.__prbFunctional,
                      context.LeavePrbCtx(waitingID='prebattle/leave')),
                     (self.__unitFunctional,
                      context.LeaveUnitCtx(waitingID='prebattle/leave')))
            for func, leaveCtx in funcs:
                if func.isConfirmToChange(exit=ctx.getFuncExit()):
                    result = yield DialogsInterface.showDialog(
                        func.getConfirmDialogMeta())
                    if result:
                        result = yield self.leave(leaveCtx)
                        ctx.setForced(result)

            if result:
                entry = functional.createEntry(ctx)
                if entry:
                    LOG_DEBUG('Request to create prebattle/unit', ctx)
                    self.__requestCtx = ctx
                    entry.create(ctx, callback=callback)
                else:
                    LOG_ERROR('Entry not found', ctx)
                    if callback:
                        callback(False)
            elif callback:
                callback(False)
        else:
            LOG_ERROR('Request is processing', self.__requestCtx)
            if callback:
                callback(False)
        yield lambda callback=None: callback
        return