private OnlineMapsJSONItem SaveSettings() { return(OnlineMapsJSON.Serialize(new { speed })); }
private void OnSuggestComplete(string response) { Debug.Log(response); // Converts the response string from AutoSuggest or StandardBlend to result object. OnlineMapsWhat3WordsSBResult result = OnlineMapsWhat3Words.GetSuggestionsBlendsResult(response); Debug.Log(OnlineMapsJSON.Serialize(result).ToString()); }
private void OnGridComplete(string response) { Debug.Log(response); // Converts the response string from Grid to result object. OnlineMapsWhat3WordsGridResult result = OnlineMapsWhat3Words.GetGridResult(response); Debug.Log(OnlineMapsJSON.Serialize(result).ToString()); }
protected virtual OnlineMapsJSONItem SaveSettings() { return(OnlineMapsJSON.Serialize(new { allowZoom, allowUserControl, zoomInOnDoubleClick, smoothZoom })); }
private void OnReverseComplete(string response) { Debug.Log(response); // Converts the response string from Forward or Reverse geocoding to result object. OnlineMapsWhat3WordsFRResult result = OnlineMapsWhat3Words.GetForwardReverseResult(response); words = result.words; Debug.Log(OnlineMapsJSON.Serialize(result).ToString()); }
private void OnForwardComplete(string response) { Debug.Log(response); // Converts the response string from Forward or Reverse geocoding to result object. OnlineMapsWhat3WordsFRResult result = OnlineMapsWhat3Words.GetForwardReverseResult(response); OnlineMaps.instance.position = result.geometry; Debug.Log(OnlineMapsJSON.Serialize(result).ToString()); }
private void OnReverseGeocodeComplete(OnlineMapsWWW www) { if (www.hasError) { Debug.Log(www.error); return; } OnlineMapsJSONItem json = OnlineMapsJSON.Parse(www.text); Debug.Log(json["address/LongLabel"].V <string>()); }
public void Add(string name, object value) { if (value is string || value is bool || value is int || value is long || value is short || value is float || value is double) { _table[name] = new OnlineMapsJSONValue(value); } else if (value is UnityEngine.Object) { _table[name] = new OnlineMapsJSONValue((value as UnityEngine.Object).GetInstanceID()); } else { _table[name] = OnlineMapsJSON.Serialize(value); } }
private static void PlaymodeStateChanged(PlayModeStateChange playModeStateChange) #endif { if (!EditorApplication.isPlaying && !EditorApplication.isPlayingOrWillChangePlaymode) { if (Exists()) { #pragma warning disable 618 OnlineMaps map = ((OnlineMaps[])Object.FindSceneObjectsOfType(typeof(OnlineMaps))).FirstOrDefault(); #pragma warning restore 618 if (map != null) { try { IOnlineMapsSavableComponent[] savableComponents = map.GetComponents <IOnlineMapsSavableComponent>(); OnlineMapsSavableItem[] savableItems = savableComponents.SelectMany(c => c.GetSavableItems()).ToArray(); if (savableItems.Length != 0) { string prefs = EditorPrefs.GetString(prefsKey); OnlineMapsJSONObject json = OnlineMapsJSON.Parse(prefs) as OnlineMapsJSONObject; foreach (KeyValuePair <string, OnlineMapsJSONItem> pair in json.table) { OnlineMapsSavableItem savableItem = savableItems.FirstOrDefault(s => s.name == pair.Key); if (savableItem != null && savableItem.loadCallback != null) { savableItem.loadCallback(pair.Value as OnlineMapsJSONObject); } } } } catch (Exception ex) { Debug.LogException(ex); // ignored } EditorPrefs.DeleteKey(prefsKey); EditorUtility.SetDirty(map); } } if (EditorPrefs.HasKey("OnlineMapsRefreshAssets")) { EditorPrefs.DeleteKey("OnlineMapsRefreshAssets"); AssetDatabase.Refresh(); } } }
private OnlineMapsJSONItem SaveSettings() { return OnlineMapsJSON.Serialize(new { useMemoryCache, maxMemoryCacheSize, memoryCacheUnloadRate, useFileCache, maxFileCacheSize, fileCacheUnloadRate, fileCacheLocation, fileCacheCustomPath, fileCacheTilePath }); }
public virtual OnlineMapsJSONItem ToJSON() { return(OnlineMapsJSON.Serialize(new { longitude, latitude, range = new { range.min, range.max }, label, scale, enabled })); }
protected virtual OnlineMapsJSONItem SaveSettings() { OnlineMapsJSONObject json = OnlineMapsJSON.Serialize(new { autoStopUpdateOnInput, updatePosition, restoreAfter, createMarkerInUserPosition, useGPSEmulator }) as OnlineMapsJSONObject; if (createMarkerInUserPosition) { json.AppendObject(new { markerType, markerScale, markerTooltip, useCompassForMarker }); if (markerType == OnlineMapsLocationServiceMarkerType.twoD) { json.AppendObject(new { marker2DAlign, marker2DTexture }); } else { json.Add("marker3DPrefab", marker3DPrefab.GetInstanceID()); json.Add("marker3DSizeType", marker3DSizeType); } } if (useGPSEmulator) { json.AppendObject(new { emulatorPosition, emulatorCompass }); } return(json); }
/// <summary> /// Converts the response string to response object. /// </summary> /// <param name="response">Response string</param> /// <param name="outputType">Format of response string (JSON or XML)</param> /// <returns>Response object</returns> public static OnlineMapsBingMapsElevationResult GetResult(string response, Output outputType) { try { if (outputType == Output.json) { return(OnlineMapsJSON.Deserialize <OnlineMapsBingMapsElevationResult>(response)); } OnlineMapsXML xml = OnlineMapsXML.Load(response); if (!xml.isNull) { OnlineMapsBingMapsElevationResult result = new OnlineMapsBingMapsElevationResult(xml); return(result); } } catch {} return(null); }
private OnlineMapsJSONItem SaveSettings() { OnlineMapsJSONItem json = OnlineMapsJSON.Serialize(new { zoomRange, levelsRange, levelHeight, minHeight, heightScale, maxBuilding, maxActiveBuildings, generateColliders, useColorTag, materials }); return(json); }
private OnlineMapsJSONItem SaveSettings() { OnlineMapsJSONObject json = OnlineMapsJSON.Serialize(new { longitude, latitude, zoom = floatZoom, source, mapType, labels, traffic, redrawOnPlay, emptyColor, defaultTileTexture, tooltipBackgroundTexture, showMarkerTooltip, useSoftwareJPEGDecoder, useCurrentZoomTiles }) as OnlineMapsJSONObject; if (activeType.isCustom) { json.Add("customProviderURL", customProviderURL); } if (control.resultIsTexture) { defaultColors = texture.GetPixels(); json.Add("texture", texture); } else { json.AppendObject(new { width, height }); } return(json); }
private void OnGeocodeComplete(OnlineMapsWWW www) { if (www.hasError) { Debug.Log(www.error); return; } OnlineMapsJSONItem json = OnlineMapsJSON.Parse(www.text); OnlineMapsJSONItem firstItem = json["candidates/0"]; if (firstItem == null) { return; } OnlineMapsVector2d center = firstItem["location"].Deserialize <OnlineMapsVector2d>(); OnlineMapsJSONItem extent = firstItem["extent"]; double xmin = extent.V <double>("xmin"), ymin = extent.V <double>("ymin"), xmax = extent.V <double>("xmax"), ymax = extent.V <double>("ymax"); Vector2[] points = { new Vector2((float)xmin, (float)ymin), new Vector2((float)xmax, (float)ymax), }; Vector2 c; int zoom; OnlineMapsUtils.GetCenterPointAndZoom(points, out c, out zoom); OnlineMaps.instance.SetPositionAndZoom(center.x, center.y, zoom); }
/// <summary> /// Converts the response string to response object. /// </summary> /// <param name="response">Response string</param> /// <returns>Response Object</returns> public static OnlineMapsQQSearchResult GetResult(string response) { return(OnlineMapsJSON.Deserialize <OnlineMapsQQSearchResult>(response)); }
/// <summary> /// Parse a string that contains JSON dictonary /// </summary> /// <param name="json">String that contains JSON dictonary</param> /// <returns>Instance</returns> public static OnlineMapsJSONObject ParseObject(string json) { return(OnlineMapsJSON.Parse(json) as OnlineMapsJSONObject); }
/// <summary> /// Converts the response string from Get Languages to result object. /// </summary> /// <param name="response">Response string</param> /// <returns>Result object</returns> public static OnlineMapsWhat3WordsLanguagesResult GetLanguagesResult(string response) { return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsLanguagesResult>(response)); }
/// <summary> /// Converts the response string from AutoSuggest or StandardBlend to result object. /// </summary> /// <param name="response">Response string</param> /// <returns>Result object</returns> public static OnlineMapsWhat3WordsSBResult GetSuggestionsBlendsResult(string response) { return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsSBResult>(response)); }
/// <summary> /// Converts the response string from Forward or Reverse geocoding to result object. /// </summary> /// <param name="response">Response string.</param> /// <returns>Result object</returns> public static OnlineMapsWhat3WordsFRResult GetForwardReverseResult(string response) { return(OnlineMapsJSON.Deserialize <OnlineMapsWhat3WordsFRResult>(response)); }
/// <summary> /// Serialize an object into JSON object /// </summary> /// <param name="data">The object to be serialized</param> /// <returns>JSON object</returns> private OnlineMapsJSONItem Serialize(Data data) { return(OnlineMapsJSON.Serialize(data)); }
/// <summary> /// Parsing JSON string /// </summary> /// <param name="jsonString">JSON string</param> /// <returns>JSON object</returns> private OnlineMapsJSONItem Parse(string jsonString) { return(OnlineMapsJSON.Parse(jsonString)); }
/// <summary> /// Full deserialization of JSON string into an object /// </summary> /// <param name="jsonString">JSON string</param> private void FullDeserializationOfString(string jsonString) { Data data = OnlineMapsJSON.Deserialize <Data>(jsonString); Debug.Log(data.items.Length); }
/// <summary> /// Converts the response string from Open Route Service Geocoding to result object. /// </summary> /// <param name="response">Response string</param> /// <returns>Result object</returns> public static OnlineMapsOpenRouteServiceGeocodingResult GetGeocodingResults(string response) { return(OnlineMapsJSON.Deserialize <OnlineMapsOpenRouteServiceGeocodingResult>(response)); }
/// <summary> /// Parse JSON string into OnlineMapsJSONItem /// </summary> /// <param name="json">JSON string</param> /// <returns>Root object</returns> public static OnlineMapsJSONItem Parse(string json) { OnlineMapsJSON instance = new OnlineMapsJSON(json); return(instance.ParseValue()); }
private OnlineMapsJSONItem SaveSettings() { return(OnlineMapsJSON.Serialize(this)); }
/// <summary> /// Parse a string that contains an array /// </summary> /// <param name="json">JSON string</param> /// <returns>Instance</returns> public static OnlineMapsJSONArray ParseArray(string json) { return(OnlineMapsJSON.Parse(json) as OnlineMapsJSONArray); }
/// <summary> /// Parse JSON string into Dictonary, List and Object /// </summary> /// <param name="json">JSON string</param> /// <returns>Root object</returns> public static object ParseDirect(string json) { OnlineMapsJSON instance = new OnlineMapsJSON(json); return(instance.ParseValueDirect()); }
public override OnlineMapsJSONItem AppendObject(object obj) { Combine(OnlineMapsJSON.Serialize(obj)); return(this); }