コード例 #1
0
        public override XmlObject Export()
        {
            MapMineGroup data = new MapMineGroup
            {
                Id       = Id,
                RegionID = RegionID
            };

            for (int i = 0; i < Elements.Count; i++)
            {
                data.Mines.Add(Elements[i].Export() as MapMine);
            }
            return(data);
        }
コード例 #2
0
        public override void Import(XmlObject pData, bool pBuild)
        {
            MapMineGroup data = pData as MapMineGroup;

            Id = data.Id;
            HolderRegion pHolder = GameEntry.Level.GetHolder(MapHolderType.Region) as HolderRegion;

            if (pHolder != null)
            {
                this.Region = pHolder.FindElement(data.RegionID);
            }

            for (int i = 0; i < data.Mines.Count; i++)
            {
                GameObject go    = gameObject.AddChild();
                LevelMine  pMine = go.AddComponent <LevelMine>();
                pMine.Import(data.Mines[i], pBuild);
            }
            this.Build();
            this.SetName();
        }
コード例 #3
0
        public override void Read(XmlNode os)
        {
            foreach (XmlNode current in XmlObject.GetChilds(os))
            {
                switch (current.Name)
                {
                case "Id":
                    this.Id = ReadInt(current);
                    break;

                case "Delay":
                    this.Delay = ReadFloat(current);
                    break;

                case "MapName":
                    this.MapName = ReadString(current);
                    break;

                case "MapPath":
                    this.MapPath = ReadString(current);
                    break;

                case "AllowRide":
                    this.AllowRide = ReadBool(current);
                    break;

                case "AllowPK":
                    this.AllowPK = ReadBool(current);
                    break;

                case "AllowTrade":
                    this.AllowTrade = ReadBool(current);
                    break;

                case "AllowFight":
                    this.AllowFight = ReadBool(current);
                    break;

                case "Ally":
                    this.Ally = new MapBorn();
                    this.Ally.Read(current);
                    break;

                case "Enemy":
                    this.Enemy = new MapBorn();
                    this.Enemy.Read(current);
                    break;

                case "Neutral":
                    this.Neutral = new MapBorn();
                    this.Neutral.Read(current);
                    break;

                case "Barriers":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapBarrier data = new MapBarrier();
                        data.Read(pNode);
                        this.Barriers.Add(data);
                    });
                    break;

                case "Portals":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapPortal data = new MapPortal();
                        data.Read(pNode);
                        this.Portals.Add(data);
                    });
                    break;

                case "Regions":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapRegion data = ReadDynamicObject <MapRegion>(pNode);
                        this.Regions.Add(data);
                    });
                    break;

                case "MonsterGroups":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapMonsterGroup data = new MapMonsterGroup();
                        data.Read(pNode);
                        this.MonsterGroups.Add(data);
                    });
                    break;

                case "MineGroups":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapMineGroup data = new MapMineGroup();
                        data.Read(pNode);
                        this.MineGroups.Add(data);
                    });
                    break;

                case "WaveSets":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapWaveSet data = new MapWaveSet();
                        data.Read(pNode);
                        this.WaveSets.Add(data);
                    });
                    break;

                case "Npcs":
                    XmlObject.GetChilds(current).ForEach(delegate(XmlNode pNode)
                    {
                        MapNpc data = new MapNpc();
                        data.Read(pNode);
                        this.Npcs.Add(data);
                    });
                    break;
                }
            }
        }