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.


Topics - StridingDragon

Pages: [1]
1
NGUI 3 Support / Print properties of an object
« on: June 13, 2013, 08:08:38 PM »
Does anyone here have any helper functions or classes they'd like to share that would allow to print the properties of any C# object? Since Mono's debug capabilities are so limited, it seems almost imperative to have something that allows you to look at the contents of an object during run time but I can't seem to find any decent function to do that.

Any help would be very much appreciated.

2
NGUI 3 Support / Screen coordinates of a box collider
« on: June 11, 2013, 05:35:14 PM »
I am still struggling with this and can't seem to get this right. I need the on-screen coordinates of a box collider attached to a gameObject.
Here is the code I'm currently using, but for some reason it seems to be constantly off by 20 pixels or so.

  1.         Vector3 bPos = gameObject.transform.localPosition;                                                                      // Box position
  2.                
  3.         float bcCenterX = gameObject.GetComponent<BoxCollider>().center.x * gameObject.transform.localScale.x;          // Calculate adjusted center offset
  4.         float bcCenterY = gameObject.GetComponent<BoxCollider>().center.y * gameObject.transform.localScale.y;
  5.                
  6.         float bcWidth = gameObject.GetComponent<BoxCollider>().size.x * gameObject.transform.localScale.x;                      // Calculate adjusted dimensions
  7.         float bcHeight = gameObject.GetComponent<BoxCollider>().size.y * gameObject.transform.localScale.y;
  8.  
  9.         float colliderX = bPos.x + bcCenterX - ( bcWidth / 2 );
  10.         float colliderY = bPos.y + bcCenterY - ( bcHeight / 2 );
  11.  
  12.         Rect collider = new Rect( colliderX, colliderY, bcWidth, bcHeight );
  13.  

Could anyone tell me what I am doing wrong here? It seems so straight-forward but for some reason my resulting rectangle is just not correct.

3
NGUI 3 Support / Dynamic Font question
« on: May 29, 2013, 01:28:34 AM »
What exactly does the "Dynamic Font" support mean? I could not find any explanation other than that you can now use TTF fonts in NGUI, but I am not sure if that would really make them "dynamic." Does it mean that we can finally switch to bold and italic font faces within a single output string, the way we can switch colors, or perhaps even font sizes? If so, how? Any new functionality we should know about?

Perhaps, I've just overlooked detailed information about these new dynamic fonts, but if there is, can someone please point me towards it so I could see what benefits this will actually offer over the traditional bitmapped fonts.

4
NGUI 3 Support / Overlapping box colliders causing trouble
« on: May 28, 2013, 08:09:21 PM »
I've been struggling with this for a week and I can't get it to work because of some weird behavior in NGUI. Perhaps someone here can help. Here's a simplified explanation of my problem.

I'm having overlapping box colliders on an panel - one larger one encompassing the rather large panel, and another one in front of it for a tooltip text when hovering over a specific area of the panel. This second one is routed to a different onHover function using a delegate. The problem I am having is that hovering over the collider for the tooltip will also generate an OnHover event with a FALSE parameter for the other collider, and there is no way to tell which of the two boxes created the actual event. The gameObject triggered by OnHover() always reports the underlying, large panel box collider as the tripped collider.

For me this causes a can full of problems because I need to rely on various colliders acting independently for some of my GUI elements to function properly, so I was hoping someone might be able to help me sort this out. Is there a way to prevent the top collider to send an OnHover( false ) to the underlying one?

5
NGUI 3 Support / Handling second text file with Localization
« on: May 06, 2013, 12:46:51 AM »
I want to separate the names and descriptions of items in my game into a separate text file to keep things a better organized and to make translation easier down the road. Having every bit of text in a game a single text file can easily become pretty unwieldy.

Is there a way to handle a second or even third text file in NGUI in the same language? I noticed that Localize is a singleton so simply making a duplicate object does not work, does it?

6
NGUI 3 Support / Change fill direction of radial fills?
« on: April 25, 2013, 10:23:44 PM »
Currently radial fills — such as in progress bars — are filling counter-clockwise. Is there way to switch them to work clockwise? I'd need a Radial 180 degree fill that starts at 6 o'clock and fills clockwise to 12 o'clock but I can't seem to figure it out. Thanks for any ideas or tips you guys may have.

7
NGUI 3 Support / So many image files…
« on: April 25, 2013, 07:07:15 PM »
For my GUI I have all sorts of small little bitmap files lying around, some of them just a few pixels in size, and yet each of them requires its own file. I don't think there is a way to put them all in a layered Photoshop file and have Atlas Maker extract them from there, one layer at a time, using the name of the layer for the NGUI sprite, or is there? Any other approach to reduce the number of individual image files?

8
NGUI 3 Support / Multiply blend mode for sprite
« on: April 24, 2013, 12:50:54 AM »
I am wondering if it is possible for me to draw a sprite using a different blend mode/shader than the standard alpha blending. I want to print a panel using a "multiply" mode but I can't figure out how to do it. I understand that I will most likely have to build a separate atlas for that panel to force a separate draw call, but I can't seem to find a way to assign a shader to the sprite. Could anyone tell me how to do this, please?

Thanks so much!

9
NGUI 3 Support / Using UIEventListener for 3D in-game object colliders
« on: March 06, 2013, 07:57:51 PM »
Is it at all possible to use UIEventListener for regular 3D object with mesh colliders in a scene? I'm talking about actual in-game objects, not the UI object.

I want an object with a script catch collisions that are happening on a mesh that is on a child object, without having to attach yet another script to the child object, but can't seem to figure out any way to do this. Do you guys happen to have any ideas or suggestions?

10
NGUI 3 Support / Status/direction of UITweener
« on: February 21, 2013, 02:19:25 PM »
Is it possible to find out which direction UITweener is currently set? I know that I can switch it using Toggle, but is there a way to tell whether it is currently set to go the original direction or the reverse, or rather, is there a way to tell it specifically "tween forward" or "tween reverse?"

11
NGUI 3 Support / How do you assign a font in the inspector?
« on: February 17, 2013, 10:44:43 PM »
I have a label that I want to print alternatively with a regular or a bold font, depending on the value it represents.

I was trying to make the two fonts assignable in the inspector using public variables like this

  1.         public UIFont RegularFont;
  2.         public UIFont BoldFont;
  3.  

but unfortunately, the selector that comes up when clicking these variables in the inspector does not bring up the available fonts, and I can't directly drag them onto the field either because they are part of the atlas and not accessible directly. Is there a way to make this happen? Is it possible to make a prefab for a font?

12
NGUI 3 Support / Localizing UIInput default text
« on: February 08, 2013, 08:53:57 PM »
I noticed that UIInput does not seem to work with the Localize script for the default label.

When I checkmark the "Use Label Text At Start" entry in the UIInput script, NGUI will display the actual text in the label but not the Localization Key that might be associated with the label. Is there a specific way to do this so that the default text can be displayed indifferent languages?

13
NGUI 3 Support / UIInput text after losing focus
« on: February 08, 2013, 02:09:18 AM »
Sadly UIInput does not generate an OnSubmit() event when it loses focus because the user clicked on a different button, even though it is technically equivalent to accepting the input. Is there some other event that I could use to capture this happening, so that the contents of the text field can be properly checked, manipulated and copied to wherever they need to go?

14
NGUI 3 Support / Paragraph spacing
« on: January 22, 2013, 05:37:57 PM »
Is it possible for text labels to have paragraph spacing that is different from wrapping line spacing, the way I would have in HTML, for example, when I have text formatted like this?

<p>This is one Paragraph</p>
<p>This is another paragraph</p>

Pages: [1]