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

Pages: [1]
1
NGUI 3 Documentation / Re: UIPopupList
« on: June 07, 2014, 06:22:34 AM »
Is there an easy way to get the index number of the selected item as int?

  1. int selectedIndex = UIPopupList.current.items.IndexOf(UIPopupList.current.value);

2
NGUI 3 Documentation / Re: UIProgressBar
« on: June 06, 2014, 11:25:48 AM »
I've just realized that the alpha property is used when showing or hidding the Scroll Bars from a UIScrollView component. Instead of directly modifying the alpha of the fore/back/thumb widgets, I think it might be more correct to just modifying the alpha in the UIWidget component in the same GameObject as the UIProgressBar.

For instance, modifying the UIProgressBar property to something like this:

  1.         public float alpha
  2.         {
  3.                 get
  4.                 {
  5.                         UIWidget w = GetComponent<UIWidget>();
  6.                         if (w != null) return w.alpha;
  7.                         return 1f;
  8.                 }
  9.                 set
  10.                 {
  11.                         UIWidget w = GetComponent<UIWidget>();
  12.                         if (w != null) w.alpha = value;
  13.                 }
  14.         }
  15.  

This introduces the requirement of an UIWidget to be adjacent to the UIScrollBar component for using the "auto-hide scroll bars" feature from the Scroll View. Probably there are better solutions (maybe just using NGUI.SetActive for enabling/disabling scroll bars from the scroll view?). I'm just thinking loud.

3
NGUI 3 Documentation / Re: UIProgressBar
« on: June 06, 2014, 11:13:32 AM »
I don't see the logic on the UIProgressBar.alpha property either. UIProgressBar is a component made of widgets (UIWidgetContainer), not a widget itself. When I want the referred widgets to be affected by the alpha uniformly, I just arrange them in the proper hierarchy (I.e. making all them children of the same UIWidget). UIProgressBar.alpha looks to have been useful on past versions (< 3), but now I feel it more a constraint than a helper.

BTW, the ability of using UILabel as foreground seem not to be working (as per version 3.6.2). The label is always displayed in full no matter the value of the UIProgressBar.

4
NGUI 3 Support / Feature suggestion: UIResponsive
« on: May 30, 2014, 02:53:55 AM »
While I was documenting NGUI in spanish I toyed with the UIGrid and UITable components, as well as the TweenWidth/TweenHeight components. Then I realized that it would be really cool to have a component that implements a grid-based responsive design in the way that the Bootstrap CSS template does:

Bootstrap 2 doc (easier to understand)
Bootstrap 3 doc (latest version, harder to see if you're not familiarized with CSS

With NGUI, it would be cool to have a widget "UIResponsive" (similar to UITable/UIGrid) that divides the widget's area in a number of horizontal cells. Each children widget specifies how many grids spans/offsets horizontally. Each children receives its size automatically depending on the parent's size, allowing them to be located side by side.

For instance, imagine a parent UIResponsive component configured to spawn 12 cells (Bootstrap default). Two children widgets configured to take 6 cells each would be placed side by side each one taking the 50% of the width of the parent.

When the parent's width is smaller than a configured limit, then all children are given a full "row" as width (100% of width of the parent), and stacked vertically.

Such "UIResponsive" component wouldn't be difficult to implement and would provide a new world of possibilities for NGUI and dynamic layouts, for instance between portrait/landscape in mobile.

Edy

5
I'm actually surprised that items would be disabled on alpha = 0, but I guess I'd solve your problem by adding a script that disables the panel after your alphatween.

The ScrollView contents are actually disabled when you set the ScrollView Panel's alpha to 0. But not when the alpha=0 is inherited from an ancestor Panel or Widget.

Yup, this bug was reported along with a fix via email earlier. If I remember correctly, my suggested fix was to add
  1. mMoved = true;
...to UIWidget.OnInit();

Tried, but the problem persists. I don't think this is related with that bug. Actually, when you set a ScrollView Panel's alpha to zero the contained elements are disabled. But if the alpha=0 state is inherited from an ancestor Panel or Widget, the ScrollView and its contents are invisible but the contained elements (colliders) remain active.

6
NGUI 3 Support / Re: Label does not appear in Scrollview until touched
« on: January 15, 2014, 04:51:09 AM »
It's a project that contains NGUI and two scenes only. In one scene it works, in the other it doesn't. The only difference among the scenes is the starting value for the ScrollView Panel's alpha (0.1-> works, 0.0-> bug). I've just sent a Dropbox link.

7
NGUI 3.0.8 f7

Alpha is nicely inherited in any nested components. However the "enabled" state due to alpha=0 is not transmitted properly in nested UIPanels.

Easy to repro:
  • Open the NGUI example scene "Example 7 - Scroll View (Panel)"
  • Hierarchy: UI Root (2D) > Window Panel > Scroll View > UIGrid
  • Give all items inside UIGrid an UIPlaySound component (multiselect works). Trigger: OnMouseOver, choose any sound file.
  • Click Play and test that the sound plays when mouse touches the items
  • While in Play mode, select "Window Panel" at Hierarchy. Set Alpha=0 in the UIPanel component. Everything disappears.
  • Click the Game window and move the mouse at the position of the (now invisible) items. The sound still plays.
Note that if you change the alpha to 0 in the "Scroll View" object instead of "Window Panel" then the items don't play the sound anymore. They are correctly disabled due to alpha=0 in their parent panel, but not if the alpha=0 is inherited from an ancestor component.

8
NGUI 3 Support / Re: Label does not appear in Scrollview until touched
« on: January 14, 2014, 11:39:19 AM »
I'm experiencing a problem like this and I've reproduced it in a clean scene. How can I send it to you?

In summary: I have ScrollView with elements. If I click Play everything works. But if I set the Alpha value of the ScrollView (or any of its ancestors) to zero and click Play, then the elements are not displayed when the alpha is tweened back to visible.

9
NGUI 3 Support / Re: Is there any Font Studio 4.2 support?
« on: September 24, 2012, 02:04:42 PM »
And I really need a small, thin and sharp font for the project I'm working on.

Try using these settings at BMFont font settings, "rasterization" section:
- Render from TrueType outline: enabled
- TrueType hinting: enabled
- Font smoothing: enabled
- Super sampling: disabled

See the results at the attached image. A tiny font of 10px is perfectly readable.


Pages: [1]