Example #1
0
        public void Refresh(params UIHowToDetail[] details)
        {
            float horizontalDirection = (horizontalAlign == UIHowToHorizontalAlign.left) ? 1 : (-1);
            float x          = horizontalStartMargin * horizontalDirection;
            int   childCount = base.transform.childCount;

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

            details.ForEach(delegate(UIHowToDetail e)
            {
                UIHowToItem component = Util.Instantiate(itemPrefab.gameObject, parent).GetComponent <UIHowToItem>();
                component.Init(Enum.GetName(typeof(HowToKey), e.key), e.label, childDepth);
                component.transform.localPositionY(0f);
                switch (horizontalAlign)
                {
                case UIHowToHorizontalAlign.left:
                    component.transform.localPositionX(x);
                    break;

                case UIHowToHorizontalAlign.right:
                    component.transform.localPositionX(x - (float)component.GetWidth());
                    break;
                }
                x += ((float)component.GetWidth() + horizontalItemMargin) * horizontalDirection;
            });
        }
        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;
            });
        }