Implemented second Version of automatically scaling Exhibit title
This commit is contained in:
@@ -19,7 +19,7 @@ RenderTexture:
|
|||||||
m_MipMap: 1
|
m_MipMap: 1
|
||||||
m_GenerateMips: 1
|
m_GenerateMips: 1
|
||||||
m_SRGB: 1
|
m_SRGB: 1
|
||||||
m_UseDynamicScale: 1
|
m_UseDynamicScale: 0
|
||||||
m_BindMS: 0
|
m_BindMS: 0
|
||||||
m_TextureSettings:
|
m_TextureSettings:
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ Material:
|
|||||||
m_PrefabParentObject: {fileID: 0}
|
m_PrefabParentObject: {fileID: 0}
|
||||||
m_PrefabInternal: {fileID: 0}
|
m_PrefabInternal: {fileID: 0}
|
||||||
m_Name: UIBaseOpaque
|
m_Name: UIBaseOpaque
|
||||||
m_Shader: {fileID: 4800000, guid: 3a1c68c8292caf046bd21158886c5e40, type: 3}
|
m_Shader: {fileID: 10782, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ALPHAPREMULTIPLY_ON _SPECULARHIGHLIGHTS_OFF
|
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA _ALPHAPREMULTIPLY_ON _SPECULARHIGHLIGHTS_OFF
|
||||||
_SUNDISK_HIGH_QUALITY
|
_SUNDISK_HIGH_QUALITY
|
||||||
m_LightmapFlags: 4
|
m_LightmapFlags: 4
|
||||||
m_EnableInstancingVariants: 0
|
m_EnableInstancingVariants: 0
|
||||||
m_DoubleSidedGI: 0
|
m_DoubleSidedGI: 0
|
||||||
m_CustomRenderQueue: 3000
|
m_CustomRenderQueue: -1
|
||||||
stringTagMap: {}
|
stringTagMap: {}
|
||||||
disabledShaderPasses: []
|
disabledShaderPasses: []
|
||||||
m_SavedProperties:
|
m_SavedProperties:
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ MonoBehaviour:
|
|||||||
m_Calls: []
|
m_Calls: []
|
||||||
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
|
||||||
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
m_text: THIS IS MY TITLE
|
m_text: Title
|
||||||
m_isRightToLeft: 0
|
m_isRightToLeft: 0
|
||||||
m_fontAsset: {fileID: 11400000, guid: 715b80e429c437e40867928a4e1fc975, type: 2}
|
m_fontAsset: {fileID: 11400000, guid: 715b80e429c437e40867928a4e1fc975, type: 2}
|
||||||
m_sharedMaterial: {fileID: 2180264, guid: 715b80e429c437e40867928a4e1fc975, type: 2}
|
m_sharedMaterial: {fileID: 2180264, guid: 715b80e429c437e40867928a4e1fc975, type: 2}
|
||||||
@@ -292,10 +292,10 @@ MonoBehaviour:
|
|||||||
m_margin: {x: 0.02, y: 0.02, z: 0.02, w: 0.02}
|
m_margin: {x: 0.02, y: 0.02, z: 0.02, w: 0.02}
|
||||||
m_textInfo:
|
m_textInfo:
|
||||||
textComponent: {fileID: 114580846098669954}
|
textComponent: {fileID: 114580846098669954}
|
||||||
characterCount: 16
|
characterCount: 5
|
||||||
spriteCount: 0
|
spriteCount: 0
|
||||||
spaceCount: 3
|
spaceCount: 0
|
||||||
wordCount: 4
|
wordCount: 1
|
||||||
linkCount: 0
|
linkCount: 0
|
||||||
lineCount: 1
|
lineCount: 1
|
||||||
pageCount: 1
|
pageCount: 1
|
||||||
@@ -330,12 +330,12 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
m_IgnoreLayout: 0
|
m_IgnoreLayout: 0
|
||||||
m_MinWidth: 1
|
m_MinWidth: 0.5
|
||||||
m_MinHeight: -1
|
m_MinHeight: -1
|
||||||
m_PreferredWidth: -1
|
m_PreferredWidth: -1
|
||||||
m_PreferredHeight: -1
|
m_PreferredHeight: -1
|
||||||
m_FlexibleWidth: -1
|
m_FlexibleWidth: -1
|
||||||
m_FlexibleHeight: 1000
|
m_FlexibleHeight: -1
|
||||||
m_LayoutPriority: 1
|
m_LayoutPriority: 1
|
||||||
--- !u!114 &114807976848859904
|
--- !u!114 &114807976848859904
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
|
|||||||
@@ -40,15 +40,15 @@ namespace RothenburgAR.Exhibition
|
|||||||
TitleBehaviour.Exhibit = this;
|
TitleBehaviour.Exhibit = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO remove title rotation
|
||||||
if (newTitle.Rotation.HasValue)
|
if (newTitle.Rotation.HasValue)
|
||||||
TitleBehaviour.transform.localEulerAngles = newTitle.Rotation.Value + new Vector3(90, 0, 0);
|
TitleBehaviour.transform.localEulerAngles = newTitle.Rotation.Value + new Vector3(90, 0, 0);
|
||||||
|
|
||||||
|
//TODO remove title position and calculate on the fly? if tracker is on a wall, below is best. if it sits on the ground, what?
|
||||||
if (newTitle.Position.HasValue)
|
if (newTitle.Position.HasValue)
|
||||||
TitleBehaviour.transform.localPosition = newTitle.Position.Value;
|
TitleBehaviour.transform.localPosition = newTitle.Position.Value;
|
||||||
|
|
||||||
TitleBehaviour.FontSize = newTitle.FontSize;
|
//TODO set scale to resize the title relative to tracker size
|
||||||
TitleBehaviour.BoxHeight = newTitle.BoxHeight;
|
|
||||||
TitleBehaviour.BoxWidth = newTitle.BoxWidth;
|
|
||||||
TitleBehaviour.DataText = newTitle.Text;
|
TitleBehaviour.DataText = newTitle.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using RothenburgAR.UI;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using TMPro;
|
using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
namespace RothenburgAR.Exhibition
|
namespace RothenburgAR.Exhibition
|
||||||
{
|
{
|
||||||
@@ -32,28 +33,14 @@ namespace RothenburgAR.Exhibition
|
|||||||
set { this.GuiText.fontSize = value; }
|
set { this.GuiText.fontSize = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public float BoxWidth
|
|
||||||
{
|
|
||||||
get { return this.GuiRect.rect.width; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
UpdateRect(value, BoxHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public float BoxHeight
|
|
||||||
{
|
|
||||||
get { return this.GuiRect.rect.height; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
UpdateRect(BoxWidth, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string DisplayText
|
public string DisplayText
|
||||||
{
|
{
|
||||||
get { return this.GuiText.text; }
|
get { return this.GuiText.text; }
|
||||||
set { this.GuiText.text = value; }
|
set
|
||||||
|
{
|
||||||
|
this.GuiText.text = value;
|
||||||
|
this.RecalculateSize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public TextElement DataText
|
public TextElement DataText
|
||||||
@@ -61,23 +48,15 @@ namespace RothenburgAR.Exhibition
|
|||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateRect(float width, float height)
|
void OnEnable()
|
||||||
{
|
{
|
||||||
return;
|
this.RecalculateSize();
|
||||||
this.GuiRect.sizeDelta = new Vector2(width, height);
|
|
||||||
if (_descriptionPoiBehaviour != null)
|
|
||||||
{
|
|
||||||
Background.transform.localScale = new Vector3(width, height, 1.0f);
|
|
||||||
_descriptionPoiBehaviour.transform.localPosition = new Vector3(-0.4f, 0f, -0.005f);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Background.transform.localScale = new Vector3(width, height, 1.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Start()
|
private void RecalculateSize()
|
||||||
{
|
{
|
||||||
|
GuiText.GetComponent<LayoutElement>().enabled = false;
|
||||||
|
GuiText.GetComponent<LayoutElement>().enabled = true;
|
||||||
StartCoroutine(CreateBorder());
|
StartCoroutine(CreateBorder());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +103,10 @@ namespace RothenburgAR.Exhibition
|
|||||||
|
|
||||||
private IEnumerator CreateBorder()
|
private IEnumerator CreateBorder()
|
||||||
{
|
{
|
||||||
yield return null;
|
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");
|
var borderContainer = new GameObject("BorderContainer");
|
||||||
borderContainer.transform.SetParent(Background.transform, false);
|
borderContainer.transform.SetParent(Background.transform, false);
|
||||||
|
|
||||||
@@ -152,7 +134,7 @@ namespace RothenburgAR.Exhibition
|
|||||||
outlineRenderer.SetPosition(5, topRight);
|
outlineRenderer.SetPosition(5, topRight);
|
||||||
|
|
||||||
outlineRenderer.material = UIColorSchemeManager.Instance.GetUIMaterial(UIMaterial.BaseOpaque);
|
outlineRenderer.material = UIColorSchemeManager.Instance.GetUIMaterial(UIMaterial.BaseOpaque);
|
||||||
outlineRenderer.enabled = false;
|
outlineRenderer.enabled = GuiText.GetComponent<MeshRenderer>().enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -337,8 +337,6 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1230455932}
|
- component: {fileID: 1230455932}
|
||||||
- component: {fileID: 1230455931}
|
- component: {fileID: 1230455931}
|
||||||
- component: {fileID: 1230455930}
|
|
||||||
- component: {fileID: 1230455929}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: UIObjectCamera
|
m_Name: UIObjectCamera
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -346,20 +344,6 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!92 &1230455929
|
|
||||||
Behaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1230455927}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!124 &1230455930
|
|
||||||
Behaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1230455927}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &1230455931
|
--- !u!20 &1230455931
|
||||||
Camera:
|
Camera:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -391,7 +375,7 @@ Camera:
|
|||||||
m_TargetEye: 3
|
m_TargetEye: 3
|
||||||
m_HDR: 1
|
m_HDR: 1
|
||||||
m_AllowMSAA: 1
|
m_AllowMSAA: 1
|
||||||
m_AllowDynamicResolution: 1
|
m_AllowDynamicResolution: 0
|
||||||
m_ForceIntoRT: 0
|
m_ForceIntoRT: 0
|
||||||
m_OcclusionCulling: 1
|
m_OcclusionCulling: 1
|
||||||
m_StereoConvergence: 10
|
m_StereoConvergence: 10
|
||||||
@@ -649,7 +633,6 @@ GameObject:
|
|||||||
m_Component:
|
m_Component:
|
||||||
- component: {fileID: 1931338042}
|
- component: {fileID: 1931338042}
|
||||||
- component: {fileID: 1931338041}
|
- component: {fileID: 1931338041}
|
||||||
- component: {fileID: 1931338039}
|
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: UICamera
|
m_Name: UICamera
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@@ -657,13 +640,6 @@ GameObject:
|
|||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 1
|
m_IsActive: 1
|
||||||
--- !u!92 &1931338039
|
|
||||||
Behaviour:
|
|
||||||
m_ObjectHideFlags: 0
|
|
||||||
m_PrefabParentObject: {fileID: 0}
|
|
||||||
m_PrefabInternal: {fileID: 0}
|
|
||||||
m_GameObject: {fileID: 1931338037}
|
|
||||||
m_Enabled: 1
|
|
||||||
--- !u!20 &1931338041
|
--- !u!20 &1931338041
|
||||||
Camera:
|
Camera:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user