コード例 #1
0
ファイル: Map.cs プロジェクト: Willyham/SagaRO2
        public Map(MapInfo info)
        {
            this.id = info.id;
            this.name = info.name;
            this.CattleyaMapID = info.CattleyaMapID;
            this.CattleyaX = info.CattleyaX;
            this.CattleyaY = info.CattleyaY;
            this.CattleyaZ = info.CattleyaZ;

            this.actorsByID = new Dictionary<uint, Actor>();
            this.actorsByRegion = new Dictionary<uint, List<Actor>>();
            this.pcByName = new Dictionary<string, ActorPC>();
            this.nextPcId = 1;
            this.nextNpcId = ID_BORDER + 1;
            this.nextItemId = ID_BORDER2 + 1;

            this.gTime = new GameTime();
            this.gTime.UpdateTime(1, 12, 0);

            this.weather = Global.WEATHER_TYPE.SUNNY;
            this.wTask = new SagaMap.Tasks.SystemTasks.DynamicWeather(this);
            this.wTask.Activate();

            if (info.heightmaps.Count > 0)
                this.hMap = new HeightMap(info.heightmaps[0]);
            else
                this.hMap = null;
        }
コード例 #2
0
ファイル: Map.cs プロジェクト: yasuhiro91/SagaECO
        public Map(MapInfo info)
        {
            this.id = info.id;
            this.name = info.name;

            this.actorsByID = new Dictionary<uint, Actor>();
            this.actorsByRegion = new Dictionary<uint, List<Actor>>();
            this.pcByName = new Dictionary<string, ActorPC>();
            this.nextPcId = 0x10;
            this.nextNpcId = ID_BORDER + 1;
            this.nextItemId = 0x100;
        }
コード例 #3
0
ファイル: ShipService.cs プロジェクト: Willyham/SagaRO2
 //10|2468.964|446.603|611.224
 public ShipService(byte orimapid, float[]dstpos, byte dstmapid, Actor ship)
 {
     this.dueTime = 1000;
     this.period = 1000;
     this.step = 0;
     this.substep = 0;
     MapManager.Instance.GetMap(orimapid, out orimap);
     MapManager.Instance.GetMap(dstmapid, out dstmap);
     this.dstpos = dstpos;
     this.shipActor = ship;
     this.mship = (Ship)ship.e;
     MapInfo info = new MapInfo();
     info.id = 10;
     info.name = "ship zone";
     info.heightmaps = new List<HeightMapInfo>();
     ShipMap = new Map(info);
     oriPassenger = new List<Actor>();
 }
コード例 #4
0
ファイル: MapManager.cs プロジェクト: Willyham/SagaRO2
        MapManager()
        {
            this.maps = new Dictionary<int, Map>();
            this.mapInfo = new Dictionary<int, MapInfo>();

            try { xml = new XmlParser("DB/MapInfo.xml"); }
            catch (Exception) { Logger.ShowError("cannot read the MapInfo.xml file.", null); return; }

            XmlNodeList XMLitems = xml.Parse("map");
            Logger.ShowInfo("MapInfo database contains " + XMLitems.Count + " maps.", null);

            for (int i = 0; i < XMLitems.Count; i++)
            {
                Dictionary<string, string> data = new Dictionary<string, string>();
                List<Dictionary<string, string>> heightmaps = new List<Dictionary<string,string>>();

                XmlNodeList childList = XMLitems.Item(i).ChildNodes;
                for (int j = 0; j < childList.Count; j++)
                {
                    if (childList.Item(j).Name.ToLower() == "heightmap")
                    {
                        Dictionary<string, string> tmp = new Dictionary<string,string>();
                        for (int k = 0; k < childList.Item(j).ChildNodes.Count; k++)
                            tmp.Add(childList.Item(j).ChildNodes.Item(k).Name.ToLower(), childList.Item(j).ChildNodes.Item(k).InnerText);
                        heightmaps.Add(tmp);
                    }
                    else
                        data.Add(childList.Item(j).Name.ToLower(), childList.Item(j).InnerText);

                }
                if (!data.ContainsKey("id")) continue;
                if (!data.ContainsKey("name")) continue;

                try
                {
                    MapInfo info = new MapInfo();
                    info.id = int.Parse(data["id"]);
                    info.name = data["name"];
                    if (data.ContainsKey("cattleyamapid"))
                    {
                        info.CattleyaMapID = int.Parse(data["cattleyamapid"]);
                        info.CattleyaX = float.Parse(data["cattleyax"]);
                        info.CattleyaY = float.Parse(data["cattleyay"]);
                        info.CattleyaZ = float.Parse(data["cattleyaz"]);
                    }

                    info.heightmaps = new List<HeightMapInfo>();

                    foreach(Dictionary<string,string> hmap in heightmaps)
                    {
                        try
                        {
                            HeightMapInfo tmpInf = new HeightMapInfo();

                            tmpInf.name = hmap["name"];
                            tmpInf.size = int.Parse(hmap["size"]);
                            tmpInf.location = new float[3];
                            tmpInf.location[0] = float.Parse(hmap["x"]);
                            tmpInf.location[1] = float.Parse(hmap["y"]);
                            tmpInf.location[2] = float.Parse(hmap["z"]);
                            tmpInf.scale = new int[3];
                            tmpInf.scale[0] = int.Parse(hmap["scale-x"]);
                            tmpInf.scale[1] = int.Parse(hmap["scale-y"]);
                            tmpInf.scale[2] = int.Parse(hmap["scale-z"]);
                            if (hmap.ContainsKey("waterlevel")) tmpInf.water_level = float.Parse(hmap["waterlevel"]);

                            info.heightmaps.Add(tmpInf);

                        }
                        catch (Exception ex) {
                            Logger.ShowError("Cannot read heightmap info", null);
                            Logger.ShowError(ex, null);
                        }
                    }

                    this.mapInfo.Add(info.id, info);
                }
                catch (Exception e) { Logger.ShowError(" cannot parse mapInfo of map: " + data["id"], null); Logger.ShowError(e, null); continue; }
            }
            xml = null;
        }