示例#1
0
	/// <summary>
	/// Will draw the tooltip if it's time.
	/// </summary>
	
	void DrawGUI()
	{
		if (mCallback == null) return;
		
		Vector2 pos = Input.mousePosition;
		Vector2 diff = pos - mLastPos;
		float movement = Mathf.Abs(diff.x) + Mathf.Abs(diff.y);
		
		if (movement > 0.0f)
		{
			mLastPos = pos;
			mTimestamp = Time.time;
		}
		else if (mTimestamp + delay < Time.time)
		{
			pos.y = Screen.height - pos.y;
			
			if (mRect.Contains(pos))
			{
				mCallback(pos, mParam);
			}
			else
			{
				mCallback = null;
				mParam = null;
			}
		}
	}
示例#2
0
    /// <summary>
    /// Will draw the tooltip if it's time.
    /// </summary>

    void DrawGUI()
    {
        if (mCallback == null)
        {
            return;
        }

        Vector2 pos      = Input.mousePosition;
        Vector2 diff     = pos - mLastPos;
        float   movement = Mathf.Abs(diff.x) + Mathf.Abs(diff.y);

        if (movement > 0.0f)
        {
            mLastPos   = pos;
            mTimestamp = Time.time;
        }
        else if (mTimestamp + delay < Time.time)
        {
            pos.y = Screen.height - pos.y;

            if (mRect.Contains(pos))
            {
                mCallback(pos, mParam);
            }
            else
            {
                mCallback = null;
                mParam    = null;
            }
        }
    }
示例#3
0
	/// <summary>
	/// Adds a new tooltip area. Will check against the mouse position prior to adding.
	/// </summary>
	
	static public void AddArea (Rect inRect, OnDrawTooltip inCallback, object inParam)
	{
		if (UI.ContainsMouse(inRect))
		{
			mRect 	 	= inRect;
			mCallback 	= inCallback;
			mParam 		= inParam;
		}
	}
示例#4
0
    /// <summary>
    /// Adds a new tooltip area. Will check against the mouse position prior to adding.
    /// </summary>

    static public void AddArea(Rect inRect, OnDrawTooltip inCallback, object inParam)
    {
        if (UI.ContainsMouse(inRect))
        {
            mRect     = inRect;
            mCallback = inCallback;
            mParam    = inParam;
        }
    }