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


C# Player.ToLuaValue方法代码示例

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


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

示例1: OnDiscovered

		public void OnDiscovered(Actor self, Player discoverer, bool playNotification)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnDiscovered))
			{
				try
				{
					using (var b = discoverer.ToLuaValue(f.Context))
						f.Function.Call(f.Self, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}

			foreach (var f in Triggerables(Trigger.OnPlayerDiscovered))
			{
				try
				{
					using (var a = self.Owner.ToLuaValue(f.Context))
					using (var b = discoverer.ToLuaValue(f.Context))
						f.Function.Call(a, b, f.Self).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:34,代码来源:ScriptTriggers.cs

示例2: OnObjectiveFailed

		public void OnObjectiveFailed(Player player, int id)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnObjectiveFailed))
			{
				try
				{
					using (var a = player.ToLuaValue(f.Context))
					using (var b = id.ToLuaValue(f.Context))
						f.Function.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:20,代码来源:ScriptTriggers.cs

示例3: OnCapture

		public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnCapture))
			{
				try
				{
					using (var b = captor.ToLuaValue(f.Context))
					using (var c = oldOwner.ToLuaValue(f.Context))
					using (var d = newOwner.ToLuaValue(f.Context))
						f.Function.Call(f.Self, b, c, d).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnCapturedInternal(self);
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:24,代码来源:ScriptTriggers.cs

示例4: OnPlayerLost

		public void OnPlayerLost(Player player)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnPlayerLost))
			{
				try
				{
					using (var a = player.ToLuaValue(f.Context))
						f.Function.Call(a).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:19,代码来源:ScriptTriggers.cs

示例5: OnDiscovered

		public void OnDiscovered(Actor self, Player discoverer, bool playNotification)
		{
			foreach (var f in Triggers[Trigger.OnDiscovered])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = discoverer.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			foreach (var f in Triggers[Trigger.OnPlayerDiscovered])
			{
				try
				{
					using (var a = self.Owner.ToLuaValue(f.Second))
					using (var b = discoverer.ToLuaValue(f.Second))
					using (var c = self.ToLuaValue(f.Second))
						f.First.Call(a, b, c).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:33,代码来源:ScriptTriggers.cs

示例6: OnCapture

		public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
		{
			foreach (var f in Triggers[Trigger.OnCapture])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = captor.ToLuaValue(f.Second))
					using (var c = oldOwner.ToLuaValue(f.Second))
					using (var d = newOwner.ToLuaValue(f.Second))
						f.First.Call(a, b, c, d).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnCapturedInternal(self);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:22,代码来源:ScriptTriggers.cs

示例7: OnObjectiveFailed

		public void OnObjectiveFailed(Player player, int id)
		{
			foreach (var f in Triggers[Trigger.OnObjectiveFailed])
			{
				try
				{
					using (var a = player.ToLuaValue(f.Second))
					using (var b = id.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:17,代码来源:ScriptTriggers.cs

示例8: OnPlayerLost

		public void OnPlayerLost(Player player)
		{
			foreach (var f in Triggers[Trigger.OnPlayerLost])
			{
				try
				{
					using (var a = player.ToLuaValue(f.Second))
						f.First.Call(a).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:16,代码来源:ScriptTriggers.cs


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