本文整理汇总了C#中Instruction.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Instruction.Initialize方法的具体用法?C# Instruction.Initialize怎么用?C# Instruction.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Instruction
的用法示例。
在下文中一共展示了Instruction.Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseScript
/// <summary>
/// Parse script line by line.
/// </summary>
private void ParseScript()
{
Dynamic dyn = (Dynamic)currentlySelectedObject;
int atindex = -1; // If -1, @ token was not found
dyn.Instructions.Clear();
// Mark flag to enable scripted movement
dyn.IsScripted = cbox_Scripted.Checked;
// Parse instructions and send to object
Regex reg = new Regex(EditorConstants.WINFORM_NEWLINE);
List<string> instructions = new List<string>(reg.Split(tb_Script.Text));
instructions.RemoveAll(IsEmptyString);
for (int i = 0; i < instructions.Count; i++)
{
string line = instructions[i];
Instruction inst = new Instruction();
if (line[0] == '@')
{
atindex = dyn.Instructions.Count;
line = line.Substring(1);
if (inst.Initialize(line))
dyn.Instructions.Add(inst);
}
else if (line == "goto @" && atindex > -1)
{
line = "goto " + atindex;
if (inst.Initialize(line))
dyn.Instructions.Add(inst);
}
else
{
if (inst.Initialize(line))
dyn.Instructions.Add(inst);
}
}
}