I can't find an email contact so I write here:
- I have one problem with NGUI 3.0.6. "NGUIText.CalculatePrintedSize" has two parameters and "UIFont.CalculatePrintedSize" has one parameter. I have had to changed that.
NGUIHTML.cs- Also, there is no reference exposed to the compiler so we can ask for the label height, I have changed this:
/// <summary>
/// our html compiler
/// </summary>
private HtCompiler compiler;
public HtCompiler Compiler {
get { return compiler; }
}
Another problem is that you can't ask for label height after changed it because you have to wait one frame. I have changed the code to this:
/// <summary>
/// setting text here will raise changed flag
/// </summary>
public string html {
get { return this._html; }
set {
this._html = value;
this.changed = true;
Update();
}
}
Another one. It's really slow in performance to "FindInParents" every frame for a component. So I changed it:
private UIScrollView uiDraggablePanel;
void Awake() {
uiDraggablePanel = NGUITools.FindInParents<UIScrollView>(gameObject);
}
And it the last lines of "Update" start coroutine only if has UIScrollView:
if (uiDraggablePanel && autoScroll != AutoScrollType.MANUAL) {
StartCoroutine(updateAutoScroll());
}
And last, if you have a text that it's in only one size (doesn't use <font size=>) it could be nice if we could set a maxHeight like maxWidth.
Here is a fast workaround.
The best option should check with a regular expression for "<font size=>" and decrement in one, so we can use multiple sizes.
float maxHeight = 200;
float currentSize = 18;
html.html = "<font size=" + currentSize + ">" + text + "</font>";
while (html.Compiler.CompiledHeight > maxHeight && currentSize > 1) {
html.html = "<font size=" + --currentSize + ">" + text + "</font>";
}