[TASK] Initial commit with basic product setup

This commit is contained in:
2019-08-18 13:50:14 +02:00
commit 01a66a8e1f
2548 changed files with 167528 additions and 0 deletions

View File

@@ -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);
}
}
}
}