本文整理汇总了C#中Tree.GetFirstChild方法的典型用法代码示例。如果您正苦于以下问题:C# Tree.GetFirstChild方法的具体用法?C# Tree.GetFirstChild怎么用?C# Tree.GetFirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tree
的用法示例。
在下文中一共展示了Tree.GetFirstChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadTreeFromBattleObject
private void LoadTreeFromBattleObject(Game game, BattleObject activeBattleObject)
{
Tree<string> optionTree = new Tree<string>("root");
optionTree.AddChild("Attack");
foreach(var attack in activeBattleObject.AttackList) {
optionTree.GetFirstChild("Attack").AddChild(attack);
}
optionTree.AddChild("Magic");
foreach(var magic in activeBattleObject.MagicList) {
optionTree.GetFirstChild("Magic").AddChild(magic);
}
optionTree.AddChild("Item");
foreach(var item in activeBattleObject.ItemList) {
optionTree.GetFirstChild("Item").AddChild(item);
}
_menuItemView.SetTree(optionTree);
_menuItemView.SetFirstSelected();
}
示例2: SetCode
/// <summary>
/// Устанавливает новый код и автоматически распознаёт его содержимое
/// </summary>
/// <param name="_code"></param>
public void SetCode(string _code)
{
env = new Environs();
program = new ProgramStruct();
program.program_tree = GetProgramTree(_code.ToLower());
program.program_tree.Dump();
program.consts = GetTypesStruct(program.program_tree, "const");
program.types = GetTypesStruct(program.program_tree, "type");
program.vars = GetTypesStruct(program.program_tree, "var");
CheckConflictNames();
cursor = GetElementCursor(program.program_tree, "begin");
if (cursor.HasChild())
cursor = cursor.GetFirstChild();
else
cursor = null;
InitConstant();
InitVariable();
}