-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add scrolling text component and tag #24
base: master
Are you sure you want to change the base?
Conversation
I'd suggest making ScrollingText inherit TextMeshProUGUI so that you can use it like normal text without things breaking. This also comes with the advantage that the TextMeshProUGUI TypeHandler will work with it so you will be able to use all text properties. Would also just make the overall implementation cleaner I think. |
I originally wanted to do that (adding the TextMeshProUGUI into a ExternalComponents component), but I needed a way to stop and restart the animation coroutine after reassigning the text or font size. So pretty much, any time the TextMeshProUGUI has some property changed that also changes the width of its RectTransform, the component needs to recalculate some ratios to determine whether to restart the scroll animation. Hence why there are those text and fontSize properties in the ScrollingText class. Is there any way around that? As far as I know, there doesn't seem to be any kind of event that I can hook onto whenever the embedded text component has its RectTransform changed. |
It's a Graphic so you should be able to do what you need by registering your method with RegisterDirtyLayoutCallback. |
- explanation for why in the code comment
Finally got around to finishing this. I also added in the test view I was using for this into the TestViewController. Maybe this would be useful in SongCore to get rid of the ellipses for the custom difficulty labels now that the don't wrap to a new line. |
6b51a68
to
7b3e27a
Compare
dc78553
to
b52f4b7
Compare
170ffb9
to
3cd3a35
Compare
Scrolling text for banners and other fancy stuff
Acts the same as a regular text tag (although it's missing some of the properties that the regular text tag has) until the text given to it is longer than the RectTransform. Once the text is longer, the text is scaled down to fit until the textWidthRatioThreshold (ratio between text width vs container width) is reached. This was done so the animation doesn't activate for text that is just barely longer than the container.
This example view controller results in this
Also, added that enum parser in Parse. Probably should've been its own commit but ¯\(ツ)/¯