public MapInfo[] GetAllMap() { List<MapInfo> infos = new List<MapInfo>(); SqlDataReader reader = null; try { db.GetReader(ref reader, "SP_Maps_All"); while (reader.Read()) { MapInfo info = new MapInfo(); info.BackMusic = reader["BackMusic"] == null ? "" : reader["BackMusic"].ToString(); info.BackPic = reader["BackPic"] == null ? "" : reader["BackPic"].ToString(); info.BackroundHeight = (int)reader["BackroundHeight"]; info.BackroundWidht = (int)reader["BackroundWidht"]; info.DeadHeight = (int)reader["DeadHeight"]; info.DeadPic = reader["DeadPic"] == null ? "" : reader["DeadPic"].ToString(); info.DeadWidth = (int)reader["DeadWidth"]; info.Description = reader["Description"] == null ? "" : reader["Description"].ToString(); info.DragIndex = (int)reader["DragIndex"]; info.ForegroundHeight = (int)reader["ForegroundHeight"]; info.ForegroundWidth = (int)reader["ForegroundWidth"]; info.ForePic = reader["ForePic"] == null ? "" : reader["ForePic"].ToString(); info.ID = (int)reader["ID"]; info.Name = reader["Name"] == null ? "" : reader["Name"].ToString(); info.Pic = reader["Pic"] == null ? "" : reader["Pic"].ToString(); info.Remark = reader["Remark"] == null ? "" : reader["Remark"].ToString(); info.Weight = (int)reader["Weight"]; info.PosX = reader["PosX"] == null ? "" : reader["PosX"].ToString(); info.PosX1 = reader["PosX1"] == null ? "" : reader["PosX1"].ToString(); info.Type = (byte)((int)reader["Type"]); infos.Add(info); } } catch (Exception e) { if (log.IsErrorEnabled) log.Error("GetAllMap", e); } finally { if (reader != null && !reader.IsClosed) reader.Close(); } return infos.ToArray(); }
public Map(MapInfo info, Tile layer1, Tile layer2) { _info = info; _objects = new HashSet<Physics>(); _layer1 = layer1; _layer2 = layer2; if (_layer1 != null) { _bound = new Rectangle(0, 0, _layer1.Width, _layer1.Height); } else { _bound = new Rectangle(0, 0, _layer2.Width, _layer2.Height); } }
public static XElement CreateMapInfo(MapInfo m) { return new XElement("Item", new XAttribute("ID", m.ID), new XAttribute("Name", m.Name == null ? "" : m.Name), new XAttribute("Description", m.Description == null ? "" : m.Description), new XAttribute("ForegroundWidth", m.ForegroundWidth), new XAttribute("ForegroundHeight", m.ForegroundHeight), new XAttribute("BackroundWidht", m.BackroundWidht), new XAttribute("BackroundHeight", m.BackroundHeight), new XAttribute("DeadWidth", m.DeadWidth), new XAttribute("DeadHeight", m.DeadHeight), new XAttribute("Weight", m.Weight), new XAttribute("DragIndex", m.DragIndex), new XAttribute("ForePic", m.ForePic == null ? "" : m.ForePic), new XAttribute("BackPic", m.BackPic == null ? "" : m.BackPic), new XAttribute("DeadPic", m.DeadPic == null ? "" : m.DeadPic), new XAttribute("Pic", m.Pic == null ? "" : m.Pic), new XAttribute("BackMusic", m.BackMusic == null ? "" : m.BackMusic), new XAttribute("Remark", m.Remark == null ? "" : m.Remark), new XAttribute("Type", m.Type)); }