/// <summary> /// Adds map node to the json /// </summary> /// <param name="data">Json object where data will be added</param> /// <param name="scenarioMap">Scenario map to serialize</param> private static void AddMapNode(JSONObject data, ScenarioMapManager.MapMetaData scenarioMap) { var mapNode = new JSONObject(); data.Add("map", mapNode); mapNode.Add("id", new JSONString(scenarioMap.guid)); mapNode.Add("name", new JSONString(scenarioMap.name)); mapNode.Add("parameterType", new JSONString("map")); }
/// <summary> /// Method called when new map is loaded /// </summary> /// <param name="mapData">Loaded map data</param> private void OnMapChanged(ScenarioMapManager.MapMetaData mapData) { for (var i = navOrigins.Count - 1; i >= 0; i--) { var navOrigin = navOrigins[i]; navOrigin.RemoveFromMap(); navOrigin.Dispose(); } navOrigins.Clear(); mapNavOriginsPositions.Clear(); LoadMapNavOrigins(); }
/// <summary> /// Method called when new map is loaded /// </summary> /// <param name="mapMetaData">The loaded map meta data</param> /// <exception cref="ArgumentException">There is no button corresponding to the loaded map</exception> private void OnMapLoaded(ScenarioMapManager.MapMetaData mapMetaData) { if (currentMapButton != null) { currentMapButton.UnmarkCurrent(); } var mapCorrespondingButton = buttons.Find((button) => button.MapName == mapMetaData.name); if (mapCorrespondingButton == null) { throw new ArgumentException("Could not find button corresponding to loaded map."); } mapCorrespondingButton.MarkAsCurrent(); currentMapButton = mapCorrespondingButton; }