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

Pages: [1]
1
Hey all,

My apologies if this already exists somewhere, I did a general search but was unable to find a solution.

TLDR Summary
Need tween to change speed while playing, without resetting

Details

Use case:  I have an icon on the screen that blinks when the user enters a restricted area.  They have a set time limit that they are allowed to be in the area before they get flagged for a violation (think shot clock in basket ball)  As there are other timers on the screen, and each of the four players has separate tracking for this restricted area, I don't want to confuse the players by adding a bunch of extra timers.  Thus, this icon acts as a messaging tool for the player and blinks faster the closer they get to the violation time.

Problem:  At the moment I am using a TweenAlpha component to accomplish the blinking, and am altering the duration through the standard .duration member.  This works fine through the editor, and even through code if I make the duration change before activating the tween; however, as I am trying to alter the duration while it is playing, I seem to be getting the behavior of a reset each time I change the duration.  Since I am changing the duration each frame based on the time remaining, it seems to be resetting to the start point each frame, resulting in a solid icon rather than the desired increasingly faster blinking.

Requested Solution: Is there a way I can alter the tween duration while it is playing and have it continue from where it is at, rather than restarting?


Many thanks
-Memige

2
NGUI 3 Support / Re: UIButton Keys not respecting disabled buttons?
« on: April 22, 2014, 10:36:56 AM »
This is for people tracking down related issues:

With the update to the new UIKeyNavigation system (which is awesome btw) the system is not respecting buttons in a disabled state.  A quick fix for this is by altering one line in UIKeyNavigation.cs, specifically line #131

change from:
  1. if (nav == this) continue;

to:
  1. if (nav == this || !nav.GetComponent<UIButton>().isEnabled) continue;

UIKeyNavigation will now ignore buttons that are set to disabled states when looking for non-explicit connections. 
[Important notes:
- This is in NGUI Version 3.5.5  NOT tested in or intended for later versions.
- Explicitly setting a Left, Right, Up, or Down target will still navigate to that object even if it is disabled
- This has not been thoroughly tested and may cause issues if UIKeyNavigation components are used on non-UIButton objects
- This is not an official fix, this is just a hack workaround.  Aren will need to implement a stable and robust alteration before this will be supported natively.
]

[Clarification: the disabled buttons correctly ignore clicks regardless]


-Cheers, Memige

3
NGUI 3 Support / Re: Button Hover when switching via script
« on: March 17, 2014, 10:22:00 AM »
Fantastic, just what I was looking for, I've got it working perfectly now.

We used a competitive product for 2 years before switching to NGUI, and have never looked back.  Much better product, much better support.  Many thanks and keep up the awesome work.

-Memige

4
NGUI 3 Support / Re: [Bug] UI Localization
« on: March 16, 2014, 02:03:00 PM »
You are certainly welcome to make any suggestions you wish, but as one who has spent a lot of time working with localization projects, I would actually strongly recommend against using empty strings.  Using some default filler like [TRANSLATION PENDING] or some such will make it much less likely that you overlook it before shipping.  Personally I like to use the localization tag itself (such as [MENU_OK]), so that I have an easy reference to what should be there.  It's the same idea behind having magenta as a default texture: makes it nearly impossible to miss when running the game, making it much harder for it to slip between the cracks.

Just my two cents, your project can be done your way of course.

-Memige

5
NGUI 3 Support / Button Hover when switching via script
« on: March 16, 2014, 01:55:31 PM »
I'm dealing with a minor glitch where the buttons do not display in their hovered state when switching to them using UICamera.SelectedObject = myButton.  It doesn't seem too complicated and I'm fairly confident I can track down the issue, but any help would be appreciated; got any thoughts on obvious gotchas?  According to my debug logs, the buttons are in fact selected, they just don't appear that way.  I can move off of them without a problem, moving back onto them causes the correct Hover image to appear, and clicking fires the correct messages; but changing the selection via script through UICamera.selectedObject seems to be leaving it (visually only) in the 'normal' state.  Maybe I'm missing a notification or something?

Thanks for your help,
Memige Den Adel
LOOT Entertainment

6
NGUI 3 Support / Re: UIButtonKeys panel switching
« on: March 16, 2014, 01:52:29 PM »
Alright, after playing around with a few options here is what I came up with:  I have a simple script as you suggested, which handles switching panels and passing selection between them, now I just call my scripts Bring-In and Take-Out functions as button events, and use the UIButton.current static combined with a button keys component look-up to quickly grab the next button I should select.  By caching the previous panel and button, this also makes canceling out of a menu a breeze. 

Having another minor issue that I'll post a new topic on, but thank you for your help on getting this part resolved.
-Memige

7
NGUI 3 Support / Re: UIButtonKeys panel switching
« on: March 14, 2014, 06:21:44 PM »
Thanks for the quick reply.

I don't seem to be getting the behavior you describe.  My layout is as you describe, with UIButtonKeys being the last components in the inspector, and the enable/disable happening from a callback set in UIButton's OnClick list.  After comparing what I have to the Controller Example scene, I believe the difference is I am not doing animations between menus, just a simple disable/enable.  This means that there is very little time in my flow during which both panels are active (Likely only a frame, depending on how NGUITools handles that)  Subsequently, the check in UIButtonKeys (Which checks to see if both the current and destination objects are active simultaneously) is very rarely if ever going to pass.  In the Controller example, the bring in and take out animations cause an approximately 0.5 second window in which both panels are active, giving plenty of time for UIButtonKeys to pass the baton, so to speak.  Our artists were pretty adamant that we not to transition animations, but if it's going to cause tech issues, I can convince them to do something simple.  Is there any way to get this to work without transition anims?

Best Regards,
Memige

8
NGUI 3 Support / UIButtonKeys panel switching
« on: March 14, 2014, 01:12:21 PM »
Hey there,

Quick question on the intended workflow.
Our project is using gamepads only for input, and so we are using UIButtonkeys on most everything menu related.  The current flow that we have is the following:
UIButtonkey on a menu button is given an Select On value of the button on the next menu, the UIButton is given on click functions to activate the next panel through NGUITools, fire any callback we may want at the time, and lastly to deactivate the current panel, again through NGUITools.  Previously this worked without a problem, as the UIButtonKeys script merely checked to see if the target button was not null; however, in the latest version it now checks to see if it is Active.  As the button is on a panel that is being activated, but in race conditions often isn't yet, the selection fails and I end up with no object in focus.  As a temporary work around I can alter UIButtonKeys to not care if the target is active yet, but I'm assuming there was a good reason for changing it, and I'd rather adjust my flow to fit the intended use, than to screw with the plug-in to make it fit my flow.

So given an active panel with a focused button, what is the intended method of deactivating the current menu, activating a new one, and setting the current focused object to a specific button on the newly activated menu?

Running NGUI 3.5.4 pro on Unity 4.3.4f1 Pro

Thanks Much,
Memige Den Adel
LOOT Entertainment

Pages: [1]