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 - Cawas

Pages: [1]
1
NGUI 3 Support / Re: Editor problem with ngui
« on: September 20, 2013, 04:51:25 AM »
Don't add large images to an atlas. Use UITexture to draw them.
Point and case! :D

2
NGUI 3 Support / Re: How to make rotated sprites look better ?
« on: September 19, 2013, 04:34:23 PM »
I can only think of 2 things: bigger sprite or making it 3D instead.

For the bigger sprite, you may try to use UITexture instead of UISprite. It's not as optimized for performance, but it may look better.

3
NGUI 3 Support / Re: UIImage button sprite not change
« on: September 19, 2013, 04:31:53 PM »
I'm also clueless on what's going on... Maybe you have more scripts you're not showing us or something you're not telling us.

Try doing it on a clean project. That usually helps to figure out how it works to begin with. Take a look at the NGUI's example folder. There's a lot of buttons working with hover sprites just fine there.

4
NGUI 3 Support / Re: Editor problem with ngui
« on: September 19, 2013, 04:24:21 PM »
Also, once you're with NGUI, I'd say to avoid using Unity's GUI all together. NGUI can do everything better and if you mix the two you'll only have headaches for yourself. NGUI can work with it, but there's no sense in doing it so.

5
NGUI 3 Support / Missing NGUI OnMouseUp and 'OnHoverWhileOnPress' Events
« on: September 19, 2013, 04:21:09 PM »
edit: since nobody answered yet, I fixed it myself. The original intent of posting this was still to get a review and ask for alternatives, so not much really change...

Using NGUI 2.7.0 here.

About the NGUI Events, I've missed 2 kind of events:

- OnMouseUp : because OnPress(false) is actually equivalent to OnMouseUpAsButton
- OnHover while OnPress : no idea why it was not implemented

Since I couldn't find a good way around it, I've implemented them on UICamera.

For the first part, it was easy. I've added a whole line to 1164, right after if (unpressed), and a whole new convention for a equivalent to OnMouseUp, which works both for Mouse and Tap on tablets:

  1.                         Notify(currentTouch.current, "OnPressUp", null);
  2.  

After I did that, just recently, ArenMook gave me another way of doing it: UICamera Sticky Press. But I still prefer this one. :P

For the second part, it was a lot tougher (to make it work on tablets)! I've basically changed 2 lines (923 and 952) under the method ProcessMouse replacing !isPressed by (useTouch || !isPressed) - basically saying "if use mouse and use touch, consider is hover regardless of is pressed". I think it makes sense, and it worked.

This is how my UICamera:923 looks now:

  1.                 // The button was released over a different object -- remove the highlight from the previous
  2.                 if (useMouse && (useTouch || !isPressed) && mHover != null && mHover != mMouse[0].current)
  3.  

But it did not work on mobile / tablets. So I got stuck without a solution for hours... Finally, I got to some solution I'm not completely happy with, only because I think it's modifying too many lines (about 5). Basically I added a "or" useTouch verification in some places where there was only a useMouse and it was dealing with hover, some how. I think it's too much to try and show here.

Should I post the whole file here? Is there another way to achieving all this?

6
NGUI 3 Support / Re: OnMouseUp interfering with OnClick
« on: September 19, 2013, 04:17:34 PM »
Thinking about the code produced, I guess it makes more sense having them as separated events (OnPressUp, OnPressDown, OnPressUpAsButton), rather than sensitive to a setting. I think it'd make it more evident: when you read it you know what it is. As it is now you'd have to know first if the camera is sticky or not.

In any case, thanks! That's quite good. ;D

NGUI is friggin' awesome. I don't say it out loud enough.

7
NGUI 3 Support / Re: OnMouseUp interfering with OnClick
« on: September 19, 2013, 04:12:48 PM »
Yes, I just tried it. It works! But I was then instantly wondering... If I want some buttons with sticky and others without it (which I'm not even sure if I do need). I suppose we can make 2 cameras... Still, seems like having a OnPressUp would make more sense, but I'm not sure. Thus, I asked "can we have both". :-)

8
NGUI 3 Support / Re: OnMouseUp interfering with OnClick
« on: September 19, 2013, 04:07:10 PM »
It will trigger if "sticky press"  is turned off on your UICamera.

Nice! But then I suppose we can't have both... Can we?

9
NGUI 3 Support / Re: OnMouseUp interfering with OnClick
« on: September 19, 2013, 10:42:54 AM »
OnPress(false) is not same as OnMouseUp.

If I press mouse button or tap on screen outside of the collider then move into inside the collider, OnMouseUp will trigger while OnPress(false) will not.

So, other than making our own even controller, is there any way within NGUI to get a true OnMouseUp?

10
Well, then... I hope the following "quote" I just made up may complete most of the blanks on yours:

Quote
No special reason it's using one or the other position. We use all other Transform attributes as local, so it was position as well. Making a patch to this is on the to do, but simply haven't been done and has no priority. So, yeah, we accept pull requests but you can't do it with a free bit bucket account. Sorry.

If that's right, attached there's the file in any case. ;-)

(Plus, I couldn't find TweenPosition.cs under https://bitbucket.org/tsgstudio/rngui to even try.)

11
First time posting here, so let me just say this before anything: NGUI must be the best framework (among 9 or 10) I've ever used on Unity (or maybe anywhere else!). It's freaking awesome! And, despite having (hateful) forums (instead of Q&A) for support, they're still very helpful! Thanks a lot for all that!

---

Aren,

I think OnlineCop's question is still unanswered here. Is there any reason why '.localPosition' is being used instead of '.position'?

I'm with same issue and already solved it by patching the file, but I wonder if this shouldn't be updated on NGUI. And, if it should, then I'd have another question: Is there a git I can send a pull request? :-P

Pages: [1]