hi Aren,
I've had to make a couple small changes to NGUI to make it work right for me, so I thought I'd let you know.
1. I wasn't getting expected behavior from the UICamera parameter Mouse Drag Threshold.
Mouse Drag Threshold influences left mouse button drags. But middle and right mouse button drags are influenced by the Touch Drag Threshold -- not Mouse Drag Threshold.
In UICamera.ProcessTouch, I changed:
bool isMouse = (currentTouch == mMouse[0] );
to:
bool isMouse = (currentTouch == mMouse[0] || currentTouch == mMouse[1] || currentTouch == mMouse[2]);
I'm not sure if this is the best way to do it, and I can't check if it broke touch dragging, but it fixed mouse dragging with middle and right buttons.
2. UICamera parameter Mouse Click Threshold has no effect. After a drag, a click event was always firing, regardless of the drag distance.
In UICamera.ProcessTouch, I changed:
currentTouch.clickNotification = ClickNotification.Always;
to:
currentTouch.clickNotification = ClickNotification.BasedOnDelta;
3. During gameplay, I'm instantiating cameras from prefabs and then setting their culling mask and depth by script. Since the depth is set after UICamera.Awake(), UICamera doesn't have mList in the correct sorting order. So events weren't being processed in the correct order.
I added a method to UICamera:
public static void ReSortCameras()
{
mList.Sort(CompareFunc);
}
And added another helper method to NGUITools:
public static void SetCameraDepth(Camera camera, int depth)
{
camera.depth = depth;
UICamera.ReSortCameras();
}
...and while I'm at it, in TNET:
I had to lengthen the TNGameServer timeout before a player is removed due to no communication. As it was, the client was losing connection to the server during file downloads. So I changed the value on TNGameServer line 319 from 10sec to 2min. (I realize that is probably excessive for most applications, but I'm serving some large files.)
I also doubled the TNTcpPacket timeout on connection attempts from 3sec to 6sec, because the client was occasionally not connecting to the server within the 3sec time limit.
As a design comment: I have over 20 custom packet pairs (various database queries, file uploads and downloads). So I've had to modify TNGameServer a fair amount to insert all the handlers and their associated members and initialization. Having a method on the server side similar to TNManager.SetPacketHandler() that could register a handler for the server would be very nice. Then I'd only need to re-edit TNPacket on a TNET update, which is an easy job. (Maybe this functionality exists in some form and I'm unaware of it?)
Thanks, I like your products!
Jon