Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: sintua on January 27, 2015, 03:13:37 PM

Title: Advice for adding OpenOn.Hover to UIPopUpList?
Post by: sintua on January 27, 2015, 03:13:37 PM
I've got the start of it easily enough, adding to the enum and:
  1. void OnHover(bool isOver)
  2.         {
  3.                 if (openOn == OpenOn.Hover && isOver)
  4.                         Show();
  5.                 else if (openOn == OpenOn.Hover && !isOver)
  6.                         Close();
  7.         }
But the problem is once you try to go over the options it closes... so how would I make it detect being over the popup options as well, and only closing if the mouse is off both the original button and the dropdown's background? I imagine it involves adding a collider to the background sprite and some other reference to see if it's hovered over as well, but I'm not sure how that'd work since I don't think it'd call the UIPopUp.cs OnHover method?
Title: Re: Advice for adding OpenOn.Hover to UIPopUpList?
Post by: ArenMook on January 28, 2015, 02:11:04 AM
Open on hover like you're doing now, but don't close it on hover. Instead subscribe to UICamera.onHover and keep an eye on what's underneath the mouse there. Close it when you need it.