Esempio n. 1
0
        public override XmlObject Export()
        {
            MapRegion data = new MapRegion
            {
                Id          = Id,
                Size        = Size,
                Center      = Position,
                EulerAngles = Euler,
                AllowFight  = AllowFight,
                AllowPK     = AllowPK,
                AllowRide   = AllowRide,
                AllowTrade  = AllowTrade,
                StartActive = StartActive
            };
            List <LevelEvent> pList = Events;

            for (int i = 0; i < pList.Count; i++)
            {
                data.Events.Add(pList[i].Export() as MapEvent);
            }
            return(data);
        }
Esempio n. 2
0
        private void InitLevelObject()
        {
            //触发区域
            for (int i = 0; i < Config.Regions.Count; i++)
            {
                MapRegion data = Config.Regions[i];
                if (data.StartActive)
                {
                    LevelElement pHolder = GetHolder(MapHolderType.Region);
                    GameObject   go      = pHolder.gameObject.AddChild();
                    LevelRegion  pRegion = go.AddComponent <LevelRegion>();
                    pRegion.Import(data, false);
                    pRegion.Init();
                }
            }

            //障碍物
            for (int i = 0; i < Config.Barriers.Count; i++)
            {
                MapBarrier   data     = Config.Barriers[i];
                LevelElement pHolder  = GetHolder(MapHolderType.Barrier);
                GameObject   go       = pHolder.gameObject.AddChild();
                LevelBarrier pBarrier = go.AddComponent <LevelBarrier>();
                pBarrier.Import(data, false);
                pBarrier.Init();
            }

            //传送门
            for (int i = 0; i < Config.Portals.Count; i++)
            {
                MapPortal    data    = Config.Portals[i];
                LevelElement pHolder = GetHolder(MapHolderType.Portal);
                GameObject   go      = pHolder.gameObject.AddChild();
                LevelPortal  pPortal = go.AddComponent <LevelPortal>();
                pPortal.Import(data, false);
                pPortal.Init();
            }
        }
Esempio n. 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;
                }
            }
        }