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.


Topics - Unisip

Pages: [1]
1
NGUI 3 Support / Justified text coming in v3.1 ??
« on: January 30, 2014, 01:18:25 PM »
A friend of mine working at the NSA recently hacked ArenMook's computer and says that justified text is coming in build 3.1!
Is that true???  ;-)

2
NGUI 3 Support / Missed mouse input events: a quick fix for NGUI
« on: October 07, 2013, 12:31:13 PM »
Hey,

I've noticed that when framerate temporarily drops, Unity's Input class sometimes misses mouse events, resulting in NGUI buttons feeling unresponsive, even totally ignoring clicks.
Basically, what happens is that you might get an Input.GetMouseButtonUp without an Input.GetMouseButtonDown occurring before it. An NGUI button won't received the Clicked event if Input.GetMouseButtonDown was skipped by Unity.
This is not an NGUI bug, but there's a very simple way to fix this in NGUI, but changing a few lines in UICamera.

Here is what you need to change in UICamera.cs:

instead of this (from line 832 in NGUI 2.7)

                // Process all 3 mouse buttons as individual touches
      if (useMouse)
      {
         for (int i = 0; i < 3; ++i)
         {
            bool pressed = Input.GetMouseButtonDown(i);
            bool unpressed = Input.GetMouseButtonUp(i);
                                ...

Use this:
                // Process all 3 mouse buttons as individual touches
      if (useMouse)
      {
         for (int i = 0; i < 3; ++i)
         {
                              bool pressed = false, unpressed = false;

                              if (Input.GetMouseButtonDown(i) && Input.GetMouseButtonUp(i))
                              {
                                     //press unpress in same frame
                                     pressed = true;
                                     unpressed = true;
                                     mouseDown = false;
                              }
                              else
                                  if (Input.GetMouseButton(i) != mouseDown[ i ])
                              {
                                    pressed = Input.GetMouseButton(i);
                                    unpressed = !Input.GetMouseButton(i);
                                    mouseDown = pressed;
                               }
                               ...

You will also need to declare as the MouseDown array as a global private field somewhere in the class, like this:
private bool[] mouseDown = new bool[3];

Hope this helps.

BTW, Michael, if you read this and if you feel this modification makes sense, it would be great to have it integrated in a coming release of NGUI. And while we're at it, it would be even better if this problem was fixed in Unity's Input class and/or the so much anticipated new UI system. :)

Tks



3
NGUI 3 Support / How to ensure NGUI captures and filters mouse inputs?
« on: December 27, 2012, 09:55:32 AM »
I've looked into the UICamera.cs code, but haven't found a simple solution to the following issue:
- I need to disable any code that uses mouse input whenever that same input has been handled by NGUI.
- example: a user clicks on an NGUI widget and drags the mouse, releasing it somewhere else on screen. When that happens, I want my camera orbiting code to skip moving the camera based on mouse displacement. That code should be skipped from the moment the user clicks to the moment he releases the mouse button.
- UICamera.hoveredobject enables me to discard anything related to Input.GetMouseButtonDown(0), just by checking that it is not null (meaning that the click happened over an NGUI widget), but that's not good enough, because hovered may become null during the drag.
- Ideally, I'd like to check a static bool 'UICamera.isInputHandledByNGUI', that would be set to true whenever a user clicks on a widget and until he releases his click.

Is there something like that available somewhere, that I might have overlooked?
I can easily have my own manager on the side that would do all the checking work for me, but it feels that it is something that should naturally belong inside UICamera.cs


Pages: [1]