Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - salepate

Pages: [1]
1
NGUI 3 Support / Get Release event without getting the down one.
« on: October 24, 2014, 08:31:12 AM »
Hello,

Back again, on the OnRelease/OnPress(false) event which never gets fired if the button has not received OnPress(true).

This thread has similarities with my question.

How do you handle contextual menu if the above assertion is true? Moreover, since there's no hovering on devices, this get harder to code. Do I have to not use NGUI events for making such menu? Its easy on a standalone version thanks to the UICamera.hoveredObject (although, the button doesnt get highlighted when my mouse is "down-hovering" it)

So let me ask, If I ever want to make a contextual menu that appears on mouse/touch down, and disappears on mouse up/touch up (and trigger an event if mouse/touch was released above a UIButton), Should I just not use NGUI at all?

Regards

2
NGUI 3 Support / Re: Fake HoverIn
« on: August 08, 2014, 09:33:32 AM »
I see, this indeed work with GetMouseButtonUp()

Sadly I'm not given the choice, as I was transmitting events from another framework to NGUI. I thank you for your answers.

So as a final solution, I'll use the double collision system to make it work in my case.

Regards, thank you again.

3
NGUI 3 Support / Re: Fake HoverIn
« on: August 08, 2014, 07:59:37 AM »
I think I'm being misunderstood here.

I have made a short video to explain further the problem : https://www.youtube.com/watch?v=mTnlYaKLUlU

I am not keeping the mouse pressed or whatsoever. Here's the toggle script that i use in the video :
  1. public class TestScript : MonoBehaviour {
  2.         public GameObject sprite;
  3.  
  4.         private bool toggle = false;
  5.  
  6.         // Use this for initialization
  7.         void Start () {
  8.        
  9.         }
  10.        
  11.         // Update is called once per frame
  12.         void Update () {
  13.                 if (Input.GetMouseButtonDown(0))
  14.                 {
  15.                         toggle = !toggle;
  16.                         NGUITools.SetActive(sprite, toggle);
  17.                 }
  18.         }
  19. }
  20.  

the NGUI is as you said :
1. ALT + SHIFT + S
2. ALT + SHIFT + C
3. Add a UI Button with a hover texture.
4. That's all.

Quite simple isn't it? and I am not even using EventTrigger here, cause a simple UI Button will fail to behave the way its expected. (or maybe its supposed to not work in this case? You tell me)

Regards

4
NGUI 3 Support / Re: Fake HoverIn
« on: August 07, 2014, 07:22:00 AM »
What if this was caused by your 2nd sprite which trigger the first one?

I tried recreating your example, a simple sprite with a hover texture. But instead of making the NGUI Sprite appear by clicking another NGUI button, I simply created a game object with this Update routine :
  1.         void Update () {
  2.                 if (Input.GetMouseButtonDown(0))
  3.                 {
  4.                         NGUITools.SetActive(sprite, true);
  5.                 }
  6.         }
  7.  

The sprite then appear below my cursor, and this time, none of the Hover events get fired!

My point is, in your case, the hover event was triggered because you were moving from the button collider to the "hover" collider. you have 2 colliders which allow HoverEvents to be fired properly. Maybe this scheme might help :


Also, I am using 3.6.8


5
NGUI 3 Support / Re: Fake HoverIn
« on: August 07, 2014, 02:37:33 AM »
Hi,

I'm using a UIEventTrigger for detecting hovers, but that's not the problem anyway. I do have a collider set properly. So I did some tests.

when I activate the gameObject, the UIEventTrigger indeed fire the "OnHoverOver" event as soon as possible. But it will never fire the "OnHoverOut" event when my cursor gets out of the collider.

Sadly, I need the OnHoverOut event to hide the menu, the OnHoverOver would serve me no purpose here.

6
NGUI 3 Support / Fake HoverIn
« on: August 06, 2014, 10:31:05 AM »
Hi,

similar to this message : http://www.tasharen.com/forum/index.php?topic=4721.msg22743#msg22743

I am making a menu appear right below the mouse, and intend to make it disappear when mouse hovers out, unfortunately this wont work. HoverOut event does not get triggered.
I tried making a similar edit to the above mentioned thread :

  1.                 UICamera.hoveredObject = gameObject;
  2.                 gameObject.SendMessage("OnHover", true, SendMessageOptions.DontRequireReceiver);
  3.  

Unfortunately this does not work! I mean this does indeed fire the event, but then it won't fire the Hover Out event when I get out of the collider. Possibly because private UICamera.mHover is still set to null. Had I access to this variable this would be different, but I'm sure this would lead to NGUI malfunctions
Any help is appreciated
Regards,

7
NGUI 3 Support / Best Practice to detect when mouse is on any menu
« on: July 31, 2014, 08:28:46 AM »
Hello, I'm having a hard time firguring out whenever the mouse is inside a menu or outside any menus. This would help me disable other framework inputs while mouse is still hovering, clicking, pressing, dragging stuff.

I tried having a panel with a box collider, listening to HoverOver / HoverOut, but this doesnt work well if there are other colliders inside the collider.

What would you suggest?

Regards

Edit : Seems like UICamera.hoveredObject is what I was looking for.

Pages: [1]