Author Topic: world select system  (Read 2857 times)

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
world select system
« on: February 12, 2014, 01:35:17 PM »
wanna make a world selection, that looks like this (haven't got the real one from my artist  :P. just a prototype)


or another source:
here
here
and here


I'm using 2 camera. UIRoot camera for UIs that need anchor (the top panel for level and money)
and MainCamera for the world w/ UICamera attached as it's needed to manage ngui events.

I thought it's an NGUI button prefab that I just need to place in mainCamera.
but when I drag the button prefab to mainCamera, the mainCamera automatically became child of UIRoot, and everything that I place in mainCamera is not visible.

I can't put the world buttons in the UIRoot, cos i'm using pixel perfect, and the background and button position missed.
it looks terrible when u actually place a ship button on the sea, and when u run it, the ship button goes to mountain. DX

a screenshot using my tab. I don't like the fixedsize. it's like a mess.
fixed size

and here's the pixel perfect screenshot, but the background and button missed.
pixel perfect

any suggestion? thanks.  ;D

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: world select system
« Reply #1 on: February 13, 2014, 12:50:23 AM »
You need to have a UIPanel present in order for things to not get re-parented. If there is no panel, NGUI tries to figure out where something should be, and it may not always determine it properly.

So make sure that every widget has a UIPanel on one of its parents in the hierarchy.

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: world select system
« Reply #2 on: February 13, 2014, 05:41:45 AM »
UIPanel that I created outside UIRoot always have a huge size (about 15x mainCam size)
whether I attach it inside mainCam or create another empty object.
The scale is 1x1x1, and Clipping : None.

Works well. Now I can position the UIButton precisely on top of the background.  ;D
but I need to scale objects using widget dimension to make things right.
object with scale 0.00625x0.00625 can't be rescaled using free transform.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: world select system
« Reply #3 on: February 14, 2014, 06:02:39 AM »
UIRoot is what scales itself to 2 / Screen.height, since all widgets use sizes in pixels. This is what keeps the UI small compared to everything. If there is no UIRoot, then it's up to you to scale your panels. Nothing is stopping you from scaling the panel using the transform -- although I would advise creating a game object that you'd scale instead:

GameObject (scaled to some small number)
- UIPanel
-- UIWidget

johanesnw

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: world select system
« Reply #4 on: February 16, 2014, 11:53:00 PM »
wow perfect. thanks  :D