public override void DidShow(MapAnnotation <LocationMarker> data) { base.DidShow(data); if (data.Data != null && data.Data.Information != null) { SetTitle(data.Data.Information.Title ?? data.Location.Name); SetSubtitle(data.Data.Information.Subtitle); if (InformationPane) { InformationPane.SetActive(true); if (InfoDescription) { InfoDescription.text = data.Data.Information.Description; } if (InfoImage) { ImageLoader.LoadImageOnMainThread(data.Data.Information.ImageUrl, InfoImage); } } } else { if (InformationPane) { InformationPane.SetActive(false); } } }
protected virtual void OnItemSelected(TaskItem item) { MapAnnotation annotation = null; // Hack for now if (item.Driver is LocationTaskDriver) { var lt = item.Driver as LocationTaskDriver; annotation = LocationTaskAnnotationHandler.Instance.GetNearestAnnotation(lt); } else if (item.Driver is ARTaskDriver) { var at = item.Driver as ARTaskDriver; annotation = ARTaskAnnotationHandler.Instance.GetNearestAnnotation(at); } Close(); if (annotation != null) { MapController.Instance.FocusAnnotation(annotation); } else { TodoManager.Instance.OverrideTodoTask(item.Driver); } }
public override void Populate(T data) { if (m_fence != null) { ForegroundPositionService.Instance.DiscardFence(m_fence); m_fence = null; } m_mapAnnotation = data; if (InformationPane) { InformationPane.SetActive(false); } SetTitle(data.Location.Name); SetSubtitle(data.Location.Subtitle); if (WayfindingCompass) { WayfindingCompass.SetPointAtLocation(data.Location); } base.Populate(data); // Pass annotation data to any components that use it. PopulateComponents(data.GetData()); }
public override void DidPush(MapAnnotation <LocationMarker> data) { base.DidPush(data); if (data.Data != null && data.Data.Information != null) { SetTitle(data.Data.Information.Title ?? data.Location.Name); SetSubtitle(data.Data.Information.Subtitle); if (InformationPane) { InformationPane.SetActive(true); if (InfoDescription) { InfoDescription.text = data.Data.Information.Description; } SetImage(InfoImageLayout, InfoImage, data.Data.Information.ImageUrl); } } else { if (InformationPane) { InformationPane.SetActive(false); } } }
private void ActivateAttraction(ResourceActivationContext ctxt, LocationAttractionActivator activator, LocationAttraction attraction) { ActivatedAttractionContext atctxt = null; if (!m_atrractionActivators.TryGetValue(attraction.Id, out atctxt)) { atctxt = new ActivatedAttractionContext(attraction); m_atrractionActivators.Add(attraction.Id, atctxt); var annotation = new MapAnnotation <ActivatedAttractionContext>(attraction.Locations.First(), atctxt); AddAnnotation(attraction.Id, annotation); var handlers = m_attractionItemHandlers[attraction.Id]; if (handlers != null) { foreach (var handler in handlers) { AttachHandlerToAttraction(atctxt, handler); } } } atctxt.AddActivator(ctxt, activator); }
public override AnnotationGameObject GetPrefabForAnnotation(MapAnnotation annotation) { var ann = annotation as LocativeAudioAnnotation; bool is3d = ann.LocativeAudio.Is3D; var checkAnn = is3d ? _3DAnnotationPrefab : _2DAnnotationPrefab; return(checkAnn != null ? checkAnn : AnnotationPrefab); }
public void RefreshCatalog() { WebServices.Instance.LoadCatalog <Location>(CatalogName, (catalog) => { m_locationCatalog = catalog; foreach (var location in m_locationCatalog) { var ann = new MapAnnotation(location); AddAnnotation(location.Id, ann); } }); }
internal void AddLocation3DAsset(Location3DAsset resource) { if (resource.Locations != null) { foreach (var l in resource.Locations) { var ann = new MapAnnotation <LocationMarker>(l); ann.AssetInstance = resource.AssetInstance; m_markerAnnotations.Add(resource.Id, ann); AddAnnotation(ann); } } }
internal void AddLocationMarker(string instanceId, LocationMarker marker) { if (marker.Locations != null) { foreach (var l in marker.Locations) { var ann = new MapAnnotation <LocationMarker>(l, marker); ann.Marker = marker.Marker; m_markerAnnotations.Add(instanceId, ann); AddAnnotation(ann); } } }
public override AnnotationGameObject GetObjectForAnnotation(MapAnnotation <LocationMarker> annotation) { if (annotation.Marker != null) { return(CreateMarkerAnnotation(annotation.Marker)); } else if (annotation.AssetInstance != null) { var parent = new GameObject("3D Marker"); var annotationObj = parent.AddComponent <AnnotationGameObject>(); UnityAssetLoader.LoadAsset(annotation.AssetInstance, parent); return(annotationObj); } return(base.GetObjectForAnnotation(annotation)); }
protected override void ConfigureAnnotationObject(MapAnnotation annotation, AnnotationGameObject obj) { var ann = annotation as LocativeAudioAnnotation; bool is3d = ann.LocativeAudio.Is3D; //var rangeImage = obj.RangeElement == null ? null : obj.RangeElement.GetComponent<SpriteRenderer>(); if (ann.LocativeAudio.DistanceRange != null && ann.LocativeAudio.DistanceRange.Max.HasValue) { obj.MonitorRange = true; obj.RangeDisplayMode = AnnotationRangeDisplayMode.Always; obj.Range = (float)ann.LocativeAudio.DistanceRange.Max.Value; obj.OutOfRangeColor = is3d ? _3DOutOfRangeColor : _2DOutOfRangeColor; obj.InRangeColor = is3d ? _3DInRangeColor : _2DInRangeColor; } else { obj.RangeDisplayMode = AnnotationRangeDisplayMode.Never; } }
/// <summary> /// Currently only used by AR collector, to make sure we use the same code path to show the /// location. Ultimately the goal here is to make sure we don't double-up the annotations /// for this location. /// </summary> /// <param name="e"></param> public void AddARCollectAnnotation(LocationSpawnItemDriverEventArgs <LocationValuablesCollection> e) { MapAnnotation ann = new MapAnnotation(e.Results.SourceLocation); var options = e.Results.SpawnItem.CollectOptions; DoubleRange actionRange = new DoubleRange(0, AutoCollectDistance); if (options != null && options.CollectRange != null) { actionRange = options.CollectRange; } ann.Delegate = new MapAnnotationDelegate { OnSelect = (_ann) => { if (ValuablesCollectionPanel) { ValuablesCollectionPanel.ValuablesCollection = e.Results.SpawnItem.ValuablesCollection; SelectedLocationPanelHandler.Instance.ShowSelectedLocationPanel(ValuablesCollectionPanel, _ann); ValuablesCollectionPanel.ShowARCollect(actionRange); } }, OnDeselect = (_ann) => { base.DeselectAnnotation(_ann); }, OnGetObjectForAnnotation = (_ann) => { return(CreateAnnotationObject(e.Results.SpawnItem)); } }; AddAnnotation(e.Results.SourceLocation.Id, ann); }
public void SpawnItem(LocationSpawnItemDriverEventArgs <LocationValuablesCollection> e, ILocationCollectionMechanic mechanic) { MapAnnotation ann = new MapAnnotation(e.Results.SourceLocation); var mapMechanic = mechanic as MapLocationCollectionMechanic; var options = e.Results.SpawnItem.CollectOptions; var action = mapMechanic == null ? null : mapMechanic.CollectAction; DoubleRange actionRange = new DoubleRange(0, AutoCollectDistance); if (options != null && options.CollectRange != null) { actionRange = options.CollectRange; } var actionType = (action == null) ? null : action.Type; bool collectWithPanel = false; // if no actionType is specified, defer to the AutoCollect setting if ((actionType == null && AutoCollectInRange) || (actionType != null && actionType == "motive.ar.inRangeLocationCollectionAction")) { m_triggerPool.WatchLocation(GetTriggerRequestId(e), e.Results.SourceLocation, () => { PlayCollectSound(mapMechanic); WorldValuablesManager.Instance.Collect(e); }, actionRange); } else { collectWithPanel = true; } ann.Delegate = new MapAnnotationDelegate { OnSelect = (_ann) => { if (ValuablesCollectionPanel) { ValuablesCollectionPanel.ValuablesCollection = e.Results.SpawnItem.ValuablesCollection; ValuablesCollectionPanel.OnAction = () => { RewardManager.Instance.ShowRewards(e.Results.SpawnItem.ValuablesCollection); PlayCollectSound(mapMechanic); WorldValuablesManager.Instance.Collect(e); }; SelectedLocationPanelHandler.Instance.ShowSelectedLocationPanel(ValuablesCollectionPanel, _ann); //if (collectWithPanel) { ValuablesCollectionPanel.ShowMapCollect(actionRange); } } }, OnDeselect = (_ann) => { base.DeselectAnnotation(_ann); }, OnGetObjectForAnnotation = (_ann) => { return(CreateAnnotationObject(e.Results.SpawnItem)); } }; AddAnnotation(e.Results.SourceLocation.Id, ann); }
public override void Populate(MapAnnotation <LocationTaskDriver> data) { base.Populate(data); if (data.Data != null) { m_driver = data.Data; string title; string description; string subtitle; var driverLocTitle = data.Data.Task.Title; title = (driverLocTitle != "") ? driverLocTitle : data.Location.Name; var character = data.Data.Task.Character; string charName = null; if (character != null) { charName = character.Alias; } if (charName != null) { subtitle = charName; if (!string.IsNullOrEmpty(data.Location.Name)) { subtitle += " at " + data.Location.Name; } } else { subtitle = data.Location.Name; } description = data.Data.Task.Description; if (InformationPane) { InformationPane.SetActive(true); } if (Title) { Title.text = title; } if (Subtitle) { Subtitle.text = subtitle; } if (Description) { Description.text = description; } ShowButton(m_driver.ShowActionButton, m_driver.ActionButtonText); if (m_driver.Task.ActionRange != null) { SetButtonFence(data.Location, m_driver.Task.ActionRange, m_driver.ActionButtonText, m_driver.OutOfRangeActionButtonText); } else { SetInRange(true); } } }