Author Topic: Feature Suggestions  (Read 5132 times)

Ghost1082

  • Guest
Feature Suggestions
« on: April 12, 2012, 11:03:13 AM »
First.. THANKS!!!
NGUI is a godsend!!! Thanks for all the hard work and awesomeness!!

Thought I would start a topic to keep track of things that people would like to see included in NGUI (types of widgets, components, fixes, features, examples, etc..)
Maybe once it gets organized a bit, we can make a sticky.

So, based on my last post on the old forum:

A damage indicator widget / example :)

tripclaw

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Feature Suggestions
« Reply #1 on: April 12, 2012, 11:50:45 AM »
Damage indicator? Just curious what you mean by that? Is that for a filled sprite (health bar), where when you take damage you see the area between your last health bar and the new health bar as a chunk highlighted red? Like in street fighter's health bars, for example.

Ghost1082

  • Guest
Re: Feature Suggestions
« Reply #2 on: April 12, 2012, 12:07:28 PM »
That would be cool, but I was referring more to a WoW-esque display of how much damage you just did that floats above a units head then disappears.
I have an implementation using a prefab label that gets instantiated then destroyed, but I'm sure there is a more elegant/performant solution. :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Feature Suggestions
« Reply #3 on: April 12, 2012, 02:40:37 PM »
The way I set it up for Windward, is each GameUnit in the world references a corresponding UnitHUD on the HUD panel (which can be added dynamically if it doesn't exist). The UnitHUD is used to display the unit's health bar, and it also references a pair of HUDText scripts. One for damage indicators, and one for messages (notifications and such). When I want to display a message above the unit's head, I do unit.hud.messageText.Add("SomeMessage", color, duration), where 'duration' is how long I want it to stay 'sticky' until it starts floating away. It's useful for crits and such.

What does the HUDText script does inside its Add function? First it checks to see if the previous text message and the current text message are both numeric. If so, it adds the new message to the old message instead (this way 10 hits in a second go into the same label). If not, it creates a new label entry and keeps track of it (when it was created, how long it's supposed to stay sticky). Inside the update function it simply moves the label upwards if it's time to do so, and eventually fades it away and finally -- disables it. The same label is reused for the next HUDText.Add call so that the memory is reused rather than re-allocated.

End result is what you see in Windward. Hint: you can talk by pressing 'enter'.

N3uRo

  • Guest
Re: Feature Suggestions
« Reply #4 on: April 13, 2012, 03:27:05 PM »
+1

I like the idea to create a wishlist / feature suggestions.

I make one (so easy also):

I want UIInput to be able to set numeric only.