Exemplo n.º 1
0
        ScriptVar ApiDebug(ScriptVm vm)
        {
            var str = string.Empty;

            for (int i = 0, iMax = vm.GetParamsCount(); i < iMax; i++)
            {
                str += " " + vm.GetParamById(i).AsString;
            }
            Debug.LogFormat("[SCRIPT: {0}]{1}", Time.time, str);
            return(new ScriptVar());
        }
Exemplo n.º 2
0
        ScriptVar ApiCallWithDelay(ScriptVm vm)
        {
            var count    = vm.GetParamsCount();
            var pTimeout = vm.GetParamById(0);
            var pEvent   = vm.GetParamById(1);

            if (count < 2 || !pTimeout.IsNumber || !pEvent.IsString)
            {
                _vm.SetRuntimeError("(nTimeout, sFuncName[, param1, param2]) parameters required");
                return(new ScriptVar());
            }
            ScriptVar?param1 = null;

            if (count > 2)
            {
                param1 = vm.GetParamById(2);
            }
            ScriptVar?param2 = null;

            if (count > 3)
            {
                param2 = vm.GetParamById(3);
            }
            ScriptVar?param3 = null;

            if (count > 4)
            {
                param3 = vm.GetParamById(4);
            }
            ScriptVar?param4 = null;

            if (count > 5)
            {
                param4 = vm.GetParamById(5);
            }

            CallFunctionWithDelay(pEvent.AsString, pTimeout.AsNumber, param1, param2, param3, param4);

            return(new ScriptVar());
        }