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

Pages: [1] 2
1
NGUI 3 Support / Re: UIButton multiple tween target on Color Change.
« on: June 12, 2015, 01:08:11 PM »
Yep, eventually this was my mistake.

2
NGUI 3 Support / Re: UIButton multiple tween target on Color Change.
« on: June 11, 2015, 10:43:31 AM »
Thanks, I figured it out.
The problem is - my sprites overlap. So if I click the area of overlapping, my button technically fires twice.

EDIT: Overlapping is not the case - it seems that such button always fires twice.

EDIT2: Found some solution by adding UIButtonColor and pointing it to the second sprite (first one is already connected to the main UIButton).
Alas, it seems this component is deprecated (NGUI suggests me "to upgrade to a Button").

3
NGUI 3 Support / Re: UIButton multiple tween target on Color Change.
« on: June 11, 2015, 08:37:08 AM »
Yes, but my button consists of two overlapping sprites, and I need the button to change hover color of both of them, not just one. Is there any layout to this without creating custom UIButton class?

4
NGUI 3 Support / Re: UIButton multiple tween target on Color Change.
« on: June 11, 2015, 06:25:49 AM »
Could somebody provide a working setup of such button?
Currently my button contains two overlapping sprites:

- UIButton with Collider
-- UISprite
-- UISprite

TweenTarget was set to the same GameObject with UIButton but is always automatically reset to None.
TweenColor doesn't work at all.

How should I rework my setup to make the button change color of each sprite it consists of?

5
Hi, Aren.
I'm making something like remote helper. We have two devices with the same app and layout. User A does something (clicks, drags, etc.), and app transmits his action to User B device.

To accomplish this I need to forward all user input events UICamera gets to the second device, what I'm going to do by passing events from the initial GameObject to corresponding GameObject on linked client.

So, I'm doing this:
  1. UICamera.genericEventHandler = this.gameObject; // <- my intercepting "hub"

The intercepting GameObject has UIEventTrigger script which triggers corresponding method for every event and retargets the event to the second client using UICamera.hoveredObject.name.

But as every of my receiving GameObject has its own event handler, I don't care what kind of event I intercept. I just pass it.
Is there a way I can just pass any event as a string variable without writing numerous methods covering each case (OnPress, OnClick, etc.)?

6
NGUI 3 Support / Re: UITweener.onFinish not calling
« on: April 13, 2015, 03:26:40 PM »
Aren, after updating NGUI I see in UITweener the fix proposed here (when you use "current" variable) ;)

But then we have these two lines
  1.   if (duration == 0f || (mFactor == 1f && mAmountPerDelta > 0f || mFactor == 0f && mAmountPerDelta < 0f))
  2.                 enabled = false;

Previously you placed them before "if (current == null)" check. Now they follow the check. And this change ruins my setup. Could you clarify why did you moved them forward?

7
NGUI 3 Support / Re: Question about scale in UIDraggableCamera
« on: April 09, 2015, 04:49:24 PM »
The previous developer implemented this solution. I didn't know it's deprecated.
Anyway, thanks.

8
NGUI 3 Support / Question about scale in UIDraggableCamera
« on: April 08, 2015, 12:35:22 PM »
Hi, ArenMook

I have an orthographic camera with UIDraggableCamera component with scale X0 Y1, so that I can scroll it only vertically.
Everything is working fine except this.
At some moment I have a sprite appearing via TweenScale shrinking from very large to its native size (this effect only lasts for 0.7 sec).
This sprite is a child of the panel which I use as a UIDraggableCamera drag-limiting root (although the RootForBounds colliders are set to a very large size - about 10000 x 10000).

At start this sprite becomes so large that it's partly off screen.
And if at this moment I drag the DraggableCamera, it overrides the X restriction and jumps to the corner of some recalculated bounds.
I tried to make the RootForBounds colliders even larger and set panel constraints but that doesn't affect anything.
What is the best I can do to block this behavior?

9
NGUI 3 Support / Re: OnDragOut fires before OnDragEnd
« on: February 18, 2015, 05:15:41 PM »
Well, I figured it out.
It was obvious but not very intuitive for starter.
I should have ignore OnDragOut and recheck draggable object whereabouts when getting OnDragDropRelease.
That's it.

10
NGUI 3 Support / Re: OnDragOut fires before OnDragEnd
« on: February 18, 2015, 03:57:05 PM »
I think I got it.
In UICamera.ProcessRelease(bool isMouse, float drag) you send OnDragOut ("If there was a drag event in progress, make sure OnDragOut gets sent").

I really don't understand why, but the question is the same - if I receive OnDragOut before OnDragDropRelease() my logic thinks that the object has left the area and will not process OnDragDropRelease() properly. Any solution?

11
NGUI 3 Support / Re: OnDragOut fires before OnDragEnd
« on: February 18, 2015, 03:42:49 PM »
I redone it.
1) First I removed UIEventTrigger and added onDragOut receiving through UICamera.onDragOut event.
2) Then I overrode OnDragDropRelease(), adding there my custom logic.

Still, onDragOut fires before OnDragDropRelease() despite my dragged object never left the object underneath.

Should I process onDragOut some other way? Or maybe restrict it somehow? Or replace with some alternative?

12
NGUI 3 Support / OnDragOut fires before OnDragEnd
« on: February 17, 2015, 02:11:01 PM »
Hi, Aren.

I have an sprite with UIDragDropItem and UIEventTrigger scripts on it, the latter broadcasts OnDragEnd event.
I have another stationary sprite with UIEventTrigger which reacts on OnDragOver and OnDragOut events.

Then I drag my 1st object over the 2nd (and I see "OnDragOver" in Debug.Log which is OK) and release it.
Then I see in my Debug.Log that first it displays "OnDragOut" and only after that "OnDragEnd"...

As a result I cannot do my Drag'nDrop logic as NGUI thinks that my draggable object already left the area.

13
NGUI 3 Support / Re: UITable and NGUITools.Destroy
« on: January 07, 2015, 06:01:45 PM »
Well, in case anyone interested I gave up and switched to UIGrid and so far it works.
More code to write but at least no unexplainable behavior.

14
NGUI 3 Support / Re: UITable and NGUITools.Destroy
« on: January 04, 2015, 04:25:18 PM »
You yourself said that the table is disabled, so I am not sure why it would be changing anything. Have you tried removing the table to see what happens?
If I instantiate my child object in an empty GameObject with UITable component disabled I get it centered.
So I'm sure that it's UITable what causes offset.
What is more interesting that UITable component gets disabled somewhere in the middle of the process.
(In the middle because otherwise NGUITools.AddChild will get an exception while trying to add something in disabled UITable (declared in script as UITable type)).

15
NGUI 3 Support / Re: UITable and NGUITools.Destroy
« on: January 03, 2015, 03:14:53 PM »
Just by instantiating a prefab via NGUITools.AddChild, local position will be reset to (0, 0, 0). It's a part of NGUITools.AddChild -- just look inside that function.
I always get the object non-centered no matter if I comment "t.localPosition = Vector3.zero;" in NGUITools.AddChild or not and no matter if I call Reposition() or not (although Reposition() gives me slightly smaller offsets).
Looks like UITable just overrides it for some reason and I can't figure what property of initiated object could cause it (obviously it's not prefab initial position as it's 0,0,0).

Pages: [1] 2