Welcome,
Guest
. Please
login
or
register
.
January 23, 2025, 03:08:37 AM
Home
Help
Search
Login
Register
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Long Popup List
« previous
next »
Print
Pages:
1
2
[
3
]
Author
Topic: Long Popup List (Read 23777 times)
Russel
Newbie
Thank You
-Given: 3
-Receive: 0
Posts: 23
Re: Long Popup List
«
Reply #30 on:
June 13, 2013, 12:29:56 PM »
Could this be a rounding error? Or is this a completely wrong approach?
I need quick help. Thank you!
Logged
ArenMook
Administrator
Hero Member
Thank You
-Given: 337
-Receive: 1171
Posts: 22,128
Toronto, Canada
Re: Long Popup List
«
Reply #31 on:
June 13, 2013, 05:22:18 PM »
That's because you are dividing an integer by another integer. You need to work with floats, not integers.
Logged
Russel
Newbie
Thank You
-Given: 3
-Receive: 0
Posts: 23
Re: Long Popup List
«
Reply #32 on:
June 14, 2013, 02:26:30 AM »
Thank you! Yes, that was the problem. You saved my day
.
Logged
huhudage
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 5
Re: Long Popup List
«
Reply #33 on:
July 04, 2013, 07:10:30 AM »
I fixed the problem about Highlight's position, just change mHightlight's parent from Dropdown-list to the the Panel.
Logged
sonicviz
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 58
Re: Long Popup List
«
Reply #34 on:
July 19, 2013, 05:34:21 AM »
Hi,
Thanks for the work on this.
I'm trying it out but I'm getting clipping issues with the drop down text at the bottom, as shown in the attached image.
Any clues on how to make it clip within the border properly?
ty!
Logged
sonicviz
Jr. Member
Thank You
-Given: 0
-Receive: 0
Posts: 58
Re: Long Popup List
«
Reply #35 on:
July 19, 2013, 07:20:32 AM »
I don't know why but I had to adjust the scrollbar and clipping by - 10
//. scrollbar Background
mScrollBar
.
background
=
NGUITools
.
AddSprite
(
mScrollBar
.
gameObject
, atlas, scrollBackgroundSprite
)
;
mScrollBar
.
background
.
depth
=
NGUITools
.
CalculateNextDepth
(
mChild
)
;
mScrollBar
.
background
.
gameObject
.
name
=
"Background"
;
mScrollBar
.
background
.
cachedTransform
.
localScale
=
new
Vector3
(
10
, popupHeight
-
10
,
1
)
;
BoxCollider bc1
=
NGUITools
.
AddWidgetCollider
(
mScrollBar
.
background
.
gameObject
)
;
bc1
.
center
=
new
Vector3
(
bc1
.
center
.
x
,
-
0
.
5f, bc1
.
center
.
z
)
;
//. scrollbar Foreground
mScrollBar
.
foreground
=
NGUITools
.
AddSprite
(
mScrollBar
.
gameObject
, atlas, scrollForegroundSprite
)
;
mScrollBar
.
foreground
.
depth
=
NGUITools
.
CalculateNextDepth
(
mChild
)
;
mScrollBar
.
foreground
.
gameObject
.
name
=
"Foreground"
;
mScrollBar
.
foreground
.
cachedTransform
.
localScale
=
new
Vector3
(
10
, popupHeight
-
10
,
1
)
;
BoxCollider bc2
=
NGUITools
.
AddWidgetCollider
(
mScrollBar
.
foreground
.
gameObject
)
;
bc2
.
center
=
new
Vector3
(
bc2
.
center
.
x
,
-
0
.
5f, bc2
.
center
.
z
)
;
//. assign scrollbar to panel
mChildDraggablePanel
.
verticalScrollBar
=
mScrollBar
;
// setting panel's clip area
mChildPanel
.
clipping
=
UIDrawCall
.
Clipping
.
HardClip
;
float
clipW
=
x
;
float
clipH
=
popupHeight
-
10
;
// -y + bgPadding.y;
mChildPanel
.
clipRange
=
new
Vector4
(
clipW
/
2
,
-
clipH
/
2
, clipW, clipH
)
;
Logged
KovaaK
Newbie
Thank You
-Given: 0
-Receive: 0
Posts: 1
Re: Long Popup List
«
Reply #36 on:
May 03, 2014, 12:08:37 PM »
Just as a heads-up to anyone else who arrives here via google search, the code attached in previous posts seems to have been written before some changes to how NGUI handles depth. I'm far from an expert in this environment (only first heard of NGUI a week ago and dug into it a few days ago), but I fixed some issues related to the dropdown text not being drawn by going near line 500 in UIPopupListEx.cs (where these lines are):
//. Draggable Panel
mChildPanel
=
NGUITools
.
AddChild
<
UIPanel
>
(
mChild
)
;
mChildDraggablePanel
=
mChildPanel
.
gameObject
.
AddComponent
<
UIDraggablePanel
>
(
)
;
mChildDraggablePanel
.
scale
=
new
Vector3
(
0
,
1
,
0
)
;
mChildDraggablePanel
.
scrollWheelFactor
=
1
;
mChildDraggablePanel
.
showScrollBars
=
UIDraggablePanel
.
ShowCondition
.
Always
;
and changing it to:
//. Draggable Panel
mChildPanel
=
NGUITools
.
AddChild
<
UIPanel
>
(
mChild
)
;
mChildPanel
.
sortByDepth
=
true
;
// Depth issue fix - KovaaK
mChildDraggablePanel
=
mChildPanel
.
gameObject
.
AddComponent
<
UIDraggablePanel
>
(
)
;
mChildDraggablePanel
.
scale
=
new
Vector3
(
0
,
1
,
0
)
;
mChildDraggablePanel
.
scrollWheelFactor
=
1
;
mChildDraggablePanel
.
showScrollBars
=
UIDraggablePanel
.
ShowCondition
.
Always
;
And I apologize for the really old thread bump.
Logged
Lumos
Newbie
Thank You
-Given: 7
-Receive: 4
Posts: 21
Re: Long Popup List
«
Reply #37 on:
June 05, 2014, 12:10:17 PM »
Excuse my slight thread necromancery, but I found the posted scrollable list completely useless, as it failed to work for me - let's face it, it's from 2012 and quite a bit of things have changed in NGUI 'till now; even porting the bloody thing was a pain in the arse. This led me to create
a replacement
, which I hope will prove more useful to everyone.
</shameless self-advertising>
Logged
Print
Pages:
1
2
[
3
]
« previous
next »
Tasharen Entertainment Forum
»
Support
»
NGUI 3 Support
»
Long Popup List