Пример #1
0
 private void Tree_OnEventApplied(EditorState state, EditorEvent e)
 {
     if (e is TaskCreatedEvent)
     {
         RootView.Children.Add(TaskNode.Create(RootView, ((TaskCreatedEvent)e).NewTask));
     }
     else if (e is TaskNotCreatedEvent)
     {
         EditorHelper.DisplayDialog("Failed to create task", ((TaskNotCreatedEvent)e).Reason);
     }
 }
Пример #2
0
        public BehaviorTreeNode(EditorDomain domain, BehaviorTreeView parent)
            : base(domain
                   , parent
                   , string.Format("{0}-Node", parent.Tree.Id))
        {
            Tree = parent.Tree;
            Tree.OnEventApplied += Tree_OnEventApplied;

            if (Tree.RootTaskId > 0)
            {
                var task = (TaskState)Repository.States[TaskState.GetId(Tree.RootTaskId)];
                RootView.Children.Add(TaskNode.Create(RootView, task));
            }
        }