Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - MastaC

Pages: [1]
1
NGUI 3 Support / Re: Injecting color codes into UIInput Label
« on: January 20, 2016, 10:37:18 PM »
Thank you!

I created two UILabels and layered them directly on top of each other. Changed the background label's text to be the same color as the background so I could keep the caret. Other label is processed directly on top of it. Works like a charm.

As for Lua, frankly I didn't know you could work with C# at runtime! We'd have to see if this is viable for us, as we need fine control over what the player can and can't do. Thanks for giving us that insight though.

Cheers!

2
NGUI 3 Support / Injecting color codes into UIInput Label
« on: January 16, 2016, 12:15:21 PM »
Hi guys,

I'm writing an in-game Lua scripting system for my game and trying to implement syntax highlighting. Right now I'm listening for the UIInput's onChange, taking the UIInput.value, and inserting the formatted text into the UIInput.label.text. That works great and keeps the text formatted without tampering with the UIInput's actual value, which is read and saved to a .lua file.

Unfortunately this clears the formatting any time I click in or out of the UIInput. Ok, so I add UICamera.onSelect and process the text again each time the Input is selected or deselected. That part works great when deselected the Input, but not when selecting.

I can't, for the life of me, get the text to consistently stay color formatted. Am I going the wrong direction by taking UIInput.value, processing it, and assigning that text to its UILabel? What would be the best method of getting this done cleanly?

Thanks!

Pages: [1]