Пример #1
0
        private void loadFloor(LHGStage stage, LHGStage.StageSection position, XmlNode childNode)
        {
            string texture = childNode.Attributes["texture"].Value;
            int    i       = Convert.ToInt16(childNode.Attributes["row"].Value);
            int    j       = Convert.ToInt16(childNode.Attributes["col"].Value);

            stage.addFloor(position, texture, i, j);
        }
Пример #2
0
        private void loadBackground(LHGStage stage, LHGStage.StageSection position, XmlNode childNode)
        {
            string texture = childNode.Attributes["texture"].Value;
            int    i       = Convert.ToInt16(childNode.Attributes["row"].Value);
            int    j       = Convert.ToInt16(childNode.Attributes["col"].Value);
            int    zOrder  = Convert.ToInt16(childNode.Attributes["zOrder"].Value);

            stage.addBackground(position, texture, i, j, zOrder);
        }
Пример #3
0
        private void loadSection(LHGStage stage, LHGStage.StageSection section, XmlNode sectionNode)
        {
            XmlNodeList sectionChildren = sectionNode.ChildNodes;

            foreach (XmlNode childNode in sectionChildren)
            {
                switch (childNode.Name)
                {
                case "background":
                    loadBackground(stage, section, childNode);
                    break;

                case "floor":
                    loadFloor(stage, section, childNode);
                    break;
                }
            }
        }
Пример #4
0
        public LHGStage loadStage(XmlNode stageNode)
        {
            LHGStage    stage         = null;
            XmlNodeList stageChildren = stageNode.ChildNodes;

            foreach (XmlNode childNode in stageChildren)
            {
                switch (childNode.Name)
                {
                case "dimensions":
                    int cellSize = 0, backgroundHeight = 0, floorHeight = 0, leftWidth = 0, centerWidth = 0, rightWidth = 0;
                    if (loadDimensions(childNode, ref cellSize, ref backgroundHeight, ref floorHeight, ref leftWidth, ref centerWidth, ref rightWidth))
                    {
                        stage = new LHGStage(this.lhg, cellSize, backgroundHeight, floorHeight, leftWidth, centerWidth, rightWidth);
                    }
                    break;

                case "left":
                    if (stage != null)
                    {
                        loadSection(stage, LHGStage.StageSection.Left, childNode);
                    }
                    break;

                case "center":
                    if (stage != null)
                    {
                        loadSection(stage, LHGStage.StageSection.Center, childNode);
                    }
                    break;

                case "right":
                    if (stage != null)
                    {
                        loadSection(stage, LHGStage.StageSection.Right, childNode);
                    }
                    break;
                }
            }

            return(stage);
        }