//EngineNS.Thread.Async.TaskLoader.WaitContext WaitContext = new EngineNS.Thread.Async.TaskLoader.WaitContext();
        //async System.Threading.Tasks.Task<EngineNS.Thread.Async.TaskLoader.WaitContext> AwaitLoad()
        //{
        //    return await EngineNS.Thread.Async.TaskLoader.Awaitload(WaitContext);
        //}
        public override async System.Threading.Tasks.Task Load(XndNode xndNode)
        {
            //await AwaitLoad();
            NeedResetLoadValue = await ParticleDataSaveLoad.LoadData("ParticleTextureCutNode", xndNode, CSParam as ParticleTextureCutControlConstructionParams, this, mLinkedNodesContainer);

            await base.Load(xndNode);
        }
        public override void Save(XndNode xndNode, bool newGuid)
        {
            ParticleDataSaveLoad.SaveData("ParticleMaterialInstanceNode", xndNode, newGuid, CSParam as ParticleMaterialInstanceControlConstructionParams, this, mLinkedNodesContainer);
            base.Save(xndNode, newGuid);

            if (ShowValues.Count > 0)
            {
                InitValueDatas = ShowValues;
            }

            var attr = xndNode.AddAttrib("MaterialInstance_control");

            attr.Version = 0;
            attr.BeginWrite();
            attr.Write(InitValueDatas.Count);

            for (int i = 0; i < InitValueDatas.Count; i++)
            {
                var showvalue = InitValueDatas[i];
                attr.Write(showvalue.MaterialInstanceName);
                attr.Write(showvalue.VarRNameValues.Count);
                foreach (var varvalue in showvalue.VarRNameValues)
                {
                    attr.Write(varvalue.Key);
                    attr.Write(varvalue.Value.GetType().FullName);
                    {
                        if (varvalue.Value.GetType().Equals(typeof(float)))
                        {
                            attr.Write((float)varvalue.Value);
                            //elem.VarObject.mMaterialInstance.SetVarValue(elem.VarObject.Index, 0, ref value);
                        }
                        else if (varvalue.Value.GetType().Equals(typeof(Vector2)))
                        {
                            attr.Write((Vector2)varvalue.Value);
                        }
                        else if (varvalue.Value.GetType().Equals(typeof(Vector3)))
                        {
                            attr.Write((Vector3)varvalue.Value);
                        }
                        else if (varvalue.Value.GetType().Equals(typeof(Vector4)))
                        {
                            attr.Write((Vector4)varvalue.Value);
                        }
                        else if (varvalue.Value.GetType().Equals(typeof(EngineNS.Color)))
                        {
                            attr.Write((Color4)varvalue.Value);
                        }
                    }
                }

                attr.Write(showvalue.SRVRNameValues.Count);
                foreach (var srvvalue in showvalue.SRVRNameValues)
                {
                    attr.Write(srvvalue.Key);
                    attr.Write(srvvalue.Value as RName);
                }
            }
            attr.EndWrite();
        }
        public override void Save(XndNode xndNode, bool newGuid)
        {
            ParticleDataSaveLoad.SaveData("ParticleAcceleratedNode", xndNode, newGuid, CSParam as ParticleAcceleratedControlConstructionParams, this, mLinkedNodesContainer);

            var csParam = CSParam as ParticleAcceleratedControlConstructionParams;

            base.Save(xndNode, newGuid);
            DataGradient.Save(xndNode, newGuid);
        }
Ejemplo n.º 4
0
        public static void SaveData(string name, XndNode xndNode, bool newGuid, StructNodeControlConstructionParams csparam, IParticleNode pnode, CodeGenerateSystem.Controls.NodesContainerControl mLinkedNodesContainer)
        {
            var psd = pnode as IParticleSaveData;

            if (psd != null && psd.IsLoadLink() == false)
            {
                var test = ParticleDataSaveLoad.LoadData(csparam, mLinkedNodesContainer, psd);
            }

            if (mLinkedNodesContainer != null)
            {
                var att = xndNode.AddAttrib(name);
                att.Version = 0;
                att.BeginWrite();

                List <string> keys = new List <string>();
                //var csparam = CSParam as StructNodeControlConstructionParams;
                if (csparam.CategoryDic == null)
                {
                    att.Write(0);
                    att.EndWrite();
                }
                else
                {
                    att.Write(csparam.CategoryDic.Count);
                    foreach (var category in csparam.CategoryDic)
                    {
                        att.Write(category.Key);
                        att.Write(category.Value.Items.Count);

                        keys.Add(category.Key);
                    }
                    att.EndWrite();

                    for (int i = 0; i < keys.Count; i++)
                    {
                        var Node     = xndNode.AddNode(keys[i], 0, 0);
                        var category = csparam.CategoryDic[keys[i]];
                        for (int j = 0; j < category.Items.Count; j++)
                        {
                            var childNode = Node.AddNode("childNode", 0, 0);
                            category.Items[j].Save(childNode);
                        }
                    }
                }
            }

            //base.Save(xndNode, newGuid);
            if (pnode.GetCreateObject() != null)
            {
                var childenode = xndNode.AddNode("CreateObjectNode", 0, 0);

                pnode.GetCreateObject().Save(childenode, newGuid);
            }
        }
Ejemplo n.º 5
0
        public override async System.Threading.Tasks.Task Load(XndNode xndNode)
        {
            //if (NeedInitGrapth)
            //{
            //    var test = InitGraph();
            //}

            await base.Load(xndNode);

            NeedResetLoadValue = await ParticleDataSaveLoad.LoadData2("ParticleSystemNode", xndNode, CSParam as ParticleSystemControlConstructionParams, this, mLinkedNodesContainer);
        }
        public override async System.Threading.Tasks.Task Load(XndNode xndNode)
        {
            //if (NeedInitGrapth)
            //{
            //    var test = InitGraph();
            //}
            //await AwaitLoad();
            await ParticleDataSaveLoad.LoadData2("ParticleAcceleratedNode", xndNode, CSParam as ParticleAcceleratedControlConstructionParams, this, mLinkedNodesContainer);

            await base.Load(xndNode);

            await DataGradient.Load(xndNode);
        }
 public override void Save(XndNode xndNode, bool newGuid)
 {
     ParticleDataSaveLoad.SaveData("ParticleTextureCutNode", xndNode, newGuid, CSParam as ParticleTextureCutControlConstructionParams, this, mLinkedNodesContainer);
     base.Save(xndNode, newGuid);
 }
        public async System.Threading.Tasks.Task InitGraphEvent()
        {
            await InitGraph();

            await ParticleDataSaveLoad.LoadData(CSParam as StructNodeControlConstructionParams, mLinkedNodesContainer, this);
        }
        //EngineNS.Thread.Async.TaskLoader.WaitContext WaitContext = new EngineNS.Thread.Async.TaskLoader.WaitContext();
        //async System.Threading.Tasks.Task<EngineNS.Thread.Async.TaskLoader.WaitContext> AwaitLoad()
        //{
        //    return await EngineNS.Thread.Async.TaskLoader.Awaitload(WaitContext);
        //}
        public override async System.Threading.Tasks.Task Load(XndNode xndNode)
        {
            //await AwaitLoad();
            await ParticleDataSaveLoad.LoadData("ParticleMaterialInstanceNode", xndNode, CSParam as ParticleMaterialInstanceControlConstructionParams, this, mLinkedNodesContainer);

            await base.Load(xndNode);

            InitValueDatas = new List <MaterialInstanceEditProperty>();
            var attr = xndNode.FindAttrib("MaterialInstance_control");

            attr.BeginRead();
            if (attr.Version == 0)
            {
                int count;
                attr.Read(out count);
                for (int i = 0; i < count; i++)
                {
                    var   showvalue = new MaterialInstanceEditProperty();
                    RName materialname;
                    attr.Read(out materialname);
                    showvalue.MaterialInstanceName = materialname;
                    int varcount;
                    attr.Read(out varcount);
                    //foreach (var varvalue in showvalue.VarRNameValues)
                    for (int varn = 0; varn < varcount; varn++)
                    {
                        int    key;
                        string typefullname;
                        attr.Read(out key);
                        attr.Read(out typefullname);
                        {
                            if (typefullname.Equals(typeof(float).FullName))
                            {
                                float value;
                                attr.Read(out value);
                                //elem.VarObject.mMaterialInstance.SetVarValue(elem.VarObject.Index, 0, ref value);
                                showvalue.VarRNameValues.Add(key, value);
                            }
                            else if (typefullname.Equals(typeof(Vector2).FullName))
                            {
                                Vector2 value;
                                attr.Read(out value);
                                showvalue.VarRNameValues.Add(key, value);
                            }
                            else if (typefullname.Equals(typeof(Vector3).FullName))
                            {
                                Vector3 value;
                                attr.Read(out value);
                                showvalue.VarRNameValues.Add(key, value);
                            }
                            else if (typefullname.Equals(typeof(Vector4).FullName))
                            {
                                Vector4 value;
                                attr.Read(out value);
                                showvalue.VarRNameValues.Add(key, value);
                            }
                            else if (typefullname.Equals(typeof(EngineNS.Color).FullName))
                            {
                                Vector4 value;
                                attr.Read(out value);
                                showvalue.VarRNameValues.Add(key, value);
                            }
                        }
                    }

                    int srvcount;
                    attr.Read(out srvcount);
                    //foreach (var srvvalue in showvalue.SRVRNameValues)
                    for (int srvn = 0; srvn < srvcount; srvn++)
                    {
                        string key;
                        RName  rname;
                        attr.Read(out key);
                        attr.Read(out rname);
                        showvalue.SRVRNameValues.Add(key, rname);
                    }

                    InitValueDatas.Add(showvalue);
                }
                attr.EndRead();
            }

            if (InitValueDatas.Count > 0)
            {
                ShowValues = InitValueDatas;
            }
        }