Ejemplo n.º 1
0
        public void RemoveParent()
        {
            NpcChatProject project = new NpcChatProject();
            DialogTree     tree    = project.ProjectDialogs.CreateNewDialogTree();

            DialogTreeBranch start   = tree.GetStart();
            DialogTreeBranch aBranch = tree.CreateNewBranch();

            Assert.IsTrue(aBranch.AddParent(start));
            Assert.AreEqual(1, aBranch.Parents.Count);
            Assert.AreEqual(1, start.Children.Count);

            Assert.IsTrue(aBranch.RemoveParent(start));
            Assert.AreEqual(0, aBranch.Parents.Count);
            Assert.AreEqual(0, start.Children.Count);
        }
Ejemplo n.º 2
0
        public void RemoveParentCallback()
        {
            NpcChatProject project = new NpcChatProject();
            DialogTree     tree    = project.ProjectDialogs.CreateNewDialogTree();

            DialogTreeBranch start   = tree.GetStart();
            DialogTreeBranch aBranch = tree.CreateNewBranch();

            Assert.IsTrue(start.AddChild(aBranch), "Cannot test removal if you can't add branches");
            Assert.AreEqual(1, start.Children.Count);
            Assert.AreEqual(1, aBranch.Parents.Count);

            bool parentCallback = false, childCallback = false;

            aBranch.OnBranchParentRemoved += id => parentCallback = true;
            start.OnBranchChildRemoved    += id => childCallback = true;

            Assert.IsTrue(aBranch.RemoveParent(start));
            Assert.IsTrue(parentCallback, "Parent Added Callback failed");
            Assert.IsTrue(childCallback, "Child Added Callback failed");
        }
Ejemplo n.º 3
0
 protected override void RelationshipDestroy(DialogTreeBranch parent, DialogTreeBranch child)
 {
     child.RemoveParent(parent);
 }