Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: MoProductions on July 11, 2017, 01:47:19 PM

Title: UIDraggableCamera alternate
Post by: MoProductions on July 11, 2017, 01:47:19 PM
OK so our entire control system for the main part of our puzzle game was a combination of UIDraggableCamera, UIDragCamera and SpringPosition.  We were having a weird issue where we wanted to shut off the dragging, but shutting off the UIDraggableCamera didn't do it.  Checked the UIDragCamera code and it doesn't check to see if the UIDraggableCamera is active before calling it's code.  So I went to the forums to find some tips and I discover all sorts of posts about "I don't know why UIDraggableCamera exists" and "UIDraggableCamera is from NGUI 1" etc etc etc.  We've put a TON of time into this system before discovering this, and TBH it's worked out ok for us for the most part.  However, we do need to sort out this issue so I'm wondering if

a) We can just do what we need with UIDraggableCamera and UIDragCamera since they'll never be updated again or
b) We have some sort of alternate solution that won't require us to rewrite our entire control system (we did a ton of stuff on top of the NGUI stuff to get the functionality we wanted).

Any tips appreciated, I hope we didn't waste a TON of time.

Title: Re: UIDraggableCamera alternate
Post by: MoProductions on July 11, 2017, 02:16:11 PM
Oh BTW what I meant in a) above as far as "just do what we need" I mean since it's so legacy could we have free reign to modify UIDraggableCamera and UIDragCamera as much as we want without ever worrying about it getting updated by you?  If so, then we could be in much better shape than I thought we were even before discovering the UIDraggableCamera/UIDragCamera archaicness.
Title: Re: UIDraggableCamera alternate
Post by: ArenMook on July 15, 2017, 06:22:45 AM
I would advise modifying it to your heart's content, but if your modifications are simple fixes such as the enabled check you mentioned above, you can note them here and I'll add them to the NGUI itself to make your upgrading easier. I've gone ahead and added that draggableCamera.enabled check in the meantime.
Title: Re: UIDraggableCamera alternate
Post by: MoProductions on July 18, 2017, 08:57:05 AM
Excellent, modifying it to our hearts content is what we did!  Well, by that we did exactly what you mentioned and just put the check for the enabling.  It's literally just
  1. If (enabled == false) return;
in the Press(), Drag() and Scroll() functions.
If that's all you are going to do (or equivalent) then I'll just keep an eye out for the next update and make sure it all works and then hopefully we can get back to our 100% not tweaking the NGUI source heh.
Thanks!  I'll keep an eye out and keep you informed.
Title: Re: UIDraggableCamera alternate
Post by: MoProductions on April 26, 2018, 11:13:48 AM
So, to get our stuff to work with the "can't believe it still exists" UIDraggableCam I made the changes mentioned above:
If (enabled == false) return;
at the start of Press(), Drag() and Scroll()

I also made a similar change to UIDragCam, checking if the draggable cam was enabled before moving forward:
// if (enabled && NGUITools.GetActive(gameObject) && draggableCamera != null)
// the above was changed to below
if (enabled && NGUITools.GetActive(gameObject) && draggableCamera != null && draggableCamera.enabled)

My question is if these two files are still on the permanent non-supported list, in which case I'd rather just take our changes versions and move it into our own stuff instead of updating the files every NGUI update. 

Title: Re: UIDraggableCamera alternate
Post by: ginxx009 on May 08, 2018, 12:38:09 AM
Could someone help me please too on my problem it's about the scroll view

So here's my problem .

So what i am trying to do here is that when i try to scroll and stop scrolling in the middle part of scrolling  it will stop at the middle of course so i want it to be like " If i scroll it to the next page even i stop at the center it must proceed to the next page " something like that. Could someone please help me with this