Closing the Fullscreen Model View now displays the Details of the selected Poi again
This commit is contained in:
@@ -149,7 +149,7 @@ GameObject:
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
m_IsActive: 0
|
||||
--- !u!1 &1365754499144302
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 1
|
||||
@@ -1360,7 +1360,7 @@ MonoBehaviour:
|
||||
m_TargetGraphic: {fileID: 114013157313467306}
|
||||
m_HandleRect: {fileID: 224126681634059420}
|
||||
m_Direction: 2
|
||||
m_Value: 0.49999982
|
||||
m_Value: 0.49999964
|
||||
m_Size: 0.7254501
|
||||
m_NumberOfSteps: 0
|
||||
m_OnValueChanged:
|
||||
@@ -2152,8 +2152,8 @@ RectTransform:
|
||||
m_Father: {fileID: 224251385334151864}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchorMin: {x: 0, y: 0.1372749}
|
||||
m_AnchorMax: {x: 1, y: 0.862725}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 20, y: 20}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
@@ -2251,7 +2251,7 @@ RectTransform:
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: -0.000015258789}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 166.52002}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!224 &224272151730405692
|
||||
RectTransform:
|
||||
|
||||
@@ -57,7 +57,6 @@ namespace RothenburgAR.Exhibition
|
||||
{
|
||||
GuiText.GetComponent<LayoutElement>().enabled = false;
|
||||
GuiText.GetComponent<LayoutElement>().enabled = true;
|
||||
//StartCoroutine(CreateBorder());
|
||||
}
|
||||
|
||||
public void SetDescription(TextElement newDescription)
|
||||
@@ -101,49 +100,5 @@ namespace RothenburgAR.Exhibition
|
||||
}
|
||||
_descriptionPoiData.Description = newDescription;
|
||||
}
|
||||
|
||||
private IEnumerator CreateBorder()
|
||||
{
|
||||
yield return null; // wait for next frame so the borderContainer layouter has time to recalculate
|
||||
|
||||
var oldBorder = Background.GetComponentInChildren<LineRenderer>();
|
||||
if (oldBorder != null) Destroy(oldBorder.gameObject);
|
||||
|
||||
var borderContainer = new GameObject("BorderContainer");
|
||||
borderContainer.transform.SetParent(Background.transform, false);
|
||||
|
||||
var outlineRenderer = borderContainer.AddComponent<LineRenderer>();
|
||||
outlineRenderer.useWorldSpace = false;
|
||||
outlineRenderer.startWidth = 0.01f;
|
||||
outlineRenderer.endWidth = 0.01f;
|
||||
|
||||
Vector3[] corners = new Vector3[4];
|
||||
Background.GetComponent<RectTransform>().GetLocalCorners(corners);
|
||||
|
||||
//produces weird seam at begin/end point, so we'll loop it ourselves by drawing back to topLeft and topRight manually
|
||||
outlineRenderer.loop = false;
|
||||
|
||||
Vector3 topLeft = corners[1];
|
||||
Vector3 topRight = corners[2];
|
||||
Vector3 bottomLeft = corners[0];
|
||||
Vector3 bottomRight = corners[3];
|
||||
outlineRenderer.positionCount = 9;
|
||||
outlineRenderer.SetPosition(0, topLeft);
|
||||
outlineRenderer.SetPosition(1, topRight);
|
||||
outlineRenderer.SetPosition(2, bottomRight);
|
||||
outlineRenderer.SetPosition(3, bottomLeft);
|
||||
outlineRenderer.SetPosition(4, topLeft);
|
||||
outlineRenderer.SetPosition(5, bottomLeft);
|
||||
outlineRenderer.SetPosition(6, bottomRight);
|
||||
outlineRenderer.SetPosition(7, topRight);
|
||||
outlineRenderer.SetPosition(8, topLeft);
|
||||
|
||||
outlineRenderer.numCornerVertices = 2;
|
||||
outlineRenderer.numCapVertices = 1;
|
||||
|
||||
outlineRenderer.alignment = LineAlignment.Local;
|
||||
outlineRenderer.material = UIColorSchemeManager.Instance.GetUIMaterial(UIMaterial.BaseOpaque);
|
||||
outlineRenderer.enabled = GuiText.GetComponent<MeshRenderer>().enabled;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using UnityEngine;
|
||||
using RothenburgAR.PointOfInterest;
|
||||
using System.Collections;
|
||||
|
||||
namespace RothenburgAR.UI
|
||||
{
|
||||
@@ -8,7 +9,7 @@ namespace RothenburgAR.UI
|
||||
public DetailsPanelBehaviour DetailsPanel;
|
||||
public ProjectionEffectBehaviour ProjectionEffect;
|
||||
|
||||
public void DisplayPoiDetails(PoiBehaviour poi)
|
||||
public void DisplayPoiDetails(PoiBehaviour poi, bool animated = true)
|
||||
{
|
||||
// if POI has no Details to display, do nothing
|
||||
if (!PoiDataManager.Instance.HasPoiData(poi.ReferencedID)) return;
|
||||
@@ -28,14 +29,17 @@ namespace RothenburgAR.UI
|
||||
|
||||
DetailsPanel.DisplayModelButton(data);
|
||||
|
||||
DetailsPanel.UpdateOpeningAnimation(poi.transform.position);
|
||||
if (animated)
|
||||
{
|
||||
DetailsPanel.UpdateOpeningAnimation(poi.transform.position);
|
||||
}
|
||||
|
||||
poi.SetActive(true);
|
||||
|
||||
ProjectionEffect.SelectedPOI = poi.gameObject;
|
||||
ProjectionEffect.SetActive(true);
|
||||
}
|
||||
|
||||
|
||||
public void HidePoiDetails()
|
||||
{
|
||||
DetailsPanel.gameObject.SetActive(false);
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace RothenburgAR.UI
|
||||
|
||||
private void Start()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
DisplayManager.Instance.AddOrientationChangeListener(SetSize);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ using RothenburgAR.PointOfInterest;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using UnityEngine.EventSystems;
|
||||
using System.Linq;
|
||||
|
||||
namespace RothenburgAR.UI
|
||||
{
|
||||
@@ -13,11 +14,46 @@ namespace RothenburgAR.UI
|
||||
public GameObject Icon3D;
|
||||
|
||||
private GameObject _currentDisplayedModelGo;
|
||||
private PoiData currentPoiData;
|
||||
|
||||
public new void SwitchToARView()
|
||||
{
|
||||
UIManager.Instance.SwitchToView(ViewName.ARView);
|
||||
var arViewBehaviour = UIManager.Instance.ARViewBehaviour;
|
||||
|
||||
// Find poi and corresponding tracker
|
||||
var trackables = Vuforia.TrackerManager.Instance.GetStateManager().GetTrackableBehaviours().ToList();
|
||||
PoiBehaviour poiBehaviour = null;
|
||||
Vuforia.TrackableBehaviour trackable = null;
|
||||
foreach (var t in trackables)
|
||||
{
|
||||
var pois = t.GetComponentsInChildren<PoiBehaviour>().ToList();
|
||||
if (pois.Count == 0) continue;
|
||||
|
||||
poiBehaviour = pois.FirstOrDefault(p => p.ReferencedID == currentPoiData.ID);
|
||||
if (poiBehaviour != null)
|
||||
{
|
||||
trackable = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Display Poi Details if poi was found
|
||||
if (poiBehaviour == null) return;
|
||||
arViewBehaviour.DisplayPoiDetails(poiBehaviour, false);
|
||||
|
||||
// Disable Projection Effect if poi is not currently in view
|
||||
if (trackable.CurrentStatus != Vuforia.TrackableBehaviour.Status.TRACKED)
|
||||
{
|
||||
arViewBehaviour.ProjectionEffect.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetModelFromPoi(PoiData data)
|
||||
{
|
||||
if (!data.HasModelDescription) return;
|
||||
|
||||
this.currentPoiData = data;
|
||||
StartCoroutine("SetModelCoroutine", data);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user