Author Topic: UISlider  (Read 60791 times)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #15 on: November 12, 2014, 07:59:57 AM »
UIWidget (UISlider, collider)
- UISprite foreground
- UISprite background

That's the typical setup. You can use any widget for the foreground/background, not just a sprite. In Windward I used labels for example -- labels set to use dots as text (.............).

Andresfdezb

  • Newbie
  • *
  • Thank You
  • -Given: 10
  • -Receive: 0
  • Posts: 23
    • View Profile
Re: UISlider
« Reply #16 on: November 13, 2014, 06:45:23 AM »
UIWidget (UISlider, collider)
- UISprite foreground
- UISprite background

That's the typical setup. You can use any widget for the foreground/background, not just a sprite. In Windward I used labels for example -- labels set to use dots as text (.............).

Ok, my setup was different:

UISprite background (UIslider, collider)
- UIWidget (compound background)
- UISprite foreground

I'll give it a try. Thanks for the response!  :D

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider - not showing value linearly.
« Reply #17 on: November 21, 2014, 10:18:18 PM »
When I slide the thumb control to the right the bar doesn't update linearly. It fills to the right faster than the right-ward movement of the thumb. Also I can't move the thumb to the rightmost or leftmost edge of the slider. This happens on Retina iPad and iMac builds but not in the editor. It is more pronounced on Retina devices. What could be causing this?
« Last Edit: November 21, 2014, 10:34:11 PM by TokyoDan »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #18 on: November 22, 2014, 01:34:54 PM »
Create a widget - ALT+SHIFT+W and change its pivot to top-left.
Add a collider to it - ALT+SHIFT+C.
Add a UISlider to it.
Add anything you like below it.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider
« Reply #19 on: November 22, 2014, 03:56:35 PM »
Thanks. But I am not asking how to make a UISlider. I know how to make a UISlider and that is what I did. I am asking why it acts funny as I explained.
« Last Edit: November 22, 2014, 07:34:31 PM by TokyoDan »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #20 on: November 25, 2014, 01:47:19 AM »
Hmm. I see no reason for that. How can I reproduce it on my end using the sliders that come with NGUI?

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider
« Reply #21 on: November 25, 2014, 01:54:28 AM »
I just made a slider. and that is what happens. Then I redid it using your clean sample in your previous post with all the default settings and it still happens. The only way I can really show you is to send you my project and tell you where the sliders are defined. Then you build for a Mac and a Retina iPad, run it on device, then you should see it. It doesn't happen in the editor. That's what confuses me.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #22 on: November 25, 2014, 02:18:41 AM »
What version of NGUI? Retina iPad has a very high resolution. You can fake it in the editor by using a constrained UIRoot with a high resolution.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider
« Reply #23 on: November 25, 2014, 02:42:23 AM »
3.7.5

In my scene on the same hierarchical level I got two UIRoots ("GameMessages Root" and "Sound UI Root" ) and one NGUI Camera.

"Sound UI Root" is the place that has the problem sliders. Both UIRoots are set like this:
Constrained OnMobiles
Current Width: 1280: Fit: unchecked
Current Height: 480; Fit: checked

The actual size of the game is 525 x 700.

RafiMagsi

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
Re: UISlider
« Reply #24 on: November 26, 2014, 05:48:18 AM »
Regarding UISlider, How I can use images in background, foreground and thumb ? So I can make the custom style.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #25 on: November 26, 2014, 09:08:22 PM »
@TokyoDan: First update to 376. Second, change your game view to use even dimensions. 525 doesn't divide by two cleanly. Last, I don't get your dimensions... 1280x480 is very different from 525x700, and not just in size but in aspect ratio. What are you trying to do?

@RafiMagsi: I don't understand your question. If you're asking about using UITexture, then I see no issue with it. Just do that. Progress bars work with widgets.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider
« Reply #26 on: November 27, 2014, 04:03:56 AM »
525x700 is the actual size of the game in Mac & web builds.

For iOS builds the UIRoot is set to 1280x480 for that ResolutionSwitchController (from way back) and has nothing to do with the actual size of the game which already successfully fills the Retina and non-Retina iPads in portrait orientation. The 1280 x 480 (480 for Portrait orientation) determines where the hires (Retina) normal-res (non-Retina) cutoff is so the the proper hires/normal-res fonts will be swapped in/out. This keeps the fonts crisp on both Retina and non-Retina devices.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #27 on: November 27, 2014, 09:04:00 PM »
1280x480 is landscape, not portrait.

Also 525 is not dividable by two, as I mentioned. This means your UI will always be blurry.

TokyoDan

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: UISlider
« Reply #28 on: November 28, 2014, 03:03:31 AM »
I changed the 525 to 526. And that 1280 x 480 is what is automatically set whenever I create a UIroot or do something that creates one even if I don't want it to. Even reading the manual about UIroot doesn't give me an idea of how those measurements related to the actual size of my game (the part that isn't using NGUI). Most of the time I use NGUI an an overlay for my game which is now 526x700. If I tap the pause button which is a normal non-NGUI 3D game object it overlays my normal 3D game screen with the NGUI sliders. So that is why the game size of 526x700 is different from the UIroot of 1280x480 which was set by default when the UIroot was created.

It's all very confusing and even reading the manual I have no idea of how anything NGUI relates to the non-NGUI part of my game as far as size.  Although it kooks OK when built and in the Game window. e.g. the sliders may take up the top 1/4th of the actual game, the NGUI whatever I have is always very very small in the scene window (about 1/10th of the actual game) and I have to zoom way in to see it.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: UISlider
« Reply #29 on: November 30, 2014, 05:56:02 AM »
Select the UIRoot, change it to be Constrained, and choose the 526x700 dimensions for it.