private void OnCreateMarkerGUI() { EditorGUILayout.BeginVertical(GUI.skin.box); bool createMarker = pCreateMarkerInUserPosition.boolValue; if (createMarker) { EditorGUILayout.BeginHorizontal(); showCreateMarker = GUILayout.Toggle(showCreateMarker, "", EditorStyles.foldout, GUILayout.ExpandWidth(false), GUILayout.Height(16)); } pCreateMarkerInUserPosition.boolValue = GUILayout.Toggle(pCreateMarkerInUserPosition.boolValue, "Create Marker", toggleStyle); if (createMarker) { EditorGUILayout.EndHorizontal(); } if (pCreateMarkerInUserPosition.boolValue && showCreateMarker) { pMarkerType.enumValueIndex = EditorGUILayout.Popup("Type", pMarkerType.enumValueIndex, new[] { "2D", "3D" }); if (pMarkerType.enumValueIndex == (int)OnlineMapsLocationServiceMarkerType.threeD) { EditorGUILayout.PropertyField(pMarker3DPrefab, new GUIContent("Prefab")); } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(pMarker2DTexture, new GUIContent("Texture")); if (EditorGUI.EndChangeCheck() && pMarker2DTexture.objectReferenceValue != null) { OnlineMapsEditor.CheckMarkerTextureImporter(pMarker2DTexture); } EditorGUILayout.PropertyField(pMarker2DAlign, new GUIContent("Align")); } EditorGUILayout.PropertyField(pMarkerTooltip, new GUIContent("Tooltip")); EditorGUILayout.PropertyField(pUseCompassForMarker, new GUIContent("Use Compass")); if (pUseCompassForMarker.boolValue) { EditorGUILayout.PropertyField(pLerpCompassValueForMarker, new GUIContent("Lerp Compass Value")); } } EditorGUILayout.EndVertical(); }
private void OnCreateMarkerGUI() { EditorGUILayout.BeginVertical(GUI.skin.box); bool createMarker = ls.createMarkerInUserPosition; if (createMarker) { EditorGUILayout.BeginHorizontal(); showCreateMarker = GUILayout.Toggle(showCreateMarker, "", EditorStyles.foldout, GUILayout.ExpandWidth(false), GUILayout.Height(16)); } ls.createMarkerInUserPosition = GUILayout.Toggle(ls.createMarkerInUserPosition, "Create Marker", toggleStyle); if (createMarker) { EditorGUILayout.EndHorizontal(); } if (ls.createMarkerInUserPosition && showCreateMarker) { ls.markerType = (OnlineMapsLocationServiceMarkerType)EditorGUILayout.Popup("Type", (int)ls.markerType, new[] { "2D", "3D" }); if (ls.markerType == OnlineMapsLocationServiceMarkerType.threeD) { ls.marker3DPrefab = EditorGUILayout.ObjectField("Prefab", ls.marker3DPrefab, typeof(GameObject), false) as GameObject; } else { EditorGUI.BeginChangeCheck(); ls.marker2DTexture = EditorGUILayout.ObjectField("Texture", ls.marker2DTexture, typeof(Texture2D), false) as Texture2D; if (EditorGUI.EndChangeCheck() && ls.marker2DTexture != null) { OnlineMapsEditor.CheckMarkerTextureImporter(ls.marker2DTexture); } ls.marker2DAlign = (OnlineMapsAlign)EditorGUILayout.EnumPopup("Align", ls.marker2DAlign); } ls.markerTooltip = EditorGUILayout.TextField("Tooltip", ls.markerTooltip); ls.useCompassForMarker = EditorGUILayout.Toggle("Use Compass", ls.useCompassForMarker); } EditorGUILayout.EndVertical(); }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); EditorGUI.LabelField(position, label); try { Rect rect = new Rect(position.x, position.y, position.width, 16); EditorGUI.BeginChangeCheck(); SerializedProperty pLat = DrawProperty(property, "latitude", ref rect); if (EditorGUI.EndChangeCheck()) { #if UNITY_5_0P if (pLat.doubleValue < -90) { pLat.doubleValue = -90; } else if (pLat.doubleValue > 90) { pLat.doubleValue = 90; } #else if (pLat.floatValue < -90) { pLat.floatValue = -90; } else if (pLat.floatValue > 90) { pLat.floatValue = 90; } #endif } EditorGUI.BeginChangeCheck(); SerializedProperty pLng = DrawProperty(property, "longitude", ref rect); if (EditorGUI.EndChangeCheck()) { #if UNITY_5_0P if (pLng.doubleValue < -180) { pLng.doubleValue += 360; } else if (pLng.doubleValue > 180) { pLng.doubleValue -= 360; } #else if (pLng.floatValue < -180) { pLng.floatValue += 360; } else if (pLng.floatValue > 180) { pLng.floatValue -= 360; } #endif } DrawProperty(property, "range", ref rect, new GUIContent("Zooms")); EditorGUI.BeginChangeCheck(); SerializedProperty pRot = DrawProperty(property, "_rotation", ref rect, new GUIContent("Rotation (0-1)")); if (EditorGUI.EndChangeCheck()) { if (pRot.floatValue < 0 || pRot.floatValue > 1) { pRot.floatValue = Mathf.Repeat(pRot.floatValue, 1); } } DrawProperty(property, "_scale", ref rect); DrawProperty(property, "label", ref rect); DrawProperty(property, "align", ref rect); EditorGUI.BeginChangeCheck(); SerializedProperty pTexture = DrawProperty(property, "texture", ref rect); if (EditorGUI.EndChangeCheck()) { OnlineMapsEditor.CheckMarkerTextureImporter(pTexture); } rect.y += 18; if (GUI.Button(rect, "Remove")) { isRemoved = true; } } catch { } EditorGUI.EndProperty(); }