public void Load(EngineNS.IO.XndNode xndNode)
        {
            BezierPoints.Clear();
            var att = xndNode.FindAttrib("_bezierPts");

            if (att != null)
            {
                att.BeginRead();
                switch (att.Version)
                {
                case 0:
                {
                    int count;
                    att.Read(out count);
                    for (int i = 0; i < count; i++)
                    {
                        var bPt = att.ReadMetaObject() as BezierPoint;
                        if (bPt != null)
                        {
                            bPt.CalculateOpposite();
                            BezierPoints.Add(bPt);
                        }
                    }
                    att.Read(out mBezierWidth);
                    att.Read(out mBezierHeight);
                }
                break;
                }
                att.EndRead();
            }
        }
Exemplo n.º 2
0
            //public override void Write(XndNode xndNode)
            //{
            //    var att = xndNode.AddAttrib("ConstructionParams");
            //    att.Version = 0;
            //    att.BeginWrite();
            //    att.Write(ConstructParam);
            //    byte consType = (byte)ConstructType;
            //    att.Write(consType);
            //    att.WriteMetaObject(ParamInfo);
            //    att.EndWrite();
            //}
            public override void Read(EngineNS.IO.XndNode xndNode)
            {
                var att = xndNode.FindAttrib("ConstructionParams");

                if (att != null)
                {
                    att.BeginRead();
                    switch (att.Version)
                    {
                    case 0:
                        att.Read(out mConstructParam);
                        byte consType;
                        att.Read(out consType);
                        ConstructType = (CodeDomNode.MethodInvokeNode.enParamConstructType)consType;
                        if (ParamInfo == null)
                        {
                            ParamInfo = new CodeDomNode.MethodParamInfoAssist();
                        }
                        att.ReadMetaObject(ParamInfo);
                        break;

                    case 1:
                        att.ReadMetaObject(this);
                        break;
                    }
                    att.EndRead();
                }
            }
Exemplo n.º 3
0
        public async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            //Todo..
            var att = xndNode.FindAttrib("TransformDataCollect");

            att.BeginRead();

            int count = 0;

            att.Read(out count);
            for (int i = 0; i < count; i++)
            {
                var   data = new DataHelper();
                float offset;
                att.Read(out offset);
                data.offset = offset;
                Datas.Add(data);
            }
            att.EndRead();

            for (int i = 0; i < Datas.Count; i++)
            {
                var subatt = xndNode.FindAttrib("TransformDataCollect_Angle_" + i);
                if (subatt != null)
                {
                    if (subatt.Version == 0)
                    {
                        float Yaw, Pitch, Roll;
                        subatt.BeginRead();
                        subatt.Read(out Yaw);
                        subatt.Read(out Pitch);
                        subatt.Read(out Roll);
                        subatt.EndRead();
                        Datas[i].value.YawPitchRoll = new EngineNS.Vector3(Yaw, Pitch, Roll);
                    }
                }
                var node = xndNode.FindNode("TransformDataCollect_Placement_" + i);

                await Datas[i].value.Placement.LoadXnd(EngineNS.CEngine.Instance.RenderContext, Datas[i].value.Placement.Host, Datas[i].value.Placement.HostContainer, node);
            }
        }
Exemplo n.º 4
0
        partial void Load_WPF(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.FindAttrib("_commentNodeData_WPF");

            if (att != null)
            {
                switch (att.Version)
                {
                case 0:
                {
                    double width, height;
                    att.Read(out width);
                    att.Read(out height);
                    this.Width  = width;
                    this.Height = height;
                }
                break;
                }
            }
        }
Exemplo n.º 5
0
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            await base.Load(xndNode);

            if (mTemplateClassInstance != null)
            {
                var att = xndNode.FindAttrib("_funcDefParam");
                att.BeginRead();
                switch (att.Version)
                {
                case 0:
                    att.ReadMetaObject(mTemplateClassInstance);
                    break;

                case 1:
                    CodeGenerateSystem.Base.PropertyClassGenerator.LoadClassInstanceProperties(mTemplateClassInstance, att);
                    break;
                }
                att.EndRead();
            }
        }
Exemplo n.º 6
0
        public override async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            var att = xndNode.FindAttrib("tex2Ddata");

            if (att != null)
            {
                switch (att.Version)
                {
                case 0:
                {
                    att.BeginRead();
                    string name;
                    att.Read(out name);
                    TexturePath = EngineNS.RName.GetRName(name);
                    att.EndRead();
                }
                break;
                }
            }
            await base.Load(xndNode);
        }
Exemplo n.º 7
0
            //public override void Write(EngineNS.IO.XndNode xndNode)
            //{
            //    var att = xndNode.AddAttrib("ConstructionParams");
            //    att.Version = 0;
            //    att.BeginWrite();
            //    att.Write(ConstructParam);
            //    att.Write(IsGetRef);
            //    att.EndWrite();
            //}
            public override void Read(EngineNS.IO.XndNode xndNode)
            {
                var att = xndNode.FindAttrib("ConstructionParams");

                if (att != null)
                {
                    att.BeginRead();
                    switch (att.Version)
                    {
                    case 0:
                        att.Read(out mConstructParam);
                        bool getRet;
                        att.Read(out getRet);
                        IsGetRef = getRet;
                        break;

                    case 1:
                        att.ReadMetaObject(this);
                        break;
                    }
                    att.EndRead();
                }
            }
Exemplo n.º 8
0
        public virtual async System.Threading.Tasks.Task Load(EngineNS.IO.XndNode xndNode)
        {
            IsLoading = true;

            var att = xndNode.FindAttrib("Head");

            att.BeginRead();
            int ver = 0;

            att.Read(out ver);
            att.Read(out mGuid);
            att.EndRead();

            ClearControlNodes();

            switch (ver)
            {
            case 0:
            {
                // 读取节点信息并创建节点
                var childNodesCtrls = xndNode.FindNode("ChildNodesCtrls");
                if (childNodesCtrls == null)
                {
                    return;
                }
                var xndChildNodes = childNodesCtrls.GetNodes();
                foreach (var cldNode in xndChildNodes)
                //foreach (XmlElement element in doc.DocumentElement.ChildNodes)
                {
                    Type ctrlType = null;
                    ConstructionParams csParam = null;
                    var childAtt = cldNode.FindAttrib("_nodeHead");
                    switch (childAtt.Version)
                    {
                    case 0:
                    {
                        childAtt.BeginRead();
                        string typeSaveName;
                        childAtt.Read(out typeSaveName);
                        ctrlType = Program.GetNodeControlTypeFromSaveString(typeSaveName);                //  Program.GetType(xmlNode.FindAttrib("Type").Value);
                        string constructParam;
                        childAtt.Read(out constructParam);
                        childAtt.EndRead();
                        if (ctrlType == null)
                        {
                            continue;
                        }
                        csParam = new ConstructionParams()
                        {
                            CSType             = this.CSType,
                            HostNodesContainer = this,
                            ConstructParam     = constructParam,
                        };
                    }
                    break;

                    case 1:
                    {
                        childAtt.BeginRead();
                        string typeSaveName;
                        childAtt.Read(out typeSaveName);
                        ctrlType = Program.GetNodeControlTypeFromSaveString(typeSaveName);                //  Program.GetType(xmlNode.FindAttrib("Type").Value);
                        childAtt.EndRead();
                        if (ctrlType == null)
                        {
                            continue;
                        }
                        csParam                    = BaseNodeControl.CreateConstructionParam(ctrlType);
                        csParam.CSType             = this.CSType;
                        csParam.HostNodesContainer = this;
                        csParam.Read(cldNode);
                    }
                    break;
                    }

                    SetConstructionParams_WPF(csParam);
                    CodeGenerateSystem.Base.BaseNodeControl nodeControl = AddNodeControl(ctrlType, csParam, double.NaN, double.NaN);
                    await nodeControl.Load(cldNode);
                }

                // 读取完成后根据id设置一遍链接节点
                foreach (var node in mCtrlNodeList)
                {
                    node.ConstructLinkInfo(this);
                }
                //foreach (var node in mCtrlNodeList)
                //{
                //    node.InitializeUsefulLinkDatas();
                //}

                IsLoading = false;
                IsDirty   = false;
                RefreshNodeProperty(null, ENodeHandleType.UpdateNodeControl);

                var origionCtrlIdsAtt = xndNode.FindAttrib("OrigionCtrlIds");
                if (origionCtrlIdsAtt != null)
                {
                    origionCtrlIdsAtt.BeginRead();
                    int count;
                    origionCtrlIdsAtt.Read(out count);
                    for (int i = 0; i < count; i++)
                    {
                        Guid oriId;
                        origionCtrlIdsAtt.Read(out oriId);
                        var ctrl = FindControl(oriId);
                        if (ctrl != null)
                        {
                            mOrigionNodeControls.Add(ctrl);
                        }
                    }
                    origionCtrlIdsAtt.EndRead();
                }
            }
            break;
            }

            AfterLoad_WPF();
            for (int i = 0; i < CtrlNodeList.Count; ++i)
            {
                CtrlNodeList[i].ContainerLoadComplete(this);
            }
            // 加载完后检查节点错误
            CheckError();
        }