//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);
        }
예제 #2
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);
            }
        }
예제 #3
0
        public override async System.Threading.Tasks.Task Load(XndNode xndNode)
        {
            //if (NeedInitGrapth)
            //{
            //    var test = InitGraph();
            //}
            //await AwaitLoad();
            await ParticleDataSaveLoad.LoadData("ParticleVelocityByCenter", xndNode, CSParam as ParticleVelocityByCenterControlConstructionParams, this, mLinkedNodesContainer);

            await base.Load(xndNode);

            await DataGradient.Load(xndNode);
        }
        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;
            }
        }