Пример #1
0
        private void parseObjects(StreamReader r)
        {
            MapObject obj = null;

            while (!r.EndOfStream)
            {
                string line = r.ReadLine();
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }
                string[] spl = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (spl[0].Equals("MapObjType"))
                {
                    if (obj != null)
                    {
                        Map.AddObject(obj);
                    }
                    obj            = new MapObject();
                    obj.MapObjType = int.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("ProtoId"))
                {
                    obj.ProtoId = UInt16.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("MapX"))
                {
                    obj.MapX = UInt16.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("MapY"))
                {
                    obj.MapY = UInt16.Parse(spl[1]);
                    continue;
                }
                obj.Properties.Add(spl[0], spl[1]);
            }
            if (obj != null)
            {
                Map.AddObject(obj);
            }
        }
Пример #2
0
 public bool Exec(ushort hx, ushort hy)
 {
     fomap.AddObject(new MapObject(MapObjectType.Scenery, Config.ScrollblockerPID, hx, hy));
     return(false);
 }
Пример #3
0
        private void parseObjects(StreamReader r)
        {
            MapObject obj     = null;
            string    crIndex = null;

            while (!r.EndOfStream)
            {
                string line = r.ReadLine();
                if (String.IsNullOrEmpty(line))
                {
                    continue;
                }
                string[] spl = line.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

                if (spl[0].Equals("MapObjType"))
                {
                    if (obj != null)
                    {
                        Map.AddObject(obj);
                    }
                    obj            = new MapObject();
                    obj.MapObjType = int.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("ProtoId"))
                {
                    obj.ProtoId = UInt16.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("MapX"))
                {
                    obj.MapX = UInt16.Parse(spl[1]);
                    continue;
                }
                if (spl[0].Equals("MapY"))
                {
                    obj.MapY = UInt16.Parse(spl[1]);
                    continue;
                }

                if (spl[0].StartsWith("Critter_ParamIndex"))
                {
                    crIndex = spl[1];
                    continue;
                }
                if (spl[0].StartsWith("Critter_ParamValue"))
                {
                    if (!String.IsNullOrEmpty(crIndex))
                    {
                        obj.CritterParams.Add(crIndex, Int32.Parse(spl[1]));
                    }
                    continue;
                }

                if (!obj.Properties.ContainsKey(spl[0]))
                {
                    obj.Properties.Add(spl[0], spl[1]);
                }
                else
                {
                    obj.Properties[spl[0]] = spl[1];
                }
            }
            if (obj != null)
            {
                Map.AddObject(obj);
            }
        }