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

Pages: [1]
1
NGUI 3 Support / Word wrapping in UILabel breaks at last character
« on: June 18, 2014, 09:49:10 AM »
Hey everyone,

I've been struggling with this for a while. Found some posts here on similar issues, but none of them solved my prob.
We're using NGUI 3.6.1, developing an app for mobile (Android & iOS) which contains tons of dynamic texts.
Our customer is in Germany, meaning... lots of long German words :-)

On multiline UILabels with "ResizeHeight", when the last word in the line is just a bit too long, sometimes the last character
is broken into a new separate line.
It doesn't even "join" the following line - it's much worse - the last character appears in a separate line of its own,
then another line break, and only then the rest of the text continues...

I've tried to dig into the UILabel code and NGUIText.WrapText(), but gave up pretty quickly :-)
Maybe someone has already found a solution for this?

TNX

Daled.

BTW, I'm using bitmap fonts

2
NGUI 3 Support / Re: Objects "Jumping" to place
« on: June 03, 2014, 05:38:00 PM »
Thanks!
I'm waiting for updates.


3
NGUI 3 Support / Re: Objects "Jumping" to place
« on: June 03, 2014, 03:18:43 PM »
Yes, of course, I'm using anchors heavily, to position all my objects
relatively to the screen and to each other.

But their position is only set once, on startup, and then it doesn't change -
so I expected all the calculations to be performed once, on startup, and having
all the objects appear immediately at their correct position...

4
NGUI 3 Support / Objects "Jumping" to place
« on: June 02, 2014, 10:32:53 AM »
Hey,

I've created a few quite complex NGUI layouts (NGUI 3.6.0).
I've noticed that when the scene starts, the objects don't appear right in place -
but seem to appear elsewhere, and "jump" into place in some quick animation.

Is there a way to avoid that, and make them appear immediately in their correct position?

TNX

5
NGUI 3 Support / Re: Anchoring prefab items in UITable
« on: May 29, 2014, 10:24:44 AM »
Perfect!!

Of course, like you said, I didn't try to keep external references in the prefab -
I had to explicitly set them into the object after instantiation...
But indeed I forgot to call ResetAnchors() and UpdateAnchors().

If anyone else ever encounters this problem - here's my fixed code.
It works like a charm! TNX A lot  ;)


public GameObject table;
public GameObject scrollView;
public GameObject itemPrefab;

GameObject item = Instantiate(itemPrefab, table.transform.position, table.transform.rotation) as GameObject;

item.transform.parent = table.transform;
item.transform.localScale = Vector3.one;
item.leftAnchor.target = scrollView.transform;
item.rightAnchor.target = scrollView.transform;
item.leftAnchor.Set(0, 0);
item.rightAnchor.Set(1f, 0);

item.ResetAnchors();
item.UpdateAnchors();

table.GetComponent<UITable>().Reposition();

6
NGUI 3 Support / Anchoring prefab items in UITable
« on: May 29, 2014, 04:10:17 AM »
Hey there!

I'm developing a mobile app, where the screen is actually a vertically scrollable list of items.
The items are basically sprites, which always fill the width of the screen, but their height
depends on their contents (child sprites and labels).

So:
My scene's hierarchy looks like this: UIRoot -> ScrollView -> UITable (vertical) -> items.

ScrollView is anchored to UIRoot (left-anchor to left-of-parent, right-anchor to right-of-parent, etc.)

And each of the table items is anchored as follows ("Advanced" anchoring):
Left anchor: attached to the scroll view's left
Right anchor: attached to the scroll view's right
Top anchor: Unset (I leave it empty so the table can take care of positioning the items vertically)
Bottom anchor: attached to the bottom of the lowest child or this item (so the item's height will
automatically change according to the item's contents).

This works BEAUTIFULLY!!
But only when my items are static, instantiated in advance.

When I try to instantiate the items using prefabs, it doesn't work anymore :-(
It's totally strange - in the scene view - everything looks fine, all the parameters are correct.
But in the game view - I can't see the items.
Only when I manually change one of the item's parameters in the scene view
(e.g., change "Right anchor" numeric value from 0 to 1), then change it back to 0...
only then the item magically appears in the table.
I tried to do the same in code (change a parameter, then change it back) -
but couldn't reach the same effect  :-(

Prefabs are created as follows:


public GameObject table;
public GameObject scrollView;
public GameObject itemPrefab;

GameObject item = Instantiate(itemPrefab, table.transform.position, table.transform.rotation) as GameObject;

item.transform.parent = table.transform;
item.transform.localScale = Vector3.one;
item.leftAnchor.target = scrollView.transform;
item.rightAnchor.target = scrollView.transform;
item.leftAnchor.Set(0, 0);
item.rightAnchor.Set(1f, 0);

table.GetComponent<UITable>().Reposition();



What am I doing wrong?
Any ideas?

TNX

7
NGUI 3 Support / Re: UILabel: Scaling font by screen width
« on: April 23, 2014, 09:08:54 AM »
My problem is not the size of the box - I managed to do that already.
The problem is the size of the font - how to make it relative to the
box's width.

TNX

8
NGUI 3 Support / Re: UILabel: Scaling font by screen width
« on: April 22, 2014, 08:30:37 AM »
TNX for the reply. I'll try to explain it better.

I'm developing an app for mobile.
I want to have a box of text, which takes 40% of the screen's WIDTH, and located
10% from the left.
The size of font in the box should be proportional to the screen's WIDTH, regardless of
screen height. That is, it would look the same both on shorter and longer screens.

Attached are illustrations of two such text boxes.
As you can see, all sizes are relative to the screen's width,
and the screen's height is meaningless.

Any ideas?

TNX!!

9
NGUI 3 Support / Re: UILabel: Scaling font by screen width
« on: April 19, 2014, 05:21:56 AM »
TNX, but UIRoot is already fixed size :-)

10
NGUI 3 Support / UILabel: Scaling font by screen width
« on: April 18, 2014, 02:24:23 PM »
Hey there,

I'm starting to get a grasp on this new NGUI 3.5.5 thing, and it's really nice!   ;D
Using custom anchoring, I've manage to scale my sprites according to screen width
(e.g., make a sprite take always 30% of the screen width).

How can I do the same with labels and fonts?

I want my fonts to look the same on all screen sizes, relatively to screen width.
For example, if screen width is 480 - font size will be 40, if screen width is 720, font size will be 60.
I've tried to explicitly change the fontSize property in code, but it doesn't seem to work -
I get all kinds of weird proportions of the font which I cannot explain.
(tried it in all overflow modes: shrink/clamp/resize-freely/resize-height - it doesn't work.)

Any ideas?

TNX

Pages: [1]