public void Refresh()
 {
     using (List <ScrollListSetUp> .Enumerator enumerator = ((IEnumerable <MonoBehaviour>)((Component)this).GetComponents <MonoBehaviour>()).Where <MonoBehaviour>((Func <MonoBehaviour, bool>)(item => item is ScrollListSetUp)).Select <MonoBehaviour, ScrollListSetUp>((Func <MonoBehaviour, ScrollListSetUp>)(item => item as ScrollListSetUp)).ToList <ScrollListSetUp>().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ScrollListSetUp current = enumerator.Current;
             for (int idx = 0; idx < this.m_ItemList.Count; ++idx)
             {
                 RectTransform rectTransform = this.m_ItemList[idx];
                 if (this.m_Direction == ScrollListController.Direction.Horizontal)
                 {
                     rectTransform.set_anchoredPosition(new Vector2((float)((double)this.ItemScale * (double)this.Space * (double)idx + (double)this.ItemScale * 0.5) * this.ScrollDir, 0.0f));
                 }
                 else
                 {
                     rectTransform.set_anchoredPosition(new Vector2(0.0f, (float)((double)this.ItemScale * (double)this.Space * (double)idx + (double)this.ItemScale * 0.5) * this.ScrollDir));
                 }
                 this.m_ItemPos[idx] = rectTransform.get_anchoredPosition();
                 current.OnUpdateItems(idx, ((Component)rectTransform).get_gameObject());
             }
         }
     }
     this.m_PrevPosition  = 0.0f;
     this.m_CurrentItemID = 0;
 }
 public void UpdateList()
 {
   List<ScrollListSetUp> list = ((IEnumerable<MonoBehaviour>) ((Component) this).GetComponents<MonoBehaviour>()).Where<MonoBehaviour>((Func<MonoBehaviour, bool>) (item => item is ScrollListSetUp)).Select<MonoBehaviour, ScrollListSetUp>((Func<MonoBehaviour, ScrollListSetUp>) (item => item as ScrollListSetUp)).ToList<ScrollListSetUp>();
   ((ScrollRect) ((Component) this).GetComponentInParent<ScrollRect>()).set_content(this.GetRectTransForm);
   ((Component) this.m_ItemBase).get_gameObject().SetActive(false);
   float num = this.m_ScrollMode != TowerScrollListController.ScrollMode.Normal ? 1f : -1f;
   for (int index = 0; index < this.m_ItemCnt; ++index)
   {
     RectTransform rectTransform = this.m_ItemList[index];
     ((Transform) rectTransform).SetParent(((Component) this).get_transform(), false);
     rectTransform.set_anchoredPosition(new Vector2(0.0f, (float) ((double) this.ItemScale * (double) this.Margin * (double) index + (double) this.ItemScale * 0.5) * num));
     ((Component) rectTransform).get_gameObject().SetActive(true);
   }
   using (List<ScrollListSetUp>.Enumerator enumerator = list.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       ScrollListSetUp current = enumerator.Current;
       current.OnSetUpItems();
       for (int idx = 0; idx < this.m_ItemCnt; ++idx)
         current.OnUpdateItems(idx, ((Component) this.m_ItemList[idx]).get_gameObject());
     }
   }
   this.m_PrevPosition = 0.0f;
   this.m_CurrentItemID = 0;
   RectTransform component = (RectTransform) ((Component) ((Component) this).get_transform()).GetComponent<RectTransform>();
   Vector2 anchoredPosition = component.get_anchoredPosition();
   anchoredPosition.y = (__Null) 0.0;
   component.set_anchoredPosition(anchoredPosition);
 }
Exemple #3
0
        protected virtual void Start()
        {
            List <ScrollListSetUp> list = ((IEnumerable <MonoBehaviour>)((Component)this).GetComponents <MonoBehaviour>()).Where <MonoBehaviour>((Func <MonoBehaviour, bool>)(item => item is ScrollListSetUp)).Select <MonoBehaviour, ScrollListSetUp>((Func <MonoBehaviour, ScrollListSetUp>)(item => item as ScrollListSetUp)).ToList <ScrollListSetUp>();

            ((ScrollRect)((Component)this).GetComponentInParent <ScrollRect>()).set_content(this.GetRectTransForm);
            ((Component)this.m_ItemBase).get_gameObject().SetActive(false);
            for (int index = 0; index < this.m_ItemCnt; ++index)
            {
                RectTransform rectTransform = (RectTransform)Object.Instantiate <RectTransform>((M0)this.m_ItemBase);
                ((Transform)rectTransform).SetParent(((Component)this).get_transform(), false);
                rectTransform.set_anchoredPosition(new Vector2(0.0f, (float)(-(double)this.ItemScale * 1.20000004768372 * (double)index - (double)this.ItemScale * 0.5)));
                this.m_ItemList.Add(rectTransform);
                ((Component)rectTransform).get_gameObject().SetActive(true);
            }
            using (List <ScrollListSetUp> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ScrollListSetUp current = enumerator.Current;
                    current.OnSetUpItems();
                    for (int idx = 0; idx < this.m_ItemCnt; ++idx)
                    {
                        current.OnUpdateItems(idx, ((Component)this.m_ItemList[idx]).get_gameObject());
                    }
                }
            }
        }
        protected virtual void Start()
        {
            List <ScrollListSetUp> list = ((IEnumerable <MonoBehaviour>)((Component)this).GetComponents <MonoBehaviour>()).Where <MonoBehaviour>((Func <MonoBehaviour, bool>)(item => item is ScrollListSetUp)).Select <MonoBehaviour, ScrollListSetUp>((Func <MonoBehaviour, ScrollListSetUp>)(item => item as ScrollListSetUp)).ToList <ScrollListSetUp>();

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.m_ScrollAutoFit, (UnityEngine.Object)null))
            {
                this.m_ScrollAutoFit.set_content(this.GetRectTransForm);
                this.m_ScrollAutoFit.ItemScale = this.ItemScaleMargin;
                // ISSUE: method pointer
                this.m_ScrollAutoFit.OnScrollStop.AddListener(new UnityAction((object)this, __methodptr(OnScrollStop)));
            }
            ((Component)this.m_ItemBase).get_gameObject().SetActive(false);
            float num = this.m_ScrollMode != TowerScrollListController.ScrollMode.Normal ? 1f : -1f;
            List <TowerQuestListItem> towerQuestListItemList = new List <TowerQuestListItem>();

            for (int index = 0; index < this.m_ItemCnt; ++index)
            {
                RectTransform rectTransform = (RectTransform)UnityEngine.Object.Instantiate <RectTransform>((M0)this.m_ItemBase);
                ((Transform)rectTransform).SetParent(((Component)this).get_transform(), false);
                rectTransform.set_anchoredPosition(new Vector2(0.0f, (float)((double)this.ItemScale * (double)this.Margin * (double)index + (double)this.ItemScale * 0.5) * num));
                this.m_ItemList.Add(rectTransform);
                TowerQuestListItem component = (TowerQuestListItem)((Component)rectTransform).GetComponent <TowerQuestListItem>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                {
                    towerQuestListItemList.Add(component);
                }
                ((Component)rectTransform).get_gameObject().SetActive(true);
            }
            using (List <ScrollListSetUp> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ScrollListSetUp current = enumerator.Current;
                    current.OnSetUpItems();
                    for (int idx = 0; idx < this.m_ItemCnt; ++idx)
                    {
                        current.OnUpdateItems(idx, ((Component)this.m_ItemList[idx]).get_gameObject());
                    }
                }
            }
            this.m_ScrollMode = !MonoSingleton <GameManager> .Instance.FindTower(GlobalVars.SelectedTowerID).is_down ? TowerScrollListController.ScrollMode.Reverse : TowerScrollListController.ScrollMode.Normal;

            this.ChangeScrollMode(this.m_ScrollMode);
            this.StartCoroutine(this.LoadTowerBG(towerQuestListItemList.ToArray()));
        }
        protected virtual void Start()
        {
            List <ScrollListSetUp> list = ((IEnumerable <MonoBehaviour>)((Component)this).GetComponents <MonoBehaviour>()).Where <MonoBehaviour>((Func <MonoBehaviour, bool>)(item => item is ScrollListSetUp)).Select <MonoBehaviour, ScrollListSetUp>((Func <MonoBehaviour, ScrollListSetUp>)(item => item as ScrollListSetUp)).ToList <ScrollListSetUp>();

            ((ScrollRect)((Component)this).GetComponentInParent <ScrollRect>()).set_content(this.GetRectTransForm);
            ((Component)this.m_ItemBase).get_gameObject().SetActive(false);
            for (int index = 0; index < this.m_ItemCnt; ++index)
            {
                RectTransform rectTransform = (RectTransform)UnityEngine.Object.Instantiate <RectTransform>((M0)this.m_ItemBase);
                ((Transform)rectTransform).SetParent(((Component)this).get_transform(), false);
                if (this.m_Direction == ScrollListController.Direction.Horizontal)
                {
                    rectTransform.set_anchoredPosition(new Vector2((float)((double)this.ItemScale * (double)this.Space * (double)index + (double)this.ItemScale * 0.5) * this.ScrollDir, 0.0f));
                }
                else
                {
                    rectTransform.set_anchoredPosition(new Vector2(0.0f, (float)((double)this.ItemScale * (double)this.Space * (double)index + (double)this.ItemScale * 0.5) * this.ScrollDir));
                }
                this.m_ItemList.Add(rectTransform);
                this.m_ItemPos.Add(rectTransform.get_anchoredPosition());
                ((Component)rectTransform).get_gameObject().SetActive(true);
            }
            using (List <ScrollListSetUp> .Enumerator enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    ScrollListSetUp current = enumerator.Current;
                    current.OnSetUpItems();
                    for (int idx = 0; idx < this.m_ItemCnt; ++idx)
                    {
                        current.OnUpdateItems(idx, ((Component)this.m_ItemList[idx]).get_gameObject());
                    }
                }
            }
            if (this.OnAfterStartup == null)
            {
                return;
            }
            this.OnAfterStartup.Invoke(true);
        }
 public void CreateInstance()
 {
     this.mItems = new List <JobIconScrollListController.ItemData>();
     this.mTemplateItem.SetActive(false);
     for (int index = 0; index < this.m_ItemCnt; ++index)
     {
         GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.mTemplateItem);
         gameObject.get_transform().SetParent(((Component)this).get_transform(), false);
         gameObject.SetActive(true);
         this.mItems.Add(new JobIconScrollListController.ItemData(gameObject));
     }
     using (List <ScrollListSetUp> .Enumerator enumerator = ((IEnumerable <MonoBehaviour>)((Component)this).GetComponents <MonoBehaviour>()).Where <MonoBehaviour>((Func <MonoBehaviour, bool>)(item => item is ScrollListSetUp)).Select <MonoBehaviour, ScrollListSetUp>((Func <MonoBehaviour, ScrollListSetUp>)(item => item as ScrollListSetUp)).ToList <ScrollListSetUp>().GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             ScrollListSetUp current = enumerator.Current;
             current.OnSetUpItems();
             for (int idx = 0; idx < this.m_ItemCnt; ++idx)
             {
                 current.OnUpdateItems(idx, this.mItems[idx].gameObject);
             }
         }
     }
 }