本文整理汇总了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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
}
示例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;
}
}
}
示例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);
}
示例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;
}
}
}
示例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;
}
}
}