public void Refresh(params UIHowToDetail[] details)
        {
            float horizontalDirection = (float)((this.horizontalAlign != UIHowToHorizontalAlign.left) ? -1 : 1);
            float x          = this.horizontalStartMargin * horizontalDirection;
            int   childCount = base.get_transform().get_childCount();

            for (int i = 0; i < childCount; i++)
            {
                NGUITools.Destroy(base.get_transform().GetChild(0));
            }
            int        childDepth = base.GetComponent <UIWidget>().depth + 1;
            GameObject parent     = base.get_gameObject();

            details.ForEach(delegate(UIHowToDetail e)
            {
                UIHowToItem component = Util.Instantiate(this.itemPrefab.get_gameObject(), parent, false, false).GetComponent <UIHowToItem>();
                component.Init(Enum.GetName(typeof(HowToKey), e.key), e.label, childDepth);
                component.get_transform().localPositionY(0f);
                UIHowToHorizontalAlign uIHowToHorizontalAlign = this.horizontalAlign;
                if (uIHowToHorizontalAlign != UIHowToHorizontalAlign.left)
                {
                    if (uIHowToHorizontalAlign == UIHowToHorizontalAlign.right)
                    {
                        component.get_transform().localPositionX(x - (float)component.GetWidth());
                    }
                }
                else
                {
                    component.get_transform().localPositionX(x);
                }
                x += ((float)component.GetWidth() + this.horizontalItemMargin) * horizontalDirection;
            });
        }
예제 #2
0
 public void SetHorizontalAlign(UIHowToHorizontalAlign iHorizontalAlign)
 {
     horizontalAlign = iHorizontalAlign;
 }