private void DrawMapTypes(ref bool dirty) { if (control != null && !control.useRasterTiles) { return; } if (pSource.enumValueIndex == (int)OnlineMapsSource.Resources) { return; } DrawProviderGUI(); if (mapType.provider.types.Length > 1) { GUIContent[] availableTypes = mapType.provider.types.Select(t => new GUIContent(t.title)).ToArray(); int index = mapType.index; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); index = EditorGUILayout.Popup(new GUIContent("Type", "Type of map texture"), index, availableTypes); if (EditorGUI.EndChangeCheck()) { mapType = mapType.provider.types[index]; pMapType.stringValue = mapType.ToString(); } OnlineMapsEditorUtils.HelpButton("Type (style) of the map"); EditorGUILayout.EndHorizontal(); } DrawProviderExtraFields(ref dirty, mapType.provider.extraFields); DrawProviderExtraFields(ref dirty, mapType.extraFields); DrawLabelsGUI(); }
private OnlineMaps CreateMapGameObject() { GameObject go; if (use3DControl == 1 && mapControl3D == 1) { go = GameObject.CreatePrimitive(PrimitiveType.Plane); } else { go = new GameObject("Map"); } OnlineMaps map = go.AddComponent <OnlineMaps>(); map.source = source; map.mapType = activeMapType.ToString(); map.webplayerProxyURL = webplayerProxyURL; map.labels = labels; map.customProviderURL = customProviderURL; map.language = language; map.traffic = traffic; map.redrawOnPlay = true; return(map); }
private void DrawProviderGUI() { EditorGUI.BeginChangeCheck(); providerIndex = EditorGUILayout.Popup("Provider", providerIndex, providersTitle); if (EditorGUI.EndChangeCheck()) { mapType = providers[providerIndex].types[0]; pMapType.stringValue = mapType.ToString(); } if (mapType.useHTTP) { EditorGUILayout.HelpBox(mapType.provider.title + " - " + mapType.title + " uses HTTP, which can cause problems in iOS9+.", MessageType.Warning); } else if (mapType.isCustom) { EditorGUILayout.PropertyField(pCustomProviderURL); EditorGUILayout.BeginVertical(GUI.skin.box); showCustomProviderTokens = Foldout(showCustomProviderTokens, "Available tokens"); if (showCustomProviderTokens) { GUILayout.Label("{zoom}"); GUILayout.Label("{x}"); GUILayout.Label("{y}"); GUILayout.Label("{quad}"); GUILayout.Space(10); } EditorGUILayout.EndVertical(); } }
private OnlineMaps CreateMapGameObject() { GameObject go = new GameObject("Map"); OnlineMaps map = go.AddComponent <OnlineMaps>(); map.source = source; map.mapType = activeMapType.ToString(); map.webplayerProxyURL = webplayerProxyURL; map.labels = labels; map.customProviderURL = customProviderURL; map.language = language; map.traffic = traffic; return(map); }
private void DrawProviderGUI() { EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); providerIndex = EditorGUILayout.Popup("Provider", providerIndex, providersTitle); if (EditorGUI.EndChangeCheck()) { mapType = providers[providerIndex].types[0]; pMapType.stringValue = mapType.ToString(); pActiveTypeSettings.stringValue = ""; } OnlineMapsEditorUtils.HelpButton("Tile provider.\nImportant: all tile presets are for testing purpose only. Before using the tile provider, make sure that it suits you by the terms of use and price."); EditorGUILayout.EndHorizontal(); if (mapType.useHTTP) { EditorGUILayout.HelpBox(mapType.provider.title + " - " + mapType.title + " uses HTTP, which can cause problems in iOS9+.", MessageType.Warning); } else if (mapType.isCustom) { EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginVertical(); GUILayout.Space(5); EditorGUILayout.PropertyField(pCustomProviderURL); EditorGUILayout.EndVertical(); if (GUILayout.Button(wizardIconContent, GUILayout.ExpandWidth(false))) { OnlineMapsCustomURLWizard.OpenWindow(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginVertical(GUI.skin.box); showCustomProviderTokens = Foldout(showCustomProviderTokens, "Available tokens"); if (showCustomProviderTokens) { GUILayout.Label("{zoom}"); GUILayout.Label("{x}"); GUILayout.Label("{y}"); GUILayout.Label("{quad}"); GUILayout.Space(10); } EditorGUILayout.EndVertical(); } }
private void DrawSourceGUI() { EditorGUI.BeginDisabledGroup(isPlay); EditorGUILayout.PropertyField(pSource); #if UNITY_WEBPLAYER || UNITY_WEBGL if (pSource.enumValueIndex != (int)OnlineMapsSource.Resources) { EditorGUILayout.PropertyField(pUseProxy, new GUIContent("Use Proxy")); EditorGUI.BeginDisabledGroup(!pUseProxy.boolValue); EditorGUILayout.PropertyField(pWebplayerProxyURL, new GUIContent("Proxy")); EditorGUI.EndDisabledGroup(); } #endif if (pSource.enumValueIndex != (int)OnlineMapsSource.Online) { if (GUILayout.Button("Fix Import Settings for Tiles")) { FixImportSettings(); } if (GUILayout.Button("Import from GMapCatcher")) { ImportFromGMapCatcher(); } EditorGUILayout.PropertyField(pResourcesPath); EditorGUILayout.BeginVertical(GUI.skin.box); showResourcesTokens = Foldout(showResourcesTokens, "Available Tokens"); if (showResourcesTokens) { GUILayout.Label("{zoom}"); GUILayout.Label("{x}"); GUILayout.Label("{y}"); GUILayout.Label("{quad}"); GUILayout.Space(10); } EditorGUILayout.EndVertical(); } EditorGUI.EndDisabledGroup(); if (pSource.enumValueIndex != (int)OnlineMapsSource.Resources) { DrawProviderGUI(); if (mapType.provider.types.Length > 1) { GUIContent[] availableTypes = mapType.provider.types.Select(t => new GUIContent(t.title)).ToArray(); int index = mapType.index; EditorGUI.BeginChangeCheck(); index = EditorGUILayout.Popup(new GUIContent("Type", "Type of map texture"), index, availableTypes); if (EditorGUI.EndChangeCheck()) { mapType = mapType.provider.types[index]; pMapType.stringValue = mapType.ToString(); } } DrawProviderExtraFields(); DrawLabelsGUI(); } }
private void DrawMapTypes(ref bool dirty) { if (control != null && !control.useRasterTiles) { return; } if (pSource.enumValueIndex == (int)OnlineMapsSource.Resources) { return; } if (pSource.enumValueIndex == (int)OnlineMapsSource.StreamingAssets) { return; } DrawProviderGUI(); if (mapType.provider.types.Length > 1) { GUIContent[] availableTypes = mapType.provider.types.Select(t => new GUIContent(t.title)).ToArray(); int index = mapType.index; EditorGUILayout.BeginHorizontal(); EditorGUI.BeginChangeCheck(); index = EditorGUILayout.Popup(new GUIContent("Type", "Type of map texture"), index, availableTypes); if (EditorGUI.EndChangeCheck()) { mapType = mapType.provider.types[index]; pMapType.stringValue = mapType.ToString(); } OnlineMapsEditorUtils.HelpButton("Type (style) of the map"); EditorGUILayout.EndHorizontal(); } DrawProviderExtraFields(ref dirty, mapType.provider.extraFields); DrawProviderExtraFields(ref dirty, mapType.extraFields); if (mapType.fullID == "google.satellite") { if (GUILayout.Button("Detect the latest version of tiles")) { WebClient client = new WebClient(); string response = client.DownloadString("http://maps.googleapis.com/maps/api/js"); Match match = Regex.Match(response, @"kh\?v=(\d+)"); if (match.Success) { OnlineMapsProvider.ExtraField version = mapType.extraFields.FirstOrDefault(f => { OnlineMapsProvider.ExtraField ef = f as OnlineMapsProvider.ExtraField; if (ef == null) { return(false); } if (ef.token != "version") { return(false); } return(true); }) as OnlineMapsProvider.ExtraField; if (version != null) { version.value = match.Groups[1].Value; } } } } DrawLabelsGUI(); }