本文整理汇总了C#中IAction.Perform方法的典型用法代码示例。如果您正苦于以下问题:C# IAction.Perform方法的具体用法?C# IAction.Perform怎么用?C# IAction.Perform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAction
的用法示例。
在下文中一共展示了IAction.Perform方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformPlayerAction
public void PerformPlayerAction(IAction a)
{
if (CurrentBattleDetails.BattleStatus != BattleStatus.InBattle)
{
throw new Exception("The battle is over what the FUCK are you doing!?");
}
CurrentBattleDetails.TurnDetails.Add(a.Perform(Player));
Player.UntargetTile();
UpdateBattleStatus();
}
示例2: TestAction
private void TestAction(IAction action)
{
action.Perform(_document);
Compare(true);
action.Reverse(_document);
Compare(false);
}
示例3: Perform
/// <summary>
/// Performs the provided action against the turtle
/// </summary>
/// <param name="action">IAction - The action instance with which to perform on the turtle</param>
public void Perform(IAction action)
{
if (action == null) return;
if (_turtle == null) _turtle = new Turtle();
bool success = action.Perform(_turtle);
if (success)
{
_history.Add(action);
for (int index = 0; index < _listViews.Count; index ++)
{
_listViews[index].Draw(_turtle);
_listViews[index].Print(action.ToString());
}
}
}
示例4: PerformAction
/// <summary>
/// Performs the action, adds it to the history stack, and optionally updates the display lists
/// </summary>
/// <param name="name">The name of the action, for history purposes</param>
/// <param name="action">The action to perform</param>
public void PerformAction(string name, IAction action)
{
try
{
action.Perform(this);
}
catch (Exception ex)
{
var st = new StackTrace();
var frames = st.GetFrames() ?? new StackFrame[0];
var msg = "Action exception: " + name + " (" + action + ")";
foreach (var frame in frames)
{
var method = frame.GetMethod();
msg += "\r\n " + method.ReflectedType.FullName + "." + method.Name;
}
Logging.Logger.ShowException(new Exception(msg, ex), "Error performing action");
}
var history = new HistoryAction(name, action);
History.AddHistoryItem(history);
}