예제 #1
0
 public override void AssignChildComponents(XComponent parent, ref List <uint> children)
 {
     foreach (uint childID in children)
     {
         XComponent child = X.Tools.GetXComponentByID(childID);
         if (child.GetType() == typeof(XEnvironmentParameters))
         {
             ((XHeightMap)parent).Params = (XEnvironmentParameters)child;
             parent.Load(X.Content);
         }
     }
 }
예제 #2
0
 public override void AssignChildComponents(XComponent parent, ref List <uint> children)
 {
     foreach (uint childID in children)
     {
         XComponent child = X.Tools.GetXComponentByID(childID);
         if (child.GetType() == typeof(XModel))
         {
             ((XProp)parent).model_editor = (XModel)child;
         }
     }
     //base.AssignChildComponents(parent, ref children);
 }
예제 #3
0
 public override void AssignChildComponents(XComponent parent, ref List <uint> children)
 {
     foreach (uint childID in children)
     {
         XComponent child = X.Tools.GetXComponentByID(childID);
         if (child.GetType() == typeof(XHeightMap))
         {
             ((XTreeSystem)parent).HeightMap = (XHeightMap)child;
             ((XTreeSystem)parent).Load(X.Content);
             ((XTreeSystem)parent).GenerateTrees(X.DefaultCamera);
         }
     }
 }
예제 #4
0
        public void LoadFromXML(XmlNodeList scenenode, ListView scene)
        {
            Depends = new Dictionary <uint, List <uint> >();

            foreach (XmlNode node in scenenode)
            {
                foreach (ComponentPlugin plugin in Plugins)
                {
                    if (plugin.type.ToString() == node.Attributes["Type"].InnerText)
                    {
                        plugin.LoadFromXML(node, scene, ref Depends);
                    }
                }
            }

            //we need to keep a list of objects that are depend on each other
            //an object may have 1 or more child objects which are not linked by the above load routines
            //here we link these objects that recorded there dependencies during load
            foreach (uint keyID in Depends.Keys)
            {
                List <uint> children;
                if (Depends.TryGetValue(keyID, out children))
                {
                    //get parent object and match type
                    XComponent parent = X.Tools.GetXComponentByID(keyID);

                    foreach (ComponentPlugin plugin in Plugins)
                    {
                        if (plugin.type == parent.GetType())
                        {
                            plugin.AssignChildComponents(parent, ref children);
                        }
                    }
                }
            }
        }