Ejemplo n.º 1
0
        protected override void OnChange()
        {
            if (this.childProperty == null)
            {
                return;
            }

            // Instantiate from prefab if no item object available.
            if (this.childObject == null)
            {
                this.childObject = NGUITools.AddChild(this.gameObject, this.Template);
                this.childObject.transform.parent = this.transform;
            }

            T child = this.childProperty.GetValue();

            if (child != null)
            {
                this.childObject.SetActive(true);

                // Set context.
                NguiItemDataContext itemData = this.childObject.GetComponent <NguiItemDataContext>();
                if (itemData == null)
                {
                    itemData = this.childObject.AddComponent <NguiItemDataContext>();
                }
                itemData.SetContext(child);
            }
            else
            {
                this.childObject.SetActive(false);
            }

            this.OnChildContextChange(child);
        }
Ejemplo n.º 2
0
 void Update()
 {
     if (CheckType == CHECK_TYPE.IS_LIST_SELECTION && _listItem == null)
     {
         _listItem = NguiUtils.GetComponentInParents <NguiItemDataContext>(gameObject);
         if (_listItem != null)
         {
             _listItem.OnSelectedChange += OnChange;
             OnChange();
         }
     }
 }
Ejemplo n.º 3
0
	void Update()
	{
		if (CheckType == CHECK_TYPE.IS_LIST_SELECTION && _listItem == null)
		{
			_listItem = NguiUtils.GetComponentInParents<NguiItemDataContext>(gameObject);
			if (_listItem != null)
			{
				_listItem.OnSelectedChange += OnChange;
				OnChange();
			}
		} 
	}