Exemple #1
0
        private void InitHideItem()
        {
            GameObjectUtils.CreateChilds(this.m_content, this.m_itemGameobj.transform, this.m_childCount);
            for (int i = 0; i < this.m_childCount; i++)
            {
                GameObject gameObject = this.m_content.transform.GetChild(i).gameObject;
                gameObject.transform.localPosition = this.m_itemPosDic[i];
                gameObject.transform.localScale    = Vector3.one;
                gameObject.name = i.ToString();
                AItemHandler aBaseItemHandler = gameObject.GetComponent <AItemHandler>();
                if (aBaseItemHandler == null)
                {
                    aBaseItemHandler = (gameObject.AddComponent(this.m_handlerType) as AItemHandler);
                    aBaseItemHandler.Init();
                    aBaseItemHandler.dataType = this.m_dataType;
                }
                if (this.m_dataList != null)
                {
                    aBaseItemHandler.Show(i, this.m_dataList[i]);
                }
                else
                {
                    aBaseItemHandler.Show(i, null);
                }
                aBaseItemHandler.initPos = this.m_itemPosDic[i];
                if (!this.m_handlerDic.ContainsKey(i))
                {
                    this.m_handlerDic.Add(i, aBaseItemHandler);
                }
                else
                {
                    this.m_handlerDic[i] = aBaseItemHandler;
                }
            }
            this.ScrollRectEvent(Vector2.zero);
            int num = (this.m_itemIdIntUp - 1) * this.m_constraintCount;

            if (num > 0 && this.m_childCount > num)
            {
                for (int j = 0; j < num; j++)
                {
                    this.m_handlerDic[j].trans.gameObject.SetActive(false);
                }
            }
            num = (this.m_itemIdIntDown + 1) * this.m_constraintCount;
            if (num > 0 && this.m_childCount > num)
            {
                for (int k = num; k < this.m_childCount; k++)
                {
                    this.m_handlerDic[k].trans.gameObject.SetActive(false);
                }
            }
        }