Author Topic: (!!!) Improving NGUI: Voice your opinion  (Read 928081 times)

Dover8

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 20
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #255 on: March 11, 2014, 10:16:43 AM »
May I make the suggestion that the FitInternalKeepingRatio option of UIStretch also takes into account the realativeSize variable? I've done this in my version and use it a lot to make pop up boxes fit say 80% of the width of the screen on whichever device they're on. As relative size is set to (1, 1) by default this change doesn't effect the widgets until the relative size variable is changed.

  1.                         else if (style == Style.FitInternalKeepingRatio)
  2.                         {
  3.                                 // Contributed by Dylan Ryan
  4.                                 float screenRatio = rectWidth / rectHeight;
  5.                                 float imageRatio = initialSize.x / initialSize.y;
  6.  
  7.                                 if (imageRatio > screenRatio)
  8.                                 {
  9.                                         // Fit horizontally
  10.                                         float scale = rectWidth / initialSize.x;
  11.                                         size.x = rectWidth * relativeSize.x;                            //added * relativeSize.x
  12.                                         size.y = initialSize.y * scale * relativeSize.y;                //added * relativeSize.y
  13.                                 }
  14.                                 else
  15.                                 {
  16.                                         // Fit vertically
  17.                                         float scale = rectHeight / initialSize.y;
  18.                                         size.x = initialSize.x * scale * relativeSize.x;                //added * relativeSize.x
  19.                                         size.y = rectHeight * relativeSize.y;                           //added * relativeSize.y
  20.                                 }
  21.                         }
  22.  

blitzer

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #256 on: March 11, 2014, 01:44:12 PM »
I would love to see embedded font size, embedded line spacing, embedded text alignment, and embedded font style.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #257 on: March 11, 2014, 05:58:04 PM »
UIStretch is a deprecated component, Dover8. The new layout system replaces its functionality, and all widgets have an aspect ratio you can set.

helmesjo

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 116
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #258 on: March 12, 2014, 02:03:03 AM »
UIStretch is a deprecated component, Dover8. The new layout system replaces its functionality, and all widgets have an aspect ratio you can set.

I must be missing something here, but how can the new layout system replace UIStretch, when it doesn't support basic equal size functionality? Just to clarify, I'm talking about pure "Equal size", independent of distance from edge to edge... With the new layout system, all I'm able to do is set that "A:s top edge is 10px away from B:s top edge" right? And if I translate A away all hell break lose correct? In my case where I just need a panel to be equal size to the camera, UIStretch works great...

hlx

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 4
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #259 on: March 12, 2014, 02:30:15 PM »
I would greatly like multi monitor support. Right now the anchor system really only works for one monitor.  It would also be great to have moveable "dockable" GUI zones for customizing your in-game GUI interface.

Totally agree with you. I am actually thinking about prototyping a Gui for a Windows application that should emulate an Instructor Operating System for a Simulator project. Dockable components and multi monitor support is really needed in my case. Maybe, there is a native Unity  limitation that doesn t let NGUI doing this easily ?

Hlx

N3uRo

  • Guest
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #260 on: March 12, 2014, 04:39:03 PM »
UIStretch is a deprecated component, Dover8. The new layout system replaces its functionality, and all widgets have an aspect ratio you can set.

It's NOT the same:

- With UIStretch you can stretch both sides BUT you can MOVE freely your sprite.

- With the new anchor system it forces the position and you can't move it (try unified with left 0, right 0, top 0, bottom 0 to panel or uiroot).

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #261 on: March 13, 2014, 12:23:02 AM »
It's NOT the same:

- With UIStretch you can stretch both sides BUT you can MOVE freely your sprite.

- With the new anchor system it forces the position and you can't move it (try unified with left 0, right 0, top 0, bottom 0 to panel or uiroot).
You can move an anchored widget quite easily:
  1. NGUIMath.MoveWidget(widgetOrPanel, X, Y);

N3uRo

  • Guest
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #262 on: March 13, 2014, 12:36:21 AM »
You can move an anchored widget quite easily:
  1. NGUIMath.MoveWidget(widgetOrPanel, X, Y);

Where was that? I didn't know that!

And if you have a "window" grouped and you want to move it not being a widget or panel? or it has to be always a widget or a panel?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #263 on: March 13, 2014, 12:50:19 AM »
A plain window game object wouldn't be anchorable using the new layout system as it's not a widget or a panel, so the question becomes moot, as you then simply adjust the transform's localPosition.

helmesjo

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 116
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #264 on: March 13, 2014, 02:47:22 AM »
You can move an anchored widget quite easily:
  1. NGUIMath.MoveWidget(widgetOrPanel, X, Y);

I'm sorry but that's more of a hack than a pure solution... If you insist on keeping the current layout-system I would much appreciate it that you didn't deprecate UIStretch. I'm sure it's more used than you think.
I can't stretch it enough (no pun intended!) that you should really look into a constraint-system and do it the right way. Actually, I did put one together myself for our own needs, and it's as easy as just extracting one value from another object and apply it to some value on the other object (basically a pair of switch-cases). The hard part is the solver, which is a big subject on its own but totally doable within a reasonable timeframe (I can imagine). We had a tight deadline so I settled with callbacks & brute force which is of course limited but works. I promise you, once you've tried it out you'll understand the incredible easy of use.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #265 on: March 13, 2014, 06:09:24 AM »
I think the data binding system I'm adding here will help here. You can just say "this property will now always update this other object's property".

So if you wanted one widget's width to update the other widget's width, you can do just that.

gyd

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 87
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #266 on: March 13, 2014, 06:48:46 AM »
For supporting the HOTKEY system by NGUI,
Could the OnKey support all keys' events? (and modifiers of key)
or add a new callback OnKeyDown/Up ?

i know i could do that in Update() myself, but if i do so, there will be 2 Key checking code in my system, thx.

N3uRo

  • Guest
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #267 on: March 13, 2014, 02:38:57 PM »
A plain window game object wouldn't be anchorable using the new layout system as it's not a widget or a panel, so the question becomes moot, as you then simply adjust the transform's localPosition.

I know that but I was speaking of moving all the hierarchy (with possible anchored widgets) beneath relatively.

The main problem I see with the new anchoring system is that you mix positioning and dimensioning... Sometimes I only want to scale an object not force it's position to the anchored widgets. That's why I mentioned the UIStretch case, with that you can fill the entire screen and move localPosition where you want not being forced by any anchors...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #268 on: March 14, 2014, 11:46:46 AM »
@gyd: UIKeyBinding.

@N3uRo: Again, data binding / value binding / whachawannacallit system I'm working on will be able to do just that.

TommyT31

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 21
    • View Profile
Re: (!!!) Improving NGUI: Voice your opinion
« Reply #269 on: March 17, 2014, 05:13:14 PM »
A great feature that I think would be nice I just realized that would be to have an optional button text color when the button is disabled. I have disabled sprites for my buttons but now I manually change the text color to grey  then back to white when its reenabled. Being able to have this as a option on the buttons would be sweet.