Author Topic: Request: ManualUpdate of panels/widgets  (Read 3547 times)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Request: ManualUpdate of panels/widgets
« on: April 23, 2012, 02:25:05 AM »
I have a request. Because of the script execution "bug" I've encountered earlier (old forums), I've made a modification to NGUI that fixes it.

The problem was that some things tended to only be drawn an update later than it was activated, causing a single frame of empty screen, which is weird in a paged menu.

I've added two methods to UIPanel.cs and UIWidget respectively to get this to activate and draw immediately.

  1. public void RefreshNow()
  2. {
  3.    gameObject.BroadcastMessage("ManualUpdate", SendMessageOptions.DontRequireReceiver);
  4. }
  5.  

  1. virtual public void ManualUpdate()
  2. {
  3.   if (this.enabled) panel.AddWidget(this);
  4. }
  5.  

Every time I update NGUI (which is quite often, go Aren) I have to add this again, but since I could see others having the same problem, I want to request that this is added to NGUI (or something of a similar fashion).
« Last Edit: April 23, 2012, 02:56:01 AM by Nicki »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Request: ManualUpdate of panels/widgets
« Reply #1 on: April 23, 2012, 02:28:14 AM »
Have you tried broadcasting "CreatePanel" instead?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Request: ManualUpdate of panels/widgets
« Reply #2 on: April 23, 2012, 02:54:45 AM »
I have not, but I'll try right now. :)

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Request: ManualUpdate of panels/widgets
« Reply #3 on: April 23, 2012, 03:00:37 AM »
Well jeez, way to make my work much easier! just broadcasting CreatePanel on the gameObject I would have called RefreshNow on, does it just as well.

Thank you. :D