本文整理匯總了C#中Actor.ToList方法的典型用法代碼示例。如果您正苦於以下問題:C# Actor.ToList方法的具體用法?C# Actor.ToList怎麽用?C# Actor.ToList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Actor
的用法示例。
在下文中一共展示了Actor.ToList方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnAllKilled
public void OnAllKilled(Actor[] actors, LuaFunction func)
{
var group = actors.ToList();
var copy = (LuaFunction)func.CopyReference();
Action<Actor> onMemberKilled = m =>
{
try
{
group.Remove(m);
if (!group.Any())
{
copy.Call();
copy.Dispose();
}
}
catch (Exception e)
{
Context.FatalError(e.Message);
}
};
foreach (var a in group)
GetScriptTriggers(a).OnKilledInternal += onMemberKilled;
}
示例2: OnAllRemovedFromWorld
public void OnAllRemovedFromWorld(Actor[] actors, LuaFunction func)
{
var group = actors.ToList();
var f = (LuaFunction)func.CopyReference();
Action<Actor> onMemberRemoved = m =>
{
try
{
if (!group.Remove(m))
return;
if (!group.Any())
using (f)
f.Call().Dispose();
}
catch (Exception e)
{
Context.FatalError(e.Message);
}
};
foreach (var a in group)
GetScriptTriggers(a).OnRemovedInternal += onMemberRemoved;
}
示例3: refreshPlayersList
public void refreshPlayersList(Actor[] actors)
{
PlayerList.Items.Clear();
Players = actors.ToList();
balancelist.Items.Clear();
foreach (Actor item in actors)
{
PlayerList.Items.Add(item.Name);
balancelist.Items.Add(item.Money);
PictureBox pictureBox = new PictureBox();
playerTokens[item.PlayerID].Location = pictureBoxes[item.Location].Location;
if (proxy.username == item.Name)
{
usernamelb.Text = item.Name;
balancelb.Text = item.Money.ToString();
}
}
}