/// <summary> /// Loading saved state. /// </summary> private void LoadState() { if (!PlayerPrefs.HasKey(key)) { return; } OnlineMaps map = OnlineMaps.instance; OnlineMapsXML prefs = OnlineMapsXML.Load(PlayerPrefs.GetString(key)); OnlineMapsXML generalSettings = prefs["General"]; map.position = generalSettings.Get <Vector2>("Coordinates"); map.zoom = generalSettings.Get <int>("Zoom"); List <OnlineMapsMarker> markers = new List <OnlineMapsMarker>(); OnlineMapsMarkerManager.SetItems(markers); }
public static void UpdateMarkers() { double tlx, tly, brx, bry; GetCorners(out tlx, out tly, out brx, out bry); if (markers == null) { markers = new List <OnlineMapsMarker>(); } rootCluster.GetMarkers(tlx, tly, brx, bry, ref markers); markers.AddRange(unclusteredMarkers); OnlineMapsMarker[] prevMarkers = OnlineMapsMarkerManager.instance.items.ToArray(); OnlineMapsMarker[] newMarkers = markers.ToArray(); markers.Clear(); for (int i = 0; i < prevMarkers.Length; i++) { OnlineMapsMarker m = prevMarkers[i]; for (int j = 0; j < newMarkers.Length; j++) { OnlineMapsMarker m2 = newMarkers[j]; if (m == m2) { break; } } } OnlineMapsMarkerManager.SetItems(newMarkers); double tx, ty; map.GetTilePosition(out tx, out ty); mapTileX = (int)tx; mapTileY = (int)ty; needUpdate = false; }