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


C# LuaFunction.Call方法代码示例

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


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

示例1: GetPlayers

		public Player[] GetPlayers(LuaFunction filter)
		{
			return Context.World.Players
				.Where(p =>
				{
					using (var f = filter.Call(p.ToLuaValue(Context)))
						return f.First().ToBoolean();
				}).ToArray();
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:9,代码来源:PlayerGlobal.cs

示例2: Any

        public bool Any(LuaValue[] collection, LuaFunction func)
        {
            foreach (var c in collection)
                using (var ret = func.Call(c))
                using (var result = ret.FirstOrDefault())
                    if (result != null && result.ToBoolean())
                        return true;

            return false;
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:10,代码来源:UtilsGlobal.cs

示例3: ActorsInCircle

		public LuaTable ActorsInCircle(WPos location, WRange radius, LuaFunction filter)
		{
			var actors = context.World.FindActorsInCircle(location, radius)
				.Select(a => a.ToLuaValue(context))
				.Where(a => 
				{
					using (var f = filter.Call(a))
						return f.First().ToBoolean();
				});
			return actors.ToLuaTable(context);
		}
开发者ID:Berzeger,项目名称:OpenRA,代码行数:11,代码来源:MapGlobal.cs

示例4: GetPlayers

		public LuaTable GetPlayers(LuaFunction filter)
		{
			var players = context.World.Players
				.Select(p => p.ToLuaValue(context))
				.Where(a =>
				{
					using (var f = filter.Call(a))
						return f.First().ToBoolean();
				});

			return players.ToLuaTable(context);
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:12,代码来源:PlayerGlobal.cs

示例5: All

		public bool All(LuaValue[] collection, LuaFunction func)
		{
			foreach (var c in collection)
			{
				using (var ret = func.Call(c))
				{
					var result = ret.FirstOrDefault();
					if (result == null || !result.ToBoolean())
						return false;
				}
			}

			return true;
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:14,代码来源:UtilsGlobal.cs

示例6: Any

        public bool Any(LuaTable table, LuaFunction func)
        {
            foreach (var kv in table)
            {
                using (var ret = func.Call(kv.Value))
                {
                    var result = ret.FirstOrDefault();
                    if (result != null && result.ToBoolean())
                        return true;
                }
            }

            return false;
        }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:14,代码来源:UtilsGlobal.cs

示例7: ActorsInBox

		public Actor[] ActorsInBox(WPos topLeft, WPos bottomRight, LuaFunction filter = null)
		{
			var actors = Context.World.ActorMap.ActorsInBox(topLeft, bottomRight);

			if (filter != null)
			{
				actors = actors.Where(a =>
				{
					using (var f = filter.Call(a.ToLuaValue(Context)))
						return f.First().ToBoolean();
				});
			}

			return actors.ToArray();
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:15,代码来源:MapGlobal.cs

示例8: ActorsInCircle

		public Actor[] ActorsInCircle(WPos location, WDist radius, LuaFunction filter = null)
		{
			var actors = Context.World.FindActorsInCircle(location, radius);

			if (filter != null)
			{
				actors = actors.Where(a =>
				{
					using (var f = filter.Call(a.ToLuaValue(Context)))
						return f.First().ToBoolean();
				});
			}

			return actors.ToArray();
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:15,代码来源:MapGlobal.cs

示例9: Do

		public void Do(LuaValue[] collection, LuaFunction func)
		{
			foreach (var c in collection)
				func.Call(c).Dispose();
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:5,代码来源:UtilsGlobal.cs

示例10: Execute

        void Execute(string cmd, string args, LuaFunction filter)
        {
            var handleOutput = new Action<string, CommandOutput>(
                (text, command) =>
            {
                // Clean up new lines in the end of the string.
                if (text.EndsWith(Environment.NewLine))
                    text = text.Replace(Environment.NewLine, string.Empty);

                command.Raw.Add(text);

                if (filter == null)
                    goto SkipFilter;

                var result = filter.Call(text);
                if (result.Count == 0)
                    return;

                text = result[0].ToString();

            SkipFilter:

                command.Lines.Add(text);
                Build.Output.WriteLine(text);
            });

            ExecuteProcess(cmd, args, handleOutput);
        }
开发者ID:tritao,项目名称:BuildSharp,代码行数:28,代码来源:LuaBuildStep.cs

示例11: BuildStep

 void BuildStep(string name, LuaFunction step)
 {
     Output.PushGroup("Build step '{0}'", name);
     step.Call();
     Output.PopGroup();
 }
开发者ID:tritao,项目名称:BuildSharp,代码行数:6,代码来源:LuaBuildStep.cs

示例12: RunCode

 private static void RunCode(LuaFunction function)
 {
     try
     {
         function.Call();
     }
     catch (Exception ex)
     {
         throw new BuildException("Error in Lua script: " + ex.ToString());
     }
 }
开发者ID:tritao,项目名称:BuildSharp,代码行数:11,代码来源:LuaBuildStep.cs

示例13: Do

 public void Do(LuaTable table, LuaFunction func)
 {
     foreach (var kv in table)
         func.Call(kv.Value).Dispose();
 }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:5,代码来源:UtilsGlobal.cs

示例14: Where

        public LuaTable Where(LuaValue[] collection, LuaFunction func)
        {
            var t = Context.CreateTable();

            foreach (var c in collection)
                using (var ret = func.Call(c))
                using (var result = ret.FirstOrDefault())
                    if (result != null && result.ToBoolean())
                        t.Add(t.Count + 1, c);

            return t;
        }
开发者ID:pchote,项目名称:OpenRA,代码行数:12,代码来源:UtilsGlobal.cs


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