单人骑行

This commit is contained in:
lishuo committed 2021-03-30 17:27:50 +08:00
1 parent 326b74bd03
commit 971a6f7e0e
2597 files changed
+427802 -4

No files matched your search

@@ -0,0 +1,34 @@
namespace Mapbox.Editor
{
using UnityEngine;
using UnityEditor;
using Mapbox.Unity.Utilities;
using Mapbox.Unity.Map;
/// <summary>
/// Custom property drawer for geocodes <para/>
/// Includes a search window to enable search of Lat/Lon via geocoder.
/// Requires a Mapbox token be set for the project
/// </summary>
[CustomPropertyDrawer(typeof(GeocodeAttribute))]
public class GeocodeAttributeDrawer : PropertyDrawer
{
const string searchButtonContent = "Search";
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
float buttonWidth = EditorGUIUtility.singleLineHeight * 4;
Rect fieldRect = new Rect(position.x, position.y, position.width - buttonWidth, EditorGUIUtility.singleLineHeight);
Rect buttonRect = new Rect(position.x + position.width - buttonWidth, position.y, buttonWidth, EditorGUIUtility.singleLineHeight);
EditorGUI.PropertyField(fieldRect, property);
if (GUI.Button(buttonRect, searchButtonContent))
{
object objectToUpdate = EditorHelper.GetTargetObjectWithProperty(property);
GeocodeAttributeSearchWindow.Open(property, objectToUpdate);
}
}
}
}