Esempio n. 1
0
        void loadScriptFromDiskInternal(string filename)
        {
            newScript();

            MapTreeNodeXML xmlRoot = EditorCore.Controls.Micro.BaseLoader <MapTreeNodeXML> .Load(filename);

            mRootNode.mGLSFileToUse = xmlRoot.mGLSFileToUse;

            for (int i = 0; i < xmlRoot.mActionNodes.Count; i++)
            {
                ActionTreeNode atn = new ActionTreeNode(treeView1, mRootNode);


                atn.mMaskGenNode.Mask.GraphMemStream.Write(xmlRoot.mActionNodes[i].mMaskGenNode, 0, xmlRoot.mActionNodes[i].mMaskGenNode.Length);
                atn.mMaskGenNode.Mask.GraphMemStream.Position = 0;

                atn.Text = xmlRoot.mActionNodes[i].mText;
                for (int k = 0; k < xmlRoot.mActionNodes[i].mObjectNodes.Count; k++)
                {
                    ApplyObjectTreeNode objtn = new ApplyObjectTreeNode();

                    objtn.mData = xmlRoot.mActionNodes[i].mObjectNodes[k];
                    atn.Nodes.Add(objtn);
                }

                for (int k = 0; k < xmlRoot.mActionNodes[i].mTextureNodes.Count; k++)
                {
                    ApplyTextureTreeNode objtn = new ApplyTextureTreeNode();

                    objtn.mData = xmlRoot.mActionNodes[i].mTextureNodes[k];
                    atn.Nodes.Add(objtn);
                }

                for (int k = 0; k < xmlRoot.mActionNodes[i].mTransformNodes.Count; k++)
                {
                    ApplyTransformTreeNode objtn = new ApplyTransformTreeNode();

                    objtn.mData = xmlRoot.mActionNodes[i].mTransformNodes[i];
                    atn.Nodes.Add(objtn);
                }


                mRootNode.Nodes.Add(atn);
            }
        }
Esempio n. 2
0
        void saveScriptToDiskInternal(string filename)
        {
            MapTreeNodeXML xmlRoot = new MapTreeNodeXML();

            xmlRoot.mGLSFileToUse = mRootNode.mGLSFileToUse;
            for (int i = 0; i < mRootNode.Nodes.Count; i++)
            {
                if (mRootNode.Nodes[i] is ActionTreeNode)
                {
                    ActionTreeNode    atn  = mRootNode.Nodes[i] as ActionTreeNode;
                    ActionTreeNodeXML atnx = new ActionTreeNodeXML();

                    atnx.mMaskGenNode = atn.mMaskGenNode.Mask.GraphMemStream.ToArray();
                    atnx.mText        = atn.Text;

                    for (int k = 0; k < atn.Nodes.Count; k++)
                    {
                        if (atn.Nodes[k] is ApplyObjectTreeNode)
                        {
                            ApplyObjectTreeNode objtn = atn.Nodes[k] as ApplyObjectTreeNode;
                            atnx.mObjectNodes.Add(objtn.mData);
                        }
                        else if (atn.Nodes[k] is ApplyTextureTreeNode)
                        {
                            ApplyTextureTreeNode objtn = atn.Nodes[k] as ApplyTextureTreeNode;
                            atnx.mTextureNodes.Add(objtn.mData);
                        }
                        else if (atn.Nodes[k] is ApplyTransformTreeNode)
                        {
                            ApplyTransformTreeNode objtn = atn.Nodes[k] as ApplyTransformTreeNode;
                            atnx.mTransformNodes.Add(objtn.mData);
                        }
                    }

                    xmlRoot.mActionNodes.Add(atnx);
                }
            }
            EditorCore.Controls.Micro.BaseLoader <MapTreeNodeXML> .Save(filename, xmlRoot);
        }