Tasharen Entertainment Forum
Support => NGUI 3 Support => Topic started by: concave on June 24, 2013, 03:41:47 AM
-
hi i recently bought nGUI and all in all its really a neat package. props to the developer(s). could you please give me a step by step introduction on how to "implement" multiresolution-abilty in nGUI. i allready saw related tutorials like sd/hd atlas switch and how the ui root works. what i didn't understand is how boxed and tweened panels holding ui widgets should be defined according to relative postinioning/scaling. e.g. should all elements be anchored to the bottom/left even ones that are boxed in another panel/widget? if so is it right that the gap between to examplebuttons would get bigger proportionally to the manualheight but the buttonsize stays the same? how would i update the buttonsize in this case - it seems that switching the atlas to higher resolution doesn't change the size of the button and its collider. would be thankful for getting help from a more expirienced nGUI dev.
i have drawn a quick mockup that might give a insight of my ui structure
(http://i43.tinypic.com/oiyc0i.jpg)
-
Judging from that mockup, you shouldn't be using any additional anchors there. You'll have one panel for your window underneath the default centered anchor, and create a window there. Keep the UIRoot as fixed size for simplicity.
-
hey aren! thanks for the fast reply - you r a really kind.
your'e right my mockup was rather whack - i tried to make a better one. (at the bottom)
> I think i have nearly that what you recommend. On Big ParentAnchor and Panel in this Panel i have some Subpanel and other Widgets.
> I have an atlas for 800px height and one for 1132px and an Refernce Atlas.
> I constructed the UI with the 1132px Atlas in fixed size on mobiles mode (So all widget elements including their colliders were automatically build by the widget tool in relation to the Spritesize)
> I tried it on the 1132height device and i fits perfectly
> IF I NOW - change the Referenced Atlas (to the 800px height atlas) and lower the manual height to 800px (and min /max height) 1. the colliders doesn't resize, but i left it that way and 2. if i build and run it on an 800px height device - the GUI doesn't fit - it is cut up at the bottom side (and on the left) like it didn't schrink to fixed size for the mobile.
what am i doing wrong!?!?
(http://i43.tinypic.com/33zeo40.png)
-
There are many threads on how to use reference atlases here. Some quite detailed. In your case there is really no point in doing that. 1132 vs 800 isn't much of a difference. Stick with one atlas. Keep the UIRoot at "fixed size". Don't resize anything.
-
thx!!! i did it like u said - no need to resize got that now and it works (still using reference atlases too)...
the unsolved probem is that as u see in the scribble i have a side panel coming in from the left when the parent panel is offsettweened on x axis.
this side panel (its components) has to grow related to the screenwidth - i use UIStrech and that part works - but the side Panel is not keeping its position - it doesn't keep position if i use an anchor (and tweens anchor offset) or if i just manullay set a position - if i switch devices resolutions (in unity) - the positioning of the sidepanel is destoryed - what am i doing wrong here? or what is going wrong?
my hierachy is setup as follows:
-Camera
--ParentAnchor(TopLeft - Offset is tweened to the right)
---MainPanelAnchor(TopLeft)
---SidePanelAnchor(TopLeft) / if enabled (the offset will be tweened)
----SidePanel (UIPanel,UIDraggablePanel)
-----Table(UITable)
------CheckBox (1...* Checkboxes)
-------Background (UIStrech accroding to camera)
-------Checkmark (UIStrech according to camera)
-----Label (Anchored to Left of Panel Container: SidePanel - Should stay on left even when checkbox sprites strechted by diff. device resolutions.)
kind regards,
con
-
Calculate the offset from center.
-1*(Sidepanelwidth/2 + (screen.width*uiroot.pixelsizeadjustment)/2) == offset from center.
Assume you've already calculated the sidepanel width, or read it from a background scale or something.
It's just math. :)