Tidy up post merge

--HG--
branch : develop_5.2
pull/413/head
Simon (darkside) Jackson 2015-12-23 20:30:08 +00:00
parent d187674e00
commit 90cafab785
3 changed files with 130 additions and 96 deletions

View File

@ -253,8 +253,14 @@ namespace UnityEngine.UI.Extensions
/// Update the UI renderer mesh. /// Update the UI renderer mesh.
/// </summary> /// </summary>
protected override void OnFillVBO(List<UIVertex> vbo) protected override void OnPopulateMesh(Mesh toFill)
{ {
List<UIVertex> vbo = new List<UIVertex>();
using (var helper = new VertexHelper(toFill))
{
helper.GetUIVertexStream(vbo);
}
switch (type) switch (type)
{ {
case Type.Simple: case Type.Simple:
@ -270,6 +276,12 @@ namespace UnityEngine.UI.Extensions
GenerateFilledSprite(vbo, m_PreserveAspect); GenerateFilledSprite(vbo, m_PreserveAspect);
break; break;
} }
using (var helper = new VertexHelper())
{
helper.AddUIVertexTriangleStream(vbo);
helper.FillMesh(toFill);
}
} }
#region Various fill functions #region Various fill functions

View File

@ -1,6 +1,5 @@
///Credit Martin Nerurkar // www.martin.nerurkar.de // www.sharkbombs.com ///Credit Martin Nerurkar // www.martin.nerurkar.de // www.sharkbombs.com
///Sourced from - http://www.sharkbombs.com/2015/02/10/tooltips-with-the-new-unity-ui-ugui/ ///Sourced from - http://www.sharkbombs.com/2015/02/10/tooltips-with-the-new-unity-ui-ugui/
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
namespace UnityEngine.UI.Extensions namespace UnityEngine.UI.Extensions
@ -8,20 +7,35 @@ namespace UnityEngine.UI.Extensions
[AddComponentMenu("UI/Extensions/Bound Tooltip/Tooltip Trigger")] [AddComponentMenu("UI/Extensions/Bound Tooltip/Tooltip Trigger")]
public class BoundTooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler public class BoundTooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler
{ {
[TextAreaAttribute]
public string text; public string text;
public bool useMousePosition = false;
public Vector3 offset;
public void OnPointerEnter(PointerEventData eventData) public void OnPointerEnter(PointerEventData eventData)
{
if (useMousePosition)
{ {
StartHover(new Vector3(eventData.position.x, eventData.position.y, 0f)); StartHover(new Vector3(eventData.position.x, eventData.position.y, 0f));
} }
else
{
StartHover(transform.position + offset);
}
}
public void OnSelect(BaseEventData eventData) public void OnSelect(BaseEventData eventData)
{ {
StartHover(transform.position); StartHover(transform.position);
} }
public void OnPointerExit(PointerEventData eventData) public void OnPointerExit(PointerEventData eventData)
{ {
StopHover(); StopHover();
} }
public void OnDeselect(BaseEventData eventData) public void OnDeselect(BaseEventData eventData)
{ {
StopHover(); StopHover();
@ -31,6 +45,7 @@ namespace UnityEngine.UI.Extensions
{ {
BoundTooltipItem.Instance.ShowTooltip(text, position); BoundTooltipItem.Instance.ShowTooltip(text, position);
} }
void StopHover() void StopHover()
{ {
BoundTooltipItem.Instance.HideTooltip(); BoundTooltipItem.Instance.HideTooltip();

View File

@ -2,6 +2,7 @@
/// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-2#post-1796783 /// Sourced from - http://forum.unity3d.com/threads/scripts-useful-4-6-scripts-collection.264161/page-2#post-1796783
/// Extended to include a HELD state that continually fires while the button is held down. /// Extended to include a HELD state that continually fires while the button is held down.
/// Refactored so it can be added to any button and expose the events in the editor. /// Refactored so it can be added to any button and expose the events in the editor.
/// Unselect fix by @Sfyne
using UnityEngine.Events; using UnityEngine.Events;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
@ -108,5 +109,11 @@ namespace UnityEngine.UI.Extensions
Debug.Log("Control Held"); Debug.Log("Control Held");
#endif #endif
} }
//Fixed UISelectableExtension inactive bug (if gameObject becomes inactive while button is held down it never goes back to _pressed = false)
void OnDisable ()
{
_pressed = false;
}
} }
} }