Author Topic: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]  (Read 51904 times)

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #15 on: September 26, 2013, 04:32:39 PM »
Will there be an update to handle the new structure of NGUI 3.0.0 anytime soon?

Thanks,
Justin

did something break in html engine when using ngui 3?

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #16 on: September 26, 2013, 04:40:37 PM »
Yes, I don't have the project on this computer but there were a few things that broke for me. I was able to "fix" most of them but somewhere there was a run of "GetHeight", "GetWidth", etc. that were totally broken and I was not sure how to address that.

The exact line was something like:
  1. UIAtlas.Sprite tmp = uiAtlas.spriteList [i];

Because spriteList now returns SpriteData and not UIAtlas.sprite.

~Justin

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #17 on: September 30, 2013, 04:35:20 PM »
In addition I have noticed that when I do some inline tags such as <i> or <b> that the spacing is off.
So this sentence:

"Hello <i>NGUI</i> HTML"

Looks like this

"HelloNGUIHTML

Where I would hope it looks like this:

"Hello NGUI HTML

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #18 on: September 30, 2013, 04:41:51 PM »
yeah i noticed the spacing issues, could you post some of the fixes you made, so that i could have a head start on fixes to implement.

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #19 on: September 30, 2013, 04:49:53 PM »
Yes I will try to find them tomorrow morning.

Are you the current developer on this HTML Engine?

~Justin

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #20 on: September 30, 2013, 04:54:06 PM »
no, im using the html system in a product though and these bugs could hold up the update to ngui3.0 if the fixes are not within reach. I've had to fix and change many things about the way the engine handles atlases and fonts from the resources folder, to adding localization support.

So im hoping this system doesnt get out of date.

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #21 on: October 02, 2013, 11:43:21 AM »
I upgraded NGUI again to the newest and we are completely broken for the HTML engine. So any fixes I had are totally worthless at this point. I have had to revert and I am wondering if you had a fix for that spacing issue with in line tags?

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #22 on: October 02, 2013, 11:55:02 AM »
my only solution right now is to use
  1. &nbsp;

after using the tag, sometimes 2 or 3, in rare cases 4 of those in a row.

i've also used it before a tag, when using <img> since images seem to have a small spacing issue as well.

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #23 on: October 09, 2013, 11:09:32 AM »
justiniso any luck with the newer versions of html engine?

we are not upgrading for a couple of weeks for stability reasons. just curious if you tested the latest version of html engine

justinISO

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 52
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #24 on: October 16, 2013, 08:57:44 AM »
Yup, updated and it works great!

bdominguez

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 1
  • Posts: 38
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #25 on: December 04, 2013, 09:30:41 AM »
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:

  1. /// <summary>
  2. /// our html compiler
  3. /// </summary>
  4. private HtCompiler compiler;
  5.  
  6. public HtCompiler Compiler {
  7.     get { return compiler; }
  8. }
  9.  

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:

  1. /// <summary>
  2. /// setting text here will raise changed flag
  3. /// </summary>
  4. public string html {
  5.     get { return this._html; }
  6.     set {
  7.         this._html = value;
  8.         this.changed = true;
  9.  
  10.         Update();
  11.     }
  12. }
  13.  

Another one. It's really slow in performance to "FindInParents" every frame for a component. So I changed it:

  1. private UIScrollView uiDraggablePanel;
  2.  
  3. void Awake() {
  4.     uiDraggablePanel = NGUITools.FindInParents<UIScrollView>(gameObject);
  5. }
  6.  

And it the last lines of "Update" start coroutine only if has UIScrollView:

  1. if (uiDraggablePanel && autoScroll != AutoScrollType.MANUAL) {
  2.     StartCoroutine(updateAutoScroll());
  3. }
  4.  

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.

  1. float maxHeight = 200;
  2. float currentSize = 18;
  3.  
  4. html.html = "<font size=" + currentSize + ">" + text + "</font>";
  5.  
  6. while (html.Compiler.CompiledHeight > maxHeight && currentSize > 1) {
  7.   html.html = "<font size=" + --currentSize + ">" + text + "</font>";
  8. }
  9.  

robq

  • Guest
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #26 on: December 04, 2013, 01:25:29 PM »
HtEngine.GetCompiler(); already exists

lzt120

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 68
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #27 on: December 16, 2013, 08:46:33 PM »
Please add support for NGUI 3.701.

Romano

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 32
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #28 on: December 20, 2013, 05:48:48 AM »
Not working with NGUi 3.0.7 f3 !!!! I have many errors. How fix?!

knifesk

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 10
    • View Profile
Re: HTMLEngine for NGUI and Unity3D.GUI [RELEASE]
« Reply #29 on: December 27, 2013, 09:12:03 AM »
There's a horrid bug that I cant get to fix... When (a) maxLineWidth is set, and NGUI is (b) set to FixedSize (actually is not set to fixed size, but screen height is less than UIRoot Minimum Height)  the text will always go beyond maxLineWidth. I am using dynamic fonts

Take a look:
 NGUIHTML maxLineWith is set to 1171pixels (clipping panel's width)
 Label generated by NGUIHTML is 1191pixels wide.. and it wont fit inside panel obviously.