summaryrefslogtreecommitdiff
path: root/Assets/SampleUI/Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Assets/SampleUI/Scripts')
-rwxr-xr-xAssets/SampleUI/Scripts/ActiveStateToggler.cs9
-rwxr-xr-xAssets/SampleUI/Scripts/ActiveStateToggler.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/ApplicationManager.cs20
-rwxr-xr-xAssets/SampleUI/Scripts/ApplicationManager.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/ChangeColor.cs50
-rwxr-xr-xAssets/SampleUI/Scripts/ChangeColor.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/DragMe.cs88
-rwxr-xr-xAssets/SampleUI/Scripts/DragMe.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/DragPanel.cs48
-rwxr-xr-xAssets/SampleUI/Scripts/DragPanel.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/DropMe.cs65
-rwxr-xr-xAssets/SampleUI/Scripts/DropMe.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/PanelManager.cs96
-rwxr-xr-xAssets/SampleUI/Scripts/PanelManager.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/ResizePanel.cs39
-rwxr-xr-xAssets/SampleUI/Scripts/ResizePanel.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/ScrollDetailTexture.cs64
-rwxr-xr-xAssets/SampleUI/Scripts/ScrollDetailTexture.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/ShowSliderValue.cs14
-rwxr-xr-xAssets/SampleUI/Scripts/ShowSliderValue.cs.meta8
-rwxr-xr-xAssets/SampleUI/Scripts/TiltWindow.cs29
-rwxr-xr-xAssets/SampleUI/Scripts/TiltWindow.cs.meta8
22 files changed, 610 insertions, 0 deletions
diff --git a/Assets/SampleUI/Scripts/ActiveStateToggler.cs b/Assets/SampleUI/Scripts/ActiveStateToggler.cs
new file mode 100755
index 0000000..d5b7520
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ActiveStateToggler.cs
@@ -0,0 +1,9 @@
+using UnityEngine;
+using System.Collections;
+
+public class ActiveStateToggler : MonoBehaviour {
+
+ public void ToggleActive () {
+ gameObject.SetActive (!gameObject.activeSelf);
+ }
+}
diff --git a/Assets/SampleUI/Scripts/ActiveStateToggler.cs.meta b/Assets/SampleUI/Scripts/ActiveStateToggler.cs.meta
new file mode 100755
index 0000000..d34a0d2
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ActiveStateToggler.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: a95e0a044abfc473394c6c61eb343e4a
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/ApplicationManager.cs b/Assets/SampleUI/Scripts/ApplicationManager.cs
new file mode 100755
index 0000000..a8f868a
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ApplicationManager.cs
@@ -0,0 +1,20 @@
+using UnityEngine;
+using System.Collections;
+using UnityEngine.SceneManagement;
+
+public class ApplicationManager : MonoBehaviour {
+
+ public void Quit ()
+ {
+ #if UNITY_EDITOR
+ UnityEditor.EditorApplication.isPlaying = false;
+ #else
+ Application.Quit();
+ #endif
+ }
+
+ public void LoadLevelnt (int scene)
+ {
+ SceneManager.LoadScene(scene,0);
+ }
+}
diff --git a/Assets/SampleUI/Scripts/ApplicationManager.cs.meta b/Assets/SampleUI/Scripts/ApplicationManager.cs.meta
new file mode 100755
index 0000000..441cc88
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ApplicationManager.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 7696221f0cbbc764498b26fbbf4228af
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/ChangeColor.cs b/Assets/SampleUI/Scripts/ChangeColor.cs
new file mode 100755
index 0000000..f7e474b
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ChangeColor.cs
@@ -0,0 +1,50 @@
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+public class ChangeColor : MonoBehaviour, IPointerClickHandler
+{
+ void OnEnable ()
+ {
+ }
+
+ public void SetRed(float value)
+ {
+ OnValueChanged(value, 0);
+ }
+
+ public void SetGreen(float value)
+ {
+ OnValueChanged(value, 1);
+ }
+
+ public void SetBlue(float value)
+ {
+ OnValueChanged(value, 2);
+ }
+
+ public void OnValueChanged(float value, int channel)
+ {
+ Color c = Color.white;
+
+ if (GetComponent<Renderer>() != null)
+ c = GetComponent<Renderer>().material.color;
+ else if (GetComponent<Light>() != null)
+ c = GetComponent<Light>().color;
+
+ c[channel] = value;
+
+ if (GetComponent<Renderer>() != null)
+ GetComponent<Renderer>().material.color = c;
+ else if (GetComponent<Light>() != null)
+ GetComponent<Light>().color = c;
+ }
+
+ public void OnPointerClick(PointerEventData data)
+ {
+ if (GetComponent<Renderer>() != null)
+ GetComponent<Renderer>().material.color = new Color(Random.value, Random.value, Random.value, 1.0f);
+ else if (GetComponent<Light>() != null)
+ GetComponent<Light>().color = new Color(Random.value, Random.value, Random.value, 1.0f);
+ }
+}
diff --git a/Assets/SampleUI/Scripts/ChangeColor.cs.meta b/Assets/SampleUI/Scripts/ChangeColor.cs.meta
new file mode 100755
index 0000000..a92ab4d
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ChangeColor.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 71f437cfa250a7d4a9cb2760386ed379
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/DragMe.cs b/Assets/SampleUI/Scripts/DragMe.cs
new file mode 100755
index 0000000..f2b4cf7
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DragMe.cs
@@ -0,0 +1,88 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+[RequireComponent(typeof(Image))]
+public class DragMe : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
+{
+ public bool dragOnSurfaces = true;
+
+ private Dictionary<int,GameObject> m_DraggingIcons = new Dictionary<int, GameObject>();
+ private Dictionary<int, RectTransform> m_DraggingPlanes = new Dictionary<int, RectTransform>();
+
+ public void OnBeginDrag(PointerEventData eventData)
+ {
+ var canvas = FindInParents<Canvas>(gameObject);
+ if (canvas == null)
+ return;
+
+ // We have clicked something that can be dragged.
+ // What we want to do is create an icon for this.
+ m_DraggingIcons[eventData.pointerId] = new GameObject("icon");
+
+ m_DraggingIcons[eventData.pointerId].transform.SetParent (canvas.transform, false);
+ m_DraggingIcons[eventData.pointerId].transform.SetAsLastSibling();
+
+ var image = m_DraggingIcons[eventData.pointerId].AddComponent<Image>();
+ // The icon will be under the cursor.
+ // We want it to be ignored by the event system.
+ var group = m_DraggingIcons[eventData.pointerId].AddComponent<CanvasGroup>();
+ group.blocksRaycasts = false;
+
+ image.sprite = GetComponent<Image>().sprite;
+ image.SetNativeSize();
+
+ if (dragOnSurfaces)
+ m_DraggingPlanes[eventData.pointerId] = transform as RectTransform;
+ else
+ m_DraggingPlanes[eventData.pointerId] = canvas.transform as RectTransform;
+
+ SetDraggedPosition(eventData);
+ }
+
+ public void OnDrag(PointerEventData eventData)
+ {
+ if (m_DraggingIcons[eventData.pointerId] != null)
+ SetDraggedPosition(eventData);
+ }
+
+ private void SetDraggedPosition(PointerEventData eventData)
+ {
+ if (dragOnSurfaces && eventData.pointerEnter != null && eventData.pointerEnter.transform as RectTransform != null)
+ m_DraggingPlanes[eventData.pointerId] = eventData.pointerEnter.transform as RectTransform;
+
+ var rt = m_DraggingIcons[eventData.pointerId].GetComponent<RectTransform>();
+ Vector3 globalMousePos;
+ if (RectTransformUtility.ScreenPointToWorldPointInRectangle(m_DraggingPlanes[eventData.pointerId], eventData.position, eventData.pressEventCamera, out globalMousePos))
+ {
+ rt.position = globalMousePos;
+ rt.rotation = m_DraggingPlanes[eventData.pointerId].rotation;
+ }
+ }
+
+ public void OnEndDrag(PointerEventData eventData)
+ {
+ if (m_DraggingIcons[eventData.pointerId] != null)
+ Destroy(m_DraggingIcons[eventData.pointerId]);
+
+ m_DraggingIcons[eventData.pointerId] = null;
+ }
+
+ static public T FindInParents<T>(GameObject go) where T : Component
+ {
+ if (go == null) return null;
+ var comp = go.GetComponent<T>();
+
+ if (comp != null)
+ return comp;
+
+ var t = go.transform.parent;
+ while (t != null && comp == null)
+ {
+ comp = t.gameObject.GetComponent<T>();
+ t = t.parent;
+ }
+ return comp;
+ }
+}
diff --git a/Assets/SampleUI/Scripts/DragMe.cs.meta b/Assets/SampleUI/Scripts/DragMe.cs.meta
new file mode 100755
index 0000000..190b48c
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DragMe.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 16adfeb90f2004348b7dfad7eb9ae316
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/DragPanel.cs b/Assets/SampleUI/Scripts/DragPanel.cs
new file mode 100755
index 0000000..39c9e10
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DragPanel.cs
@@ -0,0 +1,48 @@
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.EventSystems;
+using System.Collections;
+
+public class DragPanel : MonoBehaviour, IPointerDownHandler, IDragHandler {
+
+ private Vector2 originalLocalPointerPosition;
+ private Vector3 originalPanelLocalPosition;
+ private RectTransform panelRectTransform;
+ private RectTransform parentRectTransform;
+
+ void Awake () {
+ panelRectTransform = transform.parent as RectTransform;
+ parentRectTransform = panelRectTransform.parent as RectTransform;
+ }
+
+ public void OnPointerDown (PointerEventData data) {
+ originalPanelLocalPosition = panelRectTransform.localPosition;
+ RectTransformUtility.ScreenPointToLocalPointInRectangle (parentRectTransform, data.position, data.pressEventCamera, out originalLocalPointerPosition);
+ }
+
+ public void OnDrag (PointerEventData data) {
+ if (panelRectTransform == null || parentRectTransform == null)
+ return;
+
+ Vector2 localPointerPosition;
+ if (RectTransformUtility.ScreenPointToLocalPointInRectangle (parentRectTransform, data.position, data.pressEventCamera, out localPointerPosition)) {
+ Vector3 offsetToOriginal = localPointerPosition - originalLocalPointerPosition;
+ panelRectTransform.localPosition = originalPanelLocalPosition + offsetToOriginal;
+ }
+
+ ClampToWindow ();
+ }
+
+ // Clamp panel to area of parent
+ void ClampToWindow () {
+ Vector3 pos = panelRectTransform.localPosition;
+
+ Vector3 minPosition = parentRectTransform.rect.min - panelRectTransform.rect.min;
+ Vector3 maxPosition = parentRectTransform.rect.max - panelRectTransform.rect.max;
+
+ pos.x = Mathf.Clamp (panelRectTransform.localPosition.x, minPosition.x, maxPosition.x);
+ pos.y = Mathf.Clamp (panelRectTransform.localPosition.y, minPosition.y, maxPosition.y);
+
+ panelRectTransform.localPosition = pos;
+ }
+}
diff --git a/Assets/SampleUI/Scripts/DragPanel.cs.meta b/Assets/SampleUI/Scripts/DragPanel.cs.meta
new file mode 100755
index 0000000..39d696d
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DragPanel.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b895a589a253443a9ac85bafa7402a65
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/DropMe.cs b/Assets/SampleUI/Scripts/DropMe.cs
new file mode 100755
index 0000000..cb4bca5
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DropMe.cs
@@ -0,0 +1,65 @@
+using System.Reflection;
+using UnityEngine;
+using UnityEngine.EventSystems;
+using UnityEngine.UI;
+
+public class DropMe : MonoBehaviour, IDropHandler, IPointerEnterHandler, IPointerExitHandler
+{
+ public Image containerImage;
+ public Image receivingImage;
+ private Color normalColor;
+ public Color highlightColor = Color.yellow;
+
+ public void OnEnable ()
+ {
+ if (containerImage != null)
+ normalColor = containerImage.color;
+ }
+
+ public void OnDrop(PointerEventData data)
+ {
+ containerImage.color = normalColor;
+
+ if (receivingImage == null)
+ return;
+
+ Sprite dropSprite = GetDropSprite (data);
+ if (dropSprite != null)
+ receivingImage.overrideSprite = dropSprite;
+ }
+
+ public void OnPointerEnter(PointerEventData data)
+ {
+ if (containerImage == null)
+ return;
+
+ Sprite dropSprite = GetDropSprite (data);
+ if (dropSprite != null)
+ containerImage.color = highlightColor;
+ }
+
+ public void OnPointerExit(PointerEventData data)
+ {
+ if (containerImage == null)
+ return;
+
+ containerImage.color = normalColor;
+ }
+
+ private Sprite GetDropSprite(PointerEventData data)
+ {
+ var originalObj = data.pointerDrag;
+ if (originalObj == null)
+ return null;
+
+ var dragMe = originalObj.GetComponent<DragMe>();
+ if (dragMe == null)
+ return null;
+
+ var srcImage = originalObj.GetComponent<Image>();
+ if (srcImage == null)
+ return null;
+
+ return srcImage.sprite;
+ }
+}
diff --git a/Assets/SampleUI/Scripts/DropMe.cs.meta b/Assets/SampleUI/Scripts/DropMe.cs.meta
new file mode 100755
index 0000000..c31c17e
--- /dev/null
+++ b/Assets/SampleUI/Scripts/DropMe.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 266dee177694435468095e35de5218cc
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/PanelManager.cs b/Assets/SampleUI/Scripts/PanelManager.cs
new file mode 100755
index 0000000..fcd6058
--- /dev/null
+++ b/Assets/SampleUI/Scripts/PanelManager.cs
@@ -0,0 +1,96 @@
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.EventSystems;
+using System.Collections;
+using System.Collections.Generic;
+
+public class PanelManager : MonoBehaviour {
+
+ public Animator initiallyOpen;
+
+ private int m_OpenParameterId;
+ private Animator m_Open;
+ private GameObject m_PreviouslySelected;
+
+ const string k_OpenTransitionName = "Open";
+ const string k_ClosedStateName = "Closed";
+
+ public void OnEnable()
+ {
+ m_OpenParameterId = Animator.StringToHash (k_OpenTransitionName);
+
+ if (initiallyOpen == null)
+ return;
+
+ OpenPanel(initiallyOpen);
+ }
+
+ public void OpenPanel (Animator anim)
+ {
+ if (m_Open == anim)
+ return;
+
+ anim.gameObject.SetActive(true);
+ var newPreviouslySelected = EventSystem.current.currentSelectedGameObject;
+
+ anim.transform.SetAsLastSibling();
+
+ CloseCurrent();
+
+ m_PreviouslySelected = newPreviouslySelected;
+
+ m_Open = anim;
+ m_Open.SetBool(m_OpenParameterId, true);
+
+ GameObject go = FindFirstEnabledSelectable(anim.gameObject);
+
+ SetSelected(go);
+ }
+
+ static GameObject FindFirstEnabledSelectable (GameObject gameObject)
+ {
+ GameObject go = null;
+ var selectables = gameObject.GetComponentsInChildren<Selectable> (true);
+ foreach (var selectable in selectables) {
+ if (selectable.IsActive () && selectable.IsInteractable ()) {
+ go = selectable.gameObject;
+ break;
+ }
+ }
+ return go;
+ }
+
+ public void CloseCurrent()
+ {
+ if (m_Open == null)
+ return;
+
+ m_Open.SetBool(m_OpenParameterId, false);
+ SetSelected(m_PreviouslySelected);
+ StartCoroutine(DisablePanelDeleyed(m_Open));
+ m_Open = null;
+ }
+
+ IEnumerator DisablePanelDeleyed(Animator anim)
+ {
+ bool closedStateReached = false;
+ bool wantToClose = true;
+ while (!closedStateReached && wantToClose)
+ {
+ if (!anim.IsInTransition(0))
+ closedStateReached = anim.GetCurrentAnimatorStateInfo(0).IsName(k_ClosedStateName);
+
+ wantToClose = !anim.GetBool(m_OpenParameterId);
+
+ yield return new WaitForEndOfFrame();
+ }
+
+ if (wantToClose)
+ anim.gameObject.SetActive(false);
+ }
+
+ private void SetSelected(GameObject go)
+ {
+ EventSystem.current.SetSelectedGameObject(go);
+ }
+}
diff --git a/Assets/SampleUI/Scripts/PanelManager.cs.meta b/Assets/SampleUI/Scripts/PanelManager.cs.meta
new file mode 100755
index 0000000..c0ea7ed
--- /dev/null
+++ b/Assets/SampleUI/Scripts/PanelManager.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b8960321e10f80b4c844cd91bf1ea437
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/ResizePanel.cs b/Assets/SampleUI/Scripts/ResizePanel.cs
new file mode 100755
index 0000000..0058bba
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ResizePanel.cs
@@ -0,0 +1,39 @@
+using UnityEngine;
+using UnityEngine.UI;
+using UnityEngine.EventSystems;
+
+public class ResizePanel : MonoBehaviour, IPointerDownHandler, IDragHandler {
+
+ public Vector2 minSize = new Vector2 (100, 100);
+ public Vector2 maxSize = new Vector2 (400, 400);
+
+ private RectTransform panelRectTransform;
+ private Vector2 originalLocalPointerPosition;
+ private Vector2 originalSizeDelta;
+
+ void Awake () {
+ panelRectTransform = transform.parent.GetComponent<RectTransform> ();
+ }
+
+ public void OnPointerDown (PointerEventData data) {
+ originalSizeDelta = panelRectTransform.sizeDelta;
+ RectTransformUtility.ScreenPointToLocalPointInRectangle (panelRectTransform, data.position, data.pressEventCamera, out originalLocalPointerPosition);
+ }
+
+ public void OnDrag (PointerEventData data) {
+ if (panelRectTransform == null)
+ return;
+
+ Vector2 localPointerPosition;
+ RectTransformUtility.ScreenPointToLocalPointInRectangle (panelRectTransform, data.position, data.pressEventCamera, out localPointerPosition);
+ Vector3 offsetToOriginal = localPointerPosition - originalLocalPointerPosition;
+
+ Vector2 sizeDelta = originalSizeDelta + new Vector2 (offsetToOriginal.x, -offsetToOriginal.y);
+ sizeDelta = new Vector2 (
+ Mathf.Clamp (sizeDelta.x, minSize.x, maxSize.x),
+ Mathf.Clamp (sizeDelta.y, minSize.y, maxSize.y)
+ );
+
+ panelRectTransform.sizeDelta = sizeDelta;
+ }
+} \ No newline at end of file
diff --git a/Assets/SampleUI/Scripts/ResizePanel.cs.meta b/Assets/SampleUI/Scripts/ResizePanel.cs.meta
new file mode 100755
index 0000000..c0af104
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ResizePanel.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: bdf784713333a4b24860228711510eac
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/ScrollDetailTexture.cs b/Assets/SampleUI/Scripts/ScrollDetailTexture.cs
new file mode 100755
index 0000000..305383b
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ScrollDetailTexture.cs
@@ -0,0 +1,64 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+
+[RequireComponent(typeof(Image))]
+public class ScrollDetailTexture : MonoBehaviour
+{
+ public bool uniqueMaterial = false;
+ public Vector2 scrollPerSecond = Vector2.zero;
+
+ Matrix4x4 m_Matrix;
+ Material mCopy;
+ Material mOriginal;
+ Image mSprite;
+ Material m_Mat;
+
+ void OnEnable ()
+ {
+ mSprite = GetComponent<Image>();
+ mOriginal = mSprite.material;
+
+ if (uniqueMaterial && mSprite.material != null)
+ {
+ mCopy = new Material(mOriginal);
+ mCopy.name = "Copy of " + mOriginal.name;
+ mCopy.hideFlags = HideFlags.DontSave;
+ mSprite.material = mCopy;
+ }
+ }
+
+ void OnDisable ()
+ {
+ if (mCopy != null)
+ {
+ mSprite.material = mOriginal;
+ if (Application.isEditor)
+ UnityEngine.Object.DestroyImmediate(mCopy);
+ else
+ UnityEngine.Object.Destroy(mCopy);
+ mCopy = null;
+ }
+ mOriginal = null;
+ }
+
+ void Update ()
+ {
+ Material mat = (mCopy != null) ? mCopy : mOriginal;
+
+ if (mat != null)
+ {
+ Texture tex = mat.GetTexture("_DetailTex");
+
+ if (tex != null)
+ {
+ mat.SetTextureOffset("_DetailTex", scrollPerSecond * Time.time);
+
+ // TODO: It would be better to add support for MaterialBlocks on UIRenderer,
+ // because currently only one Update() function's matrix can be active at a time.
+ // With material block properties, the batching would be correctly broken up instead,
+ // and would work with multiple widgets using this detail shader.
+ }
+ }
+ }
+}
diff --git a/Assets/SampleUI/Scripts/ScrollDetailTexture.cs.meta b/Assets/SampleUI/Scripts/ScrollDetailTexture.cs.meta
new file mode 100755
index 0000000..b768d19
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ScrollDetailTexture.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 1f55b68dc282796488e1181ab0602967
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/ShowSliderValue.cs b/Assets/SampleUI/Scripts/ShowSliderValue.cs
new file mode 100755
index 0000000..99b30aa
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ShowSliderValue.cs
@@ -0,0 +1,14 @@
+using System.Reflection.Emit;
+using UnityEngine;
+using UnityEngine.UI;
+
+[RequireComponent(typeof(Text))]
+public class ShowSliderValue : MonoBehaviour
+{
+ public void UpdateLabel (float value)
+ {
+ Text lbl = GetComponent<Text>();
+ if (lbl != null)
+ lbl.text = Mathf.RoundToInt (value * 100) + "%";
+ }
+}
diff --git a/Assets/SampleUI/Scripts/ShowSliderValue.cs.meta b/Assets/SampleUI/Scripts/ShowSliderValue.cs.meta
new file mode 100755
index 0000000..b87bb73
--- /dev/null
+++ b/Assets/SampleUI/Scripts/ShowSliderValue.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: acd5fac7403fe184b870fd9b8d0fa262
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
diff --git a/Assets/SampleUI/Scripts/TiltWindow.cs b/Assets/SampleUI/Scripts/TiltWindow.cs
new file mode 100755
index 0000000..8325504
--- /dev/null
+++ b/Assets/SampleUI/Scripts/TiltWindow.cs
@@ -0,0 +1,29 @@
+using UnityEngine;
+
+public class TiltWindow : MonoBehaviour
+{
+ public Vector2 range = new Vector2(5f, 3f);
+
+ Transform mTrans;
+ Quaternion mStart;
+ Vector2 mRot = Vector2.zero;
+
+ void Start ()
+ {
+ mTrans = transform;
+ mStart = mTrans.localRotation;
+ }
+
+ void Update ()
+ {
+ Vector3 pos = Input.mousePosition;
+
+ float halfWidth = Screen.width * 0.5f;
+ float halfHeight = Screen.height * 0.5f;
+ float x = Mathf.Clamp((pos.x - halfWidth) / halfWidth, -1f, 1f);
+ float y = Mathf.Clamp((pos.y - halfHeight) / halfHeight, -1f, 1f);
+ mRot = Vector2.Lerp(mRot, new Vector2(x, y), Time.deltaTime * 5f);
+
+ mTrans.localRotation = mStart * Quaternion.Euler(-mRot.y * range.y, mRot.x * range.x, 0f);
+ }
+}
diff --git a/Assets/SampleUI/Scripts/TiltWindow.cs.meta b/Assets/SampleUI/Scripts/TiltWindow.cs.meta
new file mode 100755
index 0000000..f4aacc1
--- /dev/null
+++ b/Assets/SampleUI/Scripts/TiltWindow.cs.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: c5b01eb497714c1449cb2df46eb5ac6f
+MonoImporter:
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData: