/// <summary> /// Loads the connected waypoints islands. /// </summary> /// <param name="waypoints">The waypoints.</param> /// <param name="connector">The connector.</param> public void LoadConnectedWaypointsIslands(String[] waypoints, IWaypointConnector connector) { if (waypoints == null || waypoints.Length == 0) { throw new Exception("MapName cannot be null"); } else if (connector.ConnectorType != ConnectorType.BETWEEN_COLLECTIONS_CONNECTEC) { throw new Exception("Wrong Type of Connector"); } int toadd = 0; foreach (var item in waypoints) { WaypointsCollection w = XmlContentLoader.LoadXmlContent(item, col.GetType()) as WaypointsCollection; foreach (Waypoint way in w.IdWaypoint.Values) { way.Id = way.Id + toadd; way.NeightBorWaypointsId = way.NeightBorWaypointsId.Select((p1, p2) => p1 + toadd).ToList <int>(); } IDictionary <int, Waypoint> xx = w.IdWaypoint.ToDictionary(t => t.Key + toadd, u => u.Value); w.IdWaypoint = new SerializableDictionary <int, Waypoint>(xx); toadd += w.IdWaypoint.Keys.Max(); this.col.IdWaypoint.Concate(w.IdWaypoint); } this.col = connector.ConnectWaypoints(col); }
/// <summary> /// Loads the unconnected waypoints. /// If it is connected, it will be unconnected /// </summary> /// <param name="FileName">Name of the file.</param> public void LoadUnconnectedWaypoints(String FileName) { if (FileName == null) { throw new Exception("MapName cannot be null"); } this.col = XmlContentLoader.LoadXmlContent(FileName, col.GetType()) as WaypointsCollection; if (col.State == WaypointsState.Connected) { Unconnect(); } }
/// <summary> /// Loads the connected waypoints from a file /// </summary> /// <param name="FileName">Name of the file.</param> public void LoadConnectedWaypoints(String FileName) { if (FileName == null) { throw new Exception("MapName cannot be null"); } this.col = XmlContentLoader.LoadXmlContent(FileName, col.GetType()) as WaypointsCollection; foreach (Waypoint item in col.GetWaypointsList()) { if (item.Id > id) { id = item.Id + 1; } } col.State = WaypointsState.Connected; }