public GameMap Clone()
{
GameMap new_map = new GameMap(this.info);
new_map.mnWidth = this.mnWidth;
new_map.mnHeight = this.mnHeight;
new_map.mPath = new MapPath(mnHeight, mnWidth);
for (uint i = 0; i < mnHeight; i++)
{
for (uint j = 0; j < mnWidth; j++)
{
new_map.GetMapGridInfo()[j, i] = this.mMapGridInfo[j, i];
if (new_map.GetMapGridInfo()[j, i].Mask > 0)
{
new_map.mPath.SetPointMask((short)j, (short)i, MapPath.MASK_CLOSE);
}
}
}
foreach (BaseObject obj in this.GetAllObject().Values)
{
new_map.AddObject(obj, obj.GetGameSession());
}
return new_map;
}
//加入副本地图 public GameMap AddFubenMap(uint mapid) { GameMap map = this.GetGameMapToID(mapid); GameMap fb_map = null; if (map == null) { Log.Instance().WriteLog("创建副本地图失败,地图ID:" + mapid.ToString()); return(null);; } FubenGameMap fuben_map = null; if (m_DicFubenMap.ContainsKey(map.GetMapInfo().id)) { fuben_map = m_DicFubenMap[map.GetMapInfo().id]; } if (fuben_map == null) { fuben_map = new FubenGameMap(map.GetMapInfo().id); m_DicFubenMap[map.GetMapInfo().id] = fuben_map; }//从现有的副本中取出 else { } fb_map = fuben_map.GetFubenMap(); if (fb_map == null) { fb_map = map.Clone(); } return(fb_map); }