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

Pages: [1]
1
NGUI 3 Support / Detect NGUI version in script
« on: June 06, 2014, 04:57:16 PM »
I'm writing a plugin that is based on the existence of NGUI in the project.
Is there a way to detect the NGUI version via code or that NGUI does not exist in the project?

Thanks,

2
NGUI 3 Support / Tween group of gameobjects
« on: March 23, 2014, 12:20:36 AM »
Hi,
Using the hierarchy below, I would like to tween the colors of B,C and D with identical TweenColor values at the same time.
I understand I can use UIPlayTween script on the panel and group them all.

Panel
     NGUI Sprite  A
     NGUI Sprite  B (+TweenColor)
     NGUI Sprite  C (+TweenColor)
     NGUI Sprite  D (+TweenColor)

My questions:
1) Lets say the trigger for tweening is a click - how to script selective clicks ? (only a click during a specific state of the game should trigger the tweening)
2)  Since the tweens are identical, is there a way to use a single TweenColor that impacts several GameObjects (different hierarchy)?

Cheers,
Gio

3
NGUI 3 Support / Reset checkboxes in grid
« on: September 12, 2012, 12:26:27 AM »
Based on Example 7 (Scroll view panel) I added 3 checkboxes dynamically to a grid.
I had set a layer to the Grid's parent panel, and according to my game state I add/remove this layer from camera.cullingMask and camera.eventReceiverMask.

Once the player had checked some of the checkboxes and submit - the panel is not rendered (and the checkboxes are still checked).   
Next time the panel should be rendered (with the appropriate game state) I  reset the checkboxes to be unchecked with the following code:
  1.         foreach (Transform child in grid)
  2.                 {
  3.                     UICheckbox cb = child.GetComponent<UICheckbox>();
  4.                         cb.isChecked = false;
  5.                 }

This reset cause the grid to respond incorrectly when I click a checkbox immediately after the reset. Though the checkbox hover works correctly, after the click it is still unchecked.
I found out that if I wait ~3 seconds after this reset - then chicking a checkbox works fine.

In several places I tried to use
  1. grid.GetComponent<UIGrid>().Reposition() ,
  2. grid.parent.GetComponent<UIPanel>().Refresh() ,
  3. grid.parent.GetComponent<UIDraggablePanel>().ResetPosition()
  4.  

but couldn't solve this issue.
What am I missing?

4
NGUI 3 Support / Re: Grid - Prefabs are positioned on the same position
« on: September 08, 2012, 11:08:24 AM »
Thanks.
Apparently the code was correct but the UIGrid was disabled   :-[

5
NGUI 3 Support / Re: Grid - Prefabs are positioned on the same position
« on: September 08, 2012, 04:21:16 AM »
Thanks but it didn't fix it.
 

6
NGUI 3 Support / Grid - Prefabs are positioned on the same position
« on: September 08, 2012, 03:53:07 AM »
I'm trying to have a list of check boxes with a vertical scrolling (Based on Example 7  -Scroll view panel).
I'm using a prefab of a check box. Everything is working fine when I add prefabs as children of the Grid via the editor. 
I'm missing out something when it comes to dynamically instantiate: all the check boxes are positioned on the same position.

Below is the script attached to the draggable panel.
  1. public class checkboxList: MonoBehaviour
  2. {      
  3.         public GameObject checkbox;
  4.         UIGrid grid;
  5.        
  6.         void Awake()
  7.         {
  8.                 grid = ((UIGrid)((transform.Find("UIGrid")).GetComponent("UIGrid")) );
  9.         }
  10.        
  11.  
  12.         void Start ()
  13.         {      
  14.                 List<Game.contact> MyContactList =  Game.ContactList.get();
  15.  
  16.                 for(int i = 0; i < MyContactList.Count; i++)
  17.                 {
  18.                         GameObject item = NGUITools.AddChild( transform.Find("UIGrid").gameObject,checkbox);
  19.                         ((UILabel)item.transform.Find("Label").GetComponent("UILabel")).text = MyContactList[i].fullname;
  20.                         item.transform.name = "item" + i.ToString();
  21.                 }
  22.  
  23.                 GameObject.Find("UIPanel (Clipped View)") .GetComponent<UIDraggablePanel>().ResetPosition();
  24.         }
  25.        
  26.         void Update ()
  27.         {
  28.                         grid.Reposition();
  29.         }
  30. }


Please help.

Pages: [1]