当前位置: 首页>>代码示例>>C#>>正文


C# ScriptProcessor.Run方法代码示例

本文整理汇总了C#中ScriptProcessor.Run方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptProcessor.Run方法的具体用法?C# ScriptProcessor.Run怎么用?C# ScriptProcessor.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScriptProcessor的用法示例。


在下文中一共展示了ScriptProcessor.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Call

        /// <summary>
        /// Executes the function.
        /// </summary>
        /// <param name="processor">The processor with context that called this functions.</param>
        /// <param name="caller">The calling object.</param>
        /// <param name="This">The "This" reference used in the call context.</param>
        /// <param name="parameters">The parameters used in this function call.</param>
        public SObject Call(ScriptProcessor processor, SObject caller, SObject This, SObject[] parameters)
        {
            ScriptProcessor functionProcessor = new ScriptProcessor(processor.Context);
            SObject functionReturnObject;

            if (_method != null)
            {
                functionReturnObject = _method(functionProcessor, caller, This, parameters);
            }
            else
            {
                for (int i = 0; i < _parameters.Length; i++)
                {
                    if (parameters.Length > i)
                    {
                        functionProcessor.Context.AddVariable(_parameters[i], parameters[i]);
                    }
                    else
                    {
                        functionProcessor.Context.AddVariable(_parameters[i], functionProcessor.Undefined);
                    }
                }

                functionProcessor.Context.This = This;
                functionReturnObject = functionProcessor.Run(Body);
            }

            if (functionProcessor.ErrorHandler.ThrownError)
                processor.ErrorHandler.ThrowError(functionProcessor.ErrorHandler.ErrorObject);

            return functionReturnObject;
        }
开发者ID:Aragas,项目名称:Pokemon3D-1,代码行数:39,代码来源:SFunction.cs

示例2: Call

        /// <summary>
        /// Executes the function.
        /// </summary>
        /// <param name="processor">The processor with context that called this functions.</param>
        /// <param name="caller">The calling object.</param>
        /// <param name="This">The "This" reference used in the call context.</param>
        /// <param name="parameters">The parameters used in this function call.</param>
        public SObject Call(ScriptProcessor processor, SObject caller, SObject This, SObject[] parameters)
        {
            var functionProcessor = new ScriptProcessor(processor.Context, processor.GetLineNumber());
            SObject functionReturnObject;

            if (HasBuiltInMethod)
            {
                if (Method != null)
                {
                    functionReturnObject = Method(functionProcessor, caller, This, parameters);
                }
                else
                {
                    var dotNetParams = parameters.Select(p => ScriptOutAdapter.Translate(p));
                    var dotNetReturnObj = DotNetMethod(ScriptOutAdapter.Translate(caller), new ScriptObjectLink(processor, caller), dotNetParams.ToArray());
                    functionReturnObject = ScriptInAdapter.Translate(processor, dotNetReturnObj);
                }
            }
            else
            {
                for (var i = 0; i < _parameters.Length; i++)
                {
                    if (parameters.Length > i)
                    {
                        functionProcessor.Context.AddVariable(_parameters[i], parameters[i]);
                    }
                    else
                    {
                        functionProcessor.Context.AddVariable(_parameters[i], functionProcessor.Undefined);
                    }
                }

                functionProcessor.Context.This = This;
                functionReturnObject = functionProcessor.Run(Body);
            }

            return functionReturnObject;
        }
开发者ID:nilllzz,项目名称:Pokemon3D,代码行数:45,代码来源:SFunction.cs


注:本文中的ScriptProcessor.Run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。