Exemple #1
0
 private void Match(TreeNode node, SceneNodeBase nodeBase)
 {
     try
     {
         foreach (var item in nodeBase.Children) // item is based off of SceneNodeBase
         {
             var child = new TreeNode(item.Name)
             {
                 Tag = item
             };                                                  // add a node, set its name to the Name field of item
             node.Nodes.Add(child);
             child.ImageIndex         = DeviconServe.GetDeviconIndex(item.GetType().Name);
             child.SelectedImageIndex = DeviconServe.GetDeviconIndex(item.GetType().Name);
             Match(child, item);
         }
     }
     catch (Exception ex)
     {
         if (throwFatalInsteadOfMsg)
         {
             throw;
         }
         GameFatal gf = new GameFatal(ex);
         gf.Show();
     }
 }
Exemple #2
0
 public void Match(TreeView treeView, SceneNodeBase nodeBase)
 {
     try
     {
         treeView.Nodes.Clear(); // clear everything in the treeview
         var node = new TreeNode(nodeBase.Name)
         {
             Tag = nodeBase
         };                                                                               // add a node, set its name to the Name field of nodebase
         treeView.Nodes.Add(node);
         node.ImageIndex         = DeviconServe.GetDeviconIndex(nodeBase.GetType().Name); // get the devicon of this node
         node.SelectedImageIndex = DeviconServe.GetDeviconIndex(nodeBase.GetType().Name);
         var anode = new TreeNode(actionlist.GetType().Name)
         {
             Tag = actionlist
         };                                                                                  // anode is just the action list
         treeView.Nodes.Add(anode);
         anode.ImageIndex         = DeviconServe.GetDeviconIndex(actionlist.GetType().Name); // get the devicon of anode
         anode.SelectedImageIndex = DeviconServe.GetDeviconIndex(actionlist.GetType().Name);
         var cam = new TreeNode(pcam.GetType().Name)
         {
             Tag = pcam
         };
         treeView.Nodes.Add(cam);
         cam.ImageIndex         = DeviconServe.GetDeviconIndex(pcam.GetType().Name);
         cam.SelectedImageIndex = DeviconServe.GetDeviconIndex(pcam.GetType().Name);
         var scn = new TreeNode(scene.GetType().Name)
         {
             Tag = scene
         };
         treeView.Nodes.Add(scn);
         scn.ImageIndex         = DeviconServe.GetDeviconIndex(scn.GetType().Name);
         scn.SelectedImageIndex = DeviconServe.GetDeviconIndex(scn.GetType().Name);
         Match(node, nodeBase);    // call for each child
         Match(anode, actionlist); // call for each child
         treeView.ExpandAll();
     }
     catch (Exception ex)
     {
         GameFatal gf = new GameFatal(ex);
         gf.Show();
     }
 }
Exemple #3
0
 private void Match(TreeNode node, ActionList nodeBase)
 {
     try
     {
         foreach (var item in nodeBase) // item is a task that is put in ActionList
         {
             var child = new TreeNode(item.GetType().Name)
             {
                 Tag = item
             };                                                            // add a node, set its name to the type of its class
             child.ImageIndex         = DeviconServe.GetDeviconIndex(item.GetType().Name);
             child.SelectedImageIndex = DeviconServe.GetDeviconIndex(item.GetType().Name);
             node.Nodes.Add(child);
             // dont call Match at all because the tasks itself dont contain children
         }
     }
     catch (Exception ex)
     {
         GameFatal gf = new GameFatal(ex);
         gf.Show();
     }
 }