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

Pages: [1]
1
NGUI 3 Support / Re: UIFont.CalculatePrintedSize alternatives
« on: January 23, 2014, 06:16:07 AM »
ArenMook, why doesn't this function depend on the particular font? Different fonts should produce different values, should not they?

2
NGUI 3 Support / UIFont.CalculatePrintedSize alternatives
« on: January 23, 2014, 04:53:32 AM »
One of the latest NGUI updates broke my code which used UIFont.CalculatePrintedSize method.
What are the alternatives which are available in the latest release?
Why was the method removed?
Thank you for help!

3
NGUI 3 Support / Re: How to calculate UIWidget size?
« on: January 20, 2014, 04:17:47 AM »
In the original message I've posted a piece of code using one of the functions of this series.
The problem is the function provides unexpected results: the widget was not in the center of the screen.

4
NGUI 3 Support / Re: How to calculate UIWidget size?
« on: January 20, 2014, 01:47:44 AM »
I need to calculate bounds of the widget and all of it's children since it's content is added dynamically.
'width' and 'height' properties tell me nothing since the widget is just a container and those properties are useless.

5
NGUI 3 Support / How to calculate UIWidget size?
« on: January 17, 2014, 07:28:11 AM »
Hello!

In my instance of UIRoot I have an instance of UIWidget. UIRoot's pivot is in the middle-center. And UIWidget's pivot is in the top-left. And I want to position the widget in the center of the UIRoot. I can not change pivots for a specific reason.

Essentially I need to set the widget x coordinate to half of it's width multiplied by -1 and it's y coordinate to half of it's height.

I tried to use the following code:

        Vector3 windowDimensions = NGUIMath.CalculateRelativeWidgetBounds(this.transform).size;
        Vector3 windowPosition = new Vector3();
        windowPosition.x = -1 * windowDimensions.x / 2;
        windowPosition.y = windowDimensions.y / 2;
        this.transform.localPosition = windowPosition;

But it didn't work as expected since I was geting strange numbers from "CalculateRelativeWidgetBounds". I've read something about converting them to "screen coordinates" but I don't know what it means.

Could you please tell me, what I am doing wrong and how can I fix my code?
Thank you!

6
NGUI 3 Support / Re: How to use TweenAlpha?
« on: January 10, 2014, 09:17:09 AM »
Cripple, thank you for your help! I used to think each game object has an alpha.

7
NGUI 3 Support / Re: How to use TweenAlpha?
« on: January 10, 2014, 08:57:10 AM »
Thank you for an answer. I've just added a "UIWidget" component to the object I want to tween and it now tweens as expected.

The strage thing is that TweenScale works without "UIWidget"...

8
NGUI 3 Support / Re: How to use TweenAlpha?
« on: January 10, 2014, 08:43:37 AM »
And if I switch TweenAlpha to TweenScale, the whole game object scales successfully, not just one of it's children.

9
NGUI 3 Support / Re: How to use TweenAlpha?
« on: January 10, 2014, 08:36:21 AM »
No, this is a game object with only one script (component)...
The game object has some children and only one of them is being tweened...

10
NGUI 3 Support / Re: How to use TweenAlpha?
« on: January 10, 2014, 08:27:49 AM »
Cripple, thank you for your answer. I've tried the code you've posted and the result is very same. Only one of the game object's children alpha tweens. The object's alpha is not tweened.
No errors are produced.

11
NGUI 3 Support / How to use TweenAlpha?
« on: January 10, 2014, 07:35:06 AM »
Hello!
I am using NGUI 3.0.8 f7.
I want to tween the alpha of a game object. I try to place the following code int the object script:

  1.        TweenAlpha tweenAlpha = this.gameObject.AddComponent<TweenAlpha>();
  2.         tweenAlpha.from = 1;
  3.         tweenAlpha.to = 0;
  4.         tweenAlpha.duration = 0.3f;
  5.  

When I try to run the program only one child of the game object is being tweened. The object itself is not being tweened.
What am I doing wrong?
Thank you for your help!

Pages: [1]