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")); EditorGUILayout.PropertyField(pMarker3DSizeType, new GUIContent("Size Type")); } else { EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(pMarker2DTexture, new GUIContent("Texture")); if (EditorGUI.EndChangeCheck() && pMarker2DTexture.objectReferenceValue != null) { OnlineMapsEditorUtils.CheckMarkerTextureImporter(pMarker2DTexture); } EditorGUILayout.PropertyField(pMarker2DAlign, new GUIContent("Align")); } EditorGUILayout.PropertyField(pMarkerTooltip, new GUIContent("Tooltip")); EditorGUILayout.PropertyField(pMarkerScale, new GUIContent("Scale")); EditorGUILayout.PropertyField(pUseCompassForMarker, new GUIContent("Use Compass")); if (pUseCompassForMarker.boolValue) { EditorGUILayout.PropertyField(pLerpCompassValueForMarker, new GUIContent("Lerp Compass Value")); } } EditorGUILayout.EndVertical(); }
protected override void DrawSettings(ref bool dirty) { base.DrawSettings(ref dirty); EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck(); EditorGUILayout.PropertyField(defaultTexture); if (EditorGUI.EndChangeCheck()) { OnlineMapsEditorUtils.CheckMarkerTextureImporter(defaultTexture); } EditorGUILayout.PropertyField(defaultAlign); EditorGUILayout.PropertyField(allowAddMarkerByM, new GUIContent("Add Marker by M")); if (EditorGUI.EndChangeCheck()) { dirty = true; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { EditorGUI.BeginProperty(position, label, property); try { Rect rect = new Rect(position.x, position.y, position.width, 16); if (!DrawHeader(label, rect, property)) { EditorGUI.EndProperty(); return; } EditorGUI.BeginChangeCheck(); SerializedProperty pLat = DrawProperty(property, "latitude", ref rect); if (EditorGUI.EndChangeCheck()) { if (pLat.doubleValue < -90) { pLat.doubleValue = -90; } else if (pLat.doubleValue > 90) { pLat.doubleValue = 90; } } EditorGUI.BeginChangeCheck(); SerializedProperty pLng = DrawProperty(property, "longitude", ref rect); if (EditorGUI.EndChangeCheck()) { if (pLng.doubleValue < -180) { pLng.doubleValue += 360; } else if (pLng.doubleValue > 180) { pLng.doubleValue -= 360; } } 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()) { OnlineMapsEditorUtils.CheckMarkerTextureImporter(pTexture); } DrawCenterButton(rect, pLng, pLat); } catch { } EditorGUI.EndProperty(); }