private void RegisterButton(MapButton button, string placeholder, Context context) { if (button == null) { return; } UnityEngine.Events.UnityAction selectAction = () => SearchLocation(context); UnityEngine.Events.UnityAction clearAction = () => SetMarker(null, context); button.AddListener(selectAction, clearAction, placeholder); button.SetDisplayedText(placeholder, true); }
private void SetMarker(LocationMarker marker, Context context) { string displayedName = (marker != null ? marker.displayedName : ""); if (context == Context.SetDestination) { destinationMarker = marker; destinationMarkerButton.SetDisplayedText(displayedName, false); } else { originMarker = marker; originMarkerButton.SetDisplayedText(displayedName, false); } Navigate(); CloseContext(); }