public void OnMouseDown()
    {
        isTooltipVisible = false;

        ActionbarsTooltip.Hide();
        target = null;
    }
Exemplo n.º 2
0
    // Called by Unity just before any of the Update methods is called the first time.
    public void Start()
    {
        // Store the singleton instance for reference in static functions
        _instance = this;

        // Obtain a reference to the control instances attached to this object
        _panel = GetComponent<dfPanel>();
        _name = _panel.Find<dfLabel>( "lblName" );
        _info = _panel.Find<dfLabel>( "lblInfo" );

        // We don't want the tooltip visible unless it is being used
        _panel.Hide();

        // We don't want the tooltip to intercept mouse messages
        _panel.IsInteractive = false;
        _panel.IsEnabled = false;
    }
    // Called by Unity just before any of the Update methods is called the first time.
    public void Start()
    {
        // Store the singleton instance for reference in static functions
        _instance = this;

        // Obtain a reference to the control instances attached to this object
        _panel = GetComponent <dfPanel>();
        _name  = _panel.Find <dfLabel>("lblName");
        _info  = _panel.Find <dfLabel>("lblInfo");

        // We don't want the tooltip visible unless it is being used
        _panel.Hide();

        // We don't want the tooltip to intercept mouse messages
        _panel.IsInteractive = false;
        _panel.IsEnabled     = false;
    }
    public void OnMouseLeave()
    {
        if (target == null)
        {
            return;
        }

        var mousePosition = Input.mousePosition;

        mousePosition.y = Screen.height - mousePosition.y;

        if (!target.GetScreenRect().Contains(mousePosition, true))
        {
            isTooltipVisible = false;

            ActionbarsTooltip.Hide();
            target = null;
        }
    }
    public void OnMouseHover(dfControl control, dfMouseEventArgs mouseEvent)
    {
        if (isTooltipVisible)
        {
            return;
        }

        var isSpellSlot = actionBar.Controls.Contains(mouseEvent.Source);

        if (isSpellSlot)
        {
            target = mouseEvent.Source;
            if (target == lastTarget)
            {
                return;
            }

            lastTarget = target;

            isTooltipVisible = true;

            var slot = target.GetComponentInChildren <SpellSlot>();
            if (string.IsNullOrEmpty(slot.Spell))
            {
                return;
            }

            var spell = SpellDefinition.FindByName(slot.Spell);
            if (spell == null)
            {
                return;
            }

            ActionbarsTooltip.Show(spell);
        }
        else
        {
            lastTarget = null;
        }
    }