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 - Samhayne

Pages: [1]
1
NGUI 3 Support / Re: Minimum Height for a Label?
« on: October 20, 2014, 08:36:13 AM »
Hi ArenMook,

Hm... I tried this script but my text ...

1
2
3
4
5

turned into

1
2
3
4
[00]5

then. With the 5 not being shown any more.

I missed to point out that the label should still show all the content and resize.
I just want it to keep a minimum height.


edit: I helped myself now by modifying your "EnvelopContent" script you posted here:
http://www.tasharen.com/forum/index.php?topic=8659.0

2
NGUI 3 Support / Minimum Height for a Label?
« on: October 16, 2014, 08:46:44 AM »
Hey,

is there a sane way to assert a certain minimum height of a widget?

I saw that there is a minHeight value in the widget class, though it has nor setter
and we don't want to edit the NGUI sources.

What I want to achieve:

A textbox like this which dynamically enlarges the window...



... but...

If it's just one line of text I don't want everything to collapse to one
line (using Overflow: ResizeHeight) as it looks weird....



... instead I'd like a minimum height to be preserved.





At the moment the window borders are anchored to the text label.


Already thought about some dummy padding widget which would adapt its
height to a needed value by constantly measuring the height of the text
field but....  *blearch* ... this would be a dead ugly solution.

3
Hey Nicki, =)

True. That's the way how I understood UiPanel.
Just starting to look deeper into Ngui and took for granted that UiPanel would be meant to create panels from.
That's indeed a bit misleading...

Okay. You are right. I am wrong. =)

4
Because of the "is a" relation of self defined panels.
A Shop Panel is a Panel.
(where I also want to have access to all non-private Panel functionality from).

It's very weird OO to define that a Shop Panel "has a" panel.


Chose...

  1. // Alternative A:
  2. [RequireComponent (typeof (UIPanel))]
  3. public class ShopPanelA : MonoBehaviour {
  4.     private UIPanel panel;
  5.  
  6.     void Awake() {
  7.         panel = GetComponent<UIPanel>();
  8.         NGUITools.AddChild<ItemA>(this.gameObject);
  9.         NGUITools.AddChild<ItemB>(this.gameObject);
  10.         NGUITools.AddChild<ItemC>(this.gameObject);
  11.     }
  12. }
  13.  
  14.  
  15. // Alternative B:
  16. public class ShopPanelB : UIPanel {
  17.     protected override void Awake() {
  18.         base.Awake();
  19.         NGUITools.AddChild<ItemA>(this.gameObject);
  20.         NGUITools.AddChild<ItemB>(this.gameObject);
  21.         NGUITools.AddChild<ItemC>(this.gameObject);
  22.     }
  23. }

5
Hey, =)

I just stumbled over the fact that it's unnecessarily complicated to inherit
from a UIPanel due to it's Awake() method being private.

That's especially problematic as Awake() is Unity's substitute for a constructor.
=> inheriting classes can't initiate values/objects cleanly and it's even impossible to
add components on gameobject creation.

I strongly suggest opening this and other MonoBehaviour methods for overriding
by making them protected virtual.

As soon as you want to create really, really complex UIs you end up scripting
widgets and run into problems there.

6
NGUI 3 Support / Re: Best way to create masses of panels
« on: February 04, 2014, 12:23:20 AM »
Tried it with a standard UiPanel as parent... the performance was awful.
5fps with 200-300 panels with a sprite each.
Having loads of panels seems to be a real issue...

I removed the panel and just parented them under a gameobject.
Performance was better (80fps)... but dropped quickly when adding another
sprite and a label.

The fact that these panels/gameobjects move around all the time seems to
kill NGUI.

I hope there is a recipe for this problem.

7
NGUI 3 Support / Best way to create masses of panels
« on: February 03, 2014, 04:50:26 PM »
Hey,

so... we have indicators above our enemies
showing name, health, magic, symbols for active spells...

There could very well be 50 or more that need to be drawn.

What's the most performant structure for this?

- Having one panel and add one gameobject parent per indicator
containing sprites, labels, etc and we just move the indicator around by
moving the parenting gameobject?

- Having loads of UiPanels marking it with widgetsAreStatic and move those
panels around

- ...?

Pages: [1]