Exemple #1
0
 private bool delegate_IsTimeMillisPass(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_IsTimeMillisPass(e, arg, e.getLong(func.args[0], arg)));
 }
Exemple #2
0
 private bool delegate_GetSBoolean(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetSBoolean(e, arg, (string)e.getObj(func.args[0], arg)));
 }
Exemple #3
0
 private bool delegate_RandomBoolean(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_RandomBoolean(e, arg));
 }
Exemple #4
0
 private int delegate_GetTriggerGMCommandIntArg(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetTriggerGMCommandIntArg(e, arg, e.getInt(func.args[0], arg)));
 }
Exemple #5
0
    /** 获取boolean方法返回值 */
    protected virtual bool toGetBooleanFuncValue(TriggerFuncData func, TriggerArg arg)
    {
        switch (func.id)
        {
        case TriggerFunctionType.And:
        {
            if (!getBoolean(func.args[0], arg))
            {
                return(false);
            }

            return(getBoolean(func.args[1], arg));
        }

        case TriggerFunctionType.And2:
        {
            if (!getBoolean(func.args[0], arg))
            {
                return(false);
            }

            if (!getBoolean(func.args[1], arg))
            {
                return(false);
            }

            return(getBoolean(func.args[2], arg));
        }

        case TriggerFunctionType.Or:
        {
            if (getBoolean(func.args[0], arg))
            {
                return(true);
            }

            return(getBoolean(func.args[1], arg));
        }

        case TriggerFunctionType.Or2:
        {
            if (getBoolean(func.args[0], arg))
            {
                return(true);
            }

            if (getBoolean(func.args[1], arg))
            {
                return(true);
            }

            return(getBoolean(func.args[2], arg));
        }
        }

        TriggerFuncEntry entry = _funcMaker.get(func.id);
        Func <TriggerExecutor, TriggerFuncData, TriggerArg, bool> f;

        if (entry == null || (f = entry.boolFunc) == null)
        {
            throwError("未找到的方法类型,Boolean", func.id);
            return(false);
        }

        return(f(this, func, arg));
    }
Exemple #6
0
 private int delegate_GetLocalInt(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetLocalInt(e, arg, (string)e.getObj(func.args[0], arg)));
 }
Exemple #7
0
 private object delegate_GetCurrentListElement(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetCurrentListElement(e, arg));
 }
Exemple #8
0
 private bool delegate_EqualsString(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_EqualsString(e, arg, (string)e.getObj(func.args[0], arg), (string)e.getObj(func.args[1], arg)));
 }
Exemple #9
0
 private bool delegate_NotNull(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_NotNull(e, arg, e.getObj(func.args[0], arg)));
 }
Exemple #10
0
 private bool delegate_Or2(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_Or2(e, arg, (bool)e.getObj(func.args[0], arg), (bool)e.getObj(func.args[1], arg), (bool)e.getObj(func.args[2], arg)));
 }
Exemple #11
0
 private bool delegate_EqualsInt(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_EqualsInt(e, arg, e.getInt(func.args[0], arg), e.getInt(func.args[1], arg)));
 }
Exemple #12
0
 private object delegate_GetSVar(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetSVar(e, arg, (string)e.getObj(func.args[0], arg)));
 }
Exemple #13
0
 private void delegate_While(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     _m.func_While(e, arg, (bool)e.getObj(func.args[0], arg), e.getObj(func.args[1], arg));
 }
Exemple #14
0
    /// <summary>
    /// 是否数据一致
    /// </summary>
    protected override bool toDataEquals(BaseData data)
    {
        if (!base.toDataEquals(data))
        {
            return(false);
        }

        TriggerFuncData mData = (TriggerFuncData)data;

        if (this.id != mData.id)
        {
            return(false);
        }

        if (mData.args != null)
        {
            if (this.args == null)
            {
                return(false);
            }
            if (this.args.Length != mData.args.Length)
            {
                return(false);
            }
            TriggerObjData[] argsT = this.args;
            TriggerObjData[] argsR = mData.args;
            int argsLen            = argsT.Length;
            for (int argsI = 0; argsI < argsLen; ++argsI)
            {
                TriggerObjData argsU = argsT[argsI];
                TriggerObjData argsV = argsR[argsI];
                if (argsV != null)
                {
                    if (argsU == null)
                    {
                        return(false);
                    }
                    if (!argsU.dataEquals(argsV))
                    {
                        return(false);
                    }
                }
                else
                {
                    if (argsU != null)
                    {
                        return(false);
                    }
                }
            }
        }
        else
        {
            if (this.args != null)
            {
                return(false);
            }
        }

        return(true);
    }
Exemple #15
0
 private int delegate_Sub1Int(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_Sub1Int(e, arg, e.getInt(func.args[0], arg)));
 }
Exemple #16
0
 private bool delegate_CompareLong(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_CompareLong(e, arg, e.getLong(func.args[0], arg), e.getLong(func.args[1], arg), e.getInt(func.args[2], arg)));
 }
Exemple #17
0
 private int delegate_ConvertLong2Int(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_ConvertLong2Int(e, arg, e.getLong(func.args[0], arg)));
 }
Exemple #18
0
 private bool delegate_LessThanFloat(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_LessThanFloat(e, arg, e.getFloat(func.args[0], arg), e.getFloat(func.args[1], arg)));
 }
Exemple #19
0
 private int delegate_GetCurrentLoopIndex(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GetCurrentLoopIndex(e, arg));
 }
Exemple #20
0
 private bool delegate_GreaterThanLong(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_GreaterThanLong(e, arg, e.getLong(func.args[0], arg), e.getLong(func.args[1], arg)));
 }
Exemple #21
0
 private int delegate_RandomRange(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_RandomRange(e, arg, e.getInt(func.args[0], arg), e.getInt(func.args[1], arg)));
 }
Exemple #22
0
 private bool delegate_LessThanOrEqualLong(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_LessThanOrEqualLong(e, arg, e.getLong(func.args[0], arg), e.getLong(func.args[1], arg)));
 }
Exemple #23
0
 private float delegate_InvertFloat(TriggerExecutor e, TriggerFuncData func, TriggerArg arg)
 {
     return(_m.func_InvertFloat(e, arg, e.getFloat(func.args[0], arg)));
 }
Exemple #24
0
    /** 执行异步方法 */
    protected virtual bool toDoAsyncActionFunc(TriggerFuncData func, TriggerArg arg)
    {
        switch (func.id)
        {
        case TriggerFunctionType.If:
        {
            if (getBoolean(func.args[0], arg))
            {
                TriggerFuncListData listFunc = (TriggerFuncListData)func.args[1];

                runChildActions(TriggerChildRunnerType.If, listFunc.funcList, arg.runner);
            }
            else
            {
                if (func.args.Length > 2)
                {
                    TriggerFuncListData listFunc = (TriggerFuncListData)func.args[2];

                    if (listFunc.funcList.Length > 0)
                    {
                        runChildActions(TriggerChildRunnerType.If, listFunc.funcList, arg.runner);
                    }
                    else
                    {
                        //直接下一个
                        runNextAction(arg.runner);
                    }
                }
                else
                {
                    //直接下一个
                    runNextAction(arg.runner);
                }
            }
        }
        break;

        case TriggerFunctionType.While:
        {
            if (getBoolean(func.args[0], arg))
            {
                TriggerFuncListData listFunc = (TriggerFuncListData)func.args[1];

                runChildActions(TriggerChildRunnerType.While, listFunc.funcList, arg.runner);
            }
            else
            {
                //直接下一个
                runNextAction(arg.runner);
            }
        }
        break;

        case TriggerFunctionType.ForLoop:
        {
            int loop = getInt(func.args[0], arg.runner.arg);

            if (loop <= 0)
            {
                //直接下一个
                runNextAction(arg.runner);
            }
            else
            {
                arg.runner.loopCount = loop;
                arg.runner.loop      = 0;

                TriggerFuncListData listFunc = (TriggerFuncListData)func.args[1];

                runChildActions(TriggerChildRunnerType.ForLoop, listFunc.funcList, arg.runner);
            }
        }
        break;

        case TriggerFunctionType.RunTrigger:
        {
            runTrigger(getInt(func.args[0], arg), arg.runner);
        }
        break;

        case TriggerFunctionType.RunTriggerAbs:
        {
            runTriggerAbs(getInt(func.args[0], arg), arg.runner);
        }
        break;

        case TriggerFunctionType.BreakTrigger:
        {
            //直接完成根节点
            completeCurrentAction(arg.runner.root);
        }
        break;

        case TriggerFunctionType.BreakLoop:
        {
            if (arg.runner.isInLoop())
            {
                TriggerActionRunner parent = arg.runner.parent;
                if (parent == null)
                {
                    throwError("不该找不到父");
                    return(false);
                }

                disposeActionRunner(arg.runner);
                parent.arg.runner = parent;
                runNextAction(parent);
            }
            else
            {
                warnLog("breakLoop时,不是循环");
                runNextAction(arg.runner);
            }
        }
        break;

        case TriggerFunctionType.ContinueLoop:
        {
            if (arg.runner.isInLoop())
            {
                completeCurrentAction(arg.runner);
            }
            else
            {
                warnLog("continueLoop时,不是循环");
                runNextAction(arg.runner);
            }
        }
        break;

        case TriggerFunctionType.Wait:
        {
            arg.runner.timerType   = TriggerActionTimerType.Wait;
            arg.runner.currentTime = arg.runner.timeMax = getInt(func.args[0], arg);
            addTimeRunner(arg.runner);
        }
        break;

        case TriggerFunctionType.WaitUtil:
        {
            //判定成功直接过
            if (getBoolean(arg.runner.getCurrentAction().args[0], arg))
            {
                runNextAction(arg.runner);
            }
            else
            {
                //加入等待
                arg.runner.timerType   = TriggerActionTimerType.WaitUtil;
                arg.runner.currentTime = arg.runner.timeMax = getInt(func.args[1], arg);
                addTimeRunner(arg.runner);
            }
        }
        break;

        case TriggerFunctionType.ForeachList:
        {
            SList <Object> list = getList(func.args[0], arg);

            if (list.isEmpty())
            {
                //直接下一个
                runNextAction(arg.runner);
            }
            else
            {
                arg.runner.foreachList = list;
                arg.runner.loop        = 0;

                TriggerFuncListData listFunc = (TriggerFuncListData)func.args[1];
                runChildActions(TriggerChildRunnerType.ForEachList, listFunc.funcList, arg.runner);
            }
        }
        break;

        default:
        {
            return(false);
        }
        }

        return(true);
    }