tutorialview now only displays crosshairs when crosshair controls are enabled

This commit is contained in:
2019-01-09 22:50:59 +01:00
parent 45f7f61a5e
commit 1699082e09
6 changed files with 18 additions and 11 deletions

View File

@@ -379,7 +379,7 @@ GameObject:
m_IsActive: 1
--- !u!1 &1792505052625370
GameObject:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
@@ -606,6 +606,7 @@ MonoBehaviour:
reticuleHighlight: {fileID: 114430674035238108}
menuHighlight: {fileID: 114094662748965206}
selectHighlight: {fileID: 114425245405885838}
Crosshairs: {fileID: 1991900300183792}
--- !u!114 &114339554770605862
MonoBehaviour:
m_ObjectHideFlags: 1
@@ -1704,8 +1705,9 @@ RectTransform:
- {fileID: 224257449048418606}
- {fileID: 224385246327759096}
- {fileID: 224882127646750572}
- {fileID: 224543001454646402}
m_Father: {fileID: 224386065082169650}
m_RootOrder: 4
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -1743,7 +1745,6 @@ RectTransform:
- {fileID: 224893231122565744}
- {fileID: 224773095307896718}
- {fileID: 224336834733934388}
- {fileID: 224543001454646402}
- {fileID: 224374825834825260}
m_Father: {fileID: 0}
m_RootOrder: 0
@@ -1802,8 +1803,8 @@ RectTransform:
- {fileID: 224020227865350692}
- {fileID: 224770383868184822}
- {fileID: 224845810070959288}
m_Father: {fileID: 224386065082169650}
m_RootOrder: 3
m_Father: {fileID: 224374825834825260}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}

View File

@@ -12,7 +12,7 @@ namespace RothenburgAR.UI
public void Start()
{
Crosshairs.SetActive(DisplayManager.Instance.AllowCrosshairControls);
Crosshairs.SetActive(InputManager.Instance.AllowCrosshairControls);
}
public void DisplayPoiDetails(PoiBehaviour poi, bool animated = true)

View File

@@ -19,8 +19,7 @@ namespace RothenburgAR.UI
public readonly UnityEvent OnOrientationChange = new UnityEvent();
public ScreenOrientation ScreenOrientation;
private static readonly float CrosshairControlsDisplaySizeThreshold = 7f;
public bool AllowCrosshairControls { get; private set; }
public float ScreensizeInInches { get; set; }
private Vector2 lastKnownResolution; // Current Resolution
private ScreenOrientation orientation; // Current Screen Orientation
@@ -47,9 +46,8 @@ namespace RothenburgAR.UI
: ScreenOrientation.Landscape;
// Screen diagonal in logical inches
var diagonalIn = Mathf.Sqrt(Mathf.Pow(Screen.height, 2) + Mathf.Pow(Screen.width, 2)) / Screen.dpi;
Debug.Log("Screen Diagonal is something like " + diagonalIn + " inches.");
instance.AllowCrosshairControls = diagonalIn >= CrosshairControlsDisplaySizeThreshold;
instance.ScreensizeInInches = Mathf.Sqrt(Mathf.Pow(Screen.height, 2) + Mathf.Pow(Screen.width, 2)) / Screen.dpi;
Debug.Log("Screen Diagonal is approximately " + instance.ScreensizeInInches + " inches.");
}
private void Start()

View File

@@ -8,9 +8,14 @@ namespace RothenburgAR.UI
{
internal class InputManager : Singleton<InputManager>
{
public bool AllowCrosshairControls { get; private set; }
private static readonly float CrosshairControlsDisplaySizeThreshold = 7f;
internal void Initialize()
{
Input.simulateMouseWithTouches = false;
AllowCrosshairControls = DisplayManager.Instance.ScreensizeInInches >= CrosshairControlsDisplaySizeThreshold;
}
private void Update()

View File

@@ -8,12 +8,15 @@ namespace RothenburgAR.UI
public TutorialHighlightBehaviour reticuleHighlight;
public TutorialHighlightBehaviour menuHighlight;
public TutorialHighlightBehaviour selectHighlight;
public GameObject Crosshairs;
void OnEnable()
{
reticuleHighlight.SetText(LanguageManager.Instance.GetString("t_tutorial_reticule"));
menuHighlight.SetText(LanguageManager.Instance.GetString("t_tutorial_settings"));
selectHighlight.SetText(LanguageManager.Instance.GetString("t_tutorial_select"));
Crosshairs.SetActive(InputManager.Instance.AllowCrosshairControls);
}
void Update()

Binary file not shown.