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

Pages: [1]
1
NGUI 3 Support / Re: Tooltip aligning/pivot issue with background and label
« on: November 20, 2014, 11:52:28 PM »
I have tried to follow that example exactly, I'll try again. Thanks for replying.

2
NGUI 3 Support / Re: Tooltip aligning/pivot issue with background and label
« on: November 19, 2014, 09:48:28 PM »
Thank you...>.<, proves my point, I'm not smart.
After changing my Label back to 0, 0, 0. and my background is anchored to the label with added border, there still seems to be a little problem with how the background sprite is displayed, I was wondering if you could help me with that, too?
It looked perfect before I hit the play button and the background would wrap nicely around the label.

3
NGUI 3 Support / Tooltip aligning/pivot issue with background and label
« on: November 18, 2014, 08:30:37 PM »
Hi, I'm not very smart and as there aren't a lot of tutorials for tooltip on NGUI, I'm trying to figure this out myself but failed.
First off, I'm not sure if I'm correct with the code.
  1. void OnTooltip(bool show)
  2. {
  3.         if (show) {
  4.                 UITooltip.ShowText("Tooltip");
  5.         }
  6.         else {
  7.                 UITooltip.Hide();
  8.         }
  9. }
I have this script attached to a GUI object with a box collider and it shows the tooltip and the background normally IF I have the pivot set to default, at the middle.

If I set the pivot to the top left for the label and the background, the background becomes a small dot on the top left of the label's position, but the label remains in the middle of the mouse cursor instead of being at the bottom right of the mouse cursor.

I apologize for my poor English, I hope someone could understand and tell me what I'm doing wrong, thanks.

Here's an image what I did.

4
NGUI 3 Support / Get current screen/panel/root width?
« on: September 06, 2014, 03:45:48 AM »
I need to find the width of the current NGUI screen/panel/root resolution, please help me with the code? I don't think it's just Unity's screen.width, but maybe something to do with that NGUI root's scaling by 2 / ScreenHeight?

I'm trying to tween an object back and forth depending on the button you press, but if you press both the button too fast, the object gets offset because it begins tweening the other direction before finishing the current tweening. I'd like to keep it that way so that players are able to toggle it quickly instead of waiting for the tweening to stop.
So I'd thought I'd make my script verify the position of the object before tweening in order for it to be in the right position, but since it can be played in different screen resolution, I do not know the solution to obtaining the current NGUI screen/panel resolution that matches my object/sprite's transform.localPosition.

Thanks for reading and sorry for my poor writing skill, hopefully someone could help me out here.

5
NGUI 3 Support / A very basic question about Tween codes.
« on: September 02, 2014, 02:56:40 PM »
I apologize for my poor English writing and my noobish question.

If I attach a Tween Position script component to a game object and want to enable the script with codes from another script, how may I do so?
Basically I'm just trying to press escape using Input.GetKeyDown(KeyCode.Escape) to open up a menu that tweens from out of the screen.

I know I can use TweenPosition.Begin(gameObject, 2f, Position), but is it possible to have the Tween Position component play backwards with codes instead?
It doesn't seem like there are as much options like "Animation Curve" if I'm just using TweenPosition.Begin.
Maybe something like the UITweener.PlayReverse() can be my solution? I'm not sure how to use it if so.

Thanks!

6
Bump!
In case I wasn't clear enough above with my english...I'd like to make something like this that would work with NGUI.
  1. public GameObject window;
  2. public float windowWidth = 100f;
  3. public float windowHeight = 100f;
  4.  
  5. void Update () {
  6.         if (window.transform.position.x <= 0) window.transform.position = new Vector3(0, window.transform.position.y, window.transform.position.z);
  7.         if (window.transform.position.y <= 0) window.transform.position = new Vector3(window.transform.position.x, 0, window.transform.position.z);
  8.         if (window.transform.position.x + windowWidth >= Screen.width) window.transform.position = new Vector3(Screen.width - windowWidth, window.transform.position.y, window.transform.position.z);
  9.         if (window.transform.position.y + windowHeight >= Screen.width) window.transform.position = new Vector3(window.transform.position.x, Screen.height - windowHeight, window.transform.position.z);
  10. }

7
NGUI 3 Support / Draggable window to not exceed screen edges? (solved)
« on: October 30, 2013, 01:39:13 PM »
EDIT: NVM! I can actually use transform.localPosition to find the pixel position for the gui...derp!
Apologizing in advance for my English and that I'm new to programming, Unity 3D and NGUI.

Currently I'm trying to set my draggable window to stay within the screen and not exceed the edges of the width or height while dragging.
I've tried setting its transform.position, which doesn't quite work, instead it goes way out of sight.
I've then did some research and tried using the NGUIMath.CalculateAbsoluteWidgetBounds, and found out that my window's position are between -1.7 to 1.7 instead of the actual screen pixels?

Anyways, can someone please help me with this matter? I would like to know the max width and height that's relative to my draggable window's position.
I am able to script the built-in Unity OnGUI's drag window to not exceed the Screen.width and Screen.Height, but have no idea how to do it with NGUI! D:

I'm sorry if this is a newb question to ask and thanks all for the time in reading this! ;)
P.S. I bought NGUI, and it made my life so much easier.

Pages: [1]