Esempio n. 1
0
        //Init
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            Logging.LogInfo(this, "Initializing");
            AssetDatabase.Init();
            UserCodeDatabase.Init();
            RenderPipeline.Init(this);
            Input.Init(this);

            //AssetDatabase.Load(7);
            //Material m = AssetDatabase.GetAsset<Material>(7);
            //RenderPipeline.AddPostProcessingEffect(m);

            AssetDatabase.Load(3);
            s = AssetDatabase.GetAsset <Scene>(3);
            AssetDatabase.Load(2);
        }
Esempio n. 2
0
        private void LoadComponent(XmlNode componentNode, Entity e)
        {
            bool enabled = Convert.ToBoolean(componentNode.Attributes["enabled"].Value);
            Type type    = UserCodeDatabase.GetType(componentNode.Attributes["name"].Value);

            if (type == null)
            {
                Logging.LogWarning(this, $"The component {componentNode.Attributes["name"].Value} could not be found!");
                return;
            }
            Component c = e.AddComponent(type) as Component;

            c.enabled = enabled;

            //Fields
            XmlNodeList fieldNodes = componentNode.SelectNodes("Fields/*[local-name()='Field']");

            foreach (XmlNode f in fieldNodes)
            {
                FieldInfo field = c.GetType().GetField(f.Attributes["name"].Value);
                TypeSerialization.DeserializeField(f, field, c);
            }
        }