Example #1
0
    private void PrepareListItemWithIndex(Transform item, Int32 newIndex, Int32 oldIndex)
    {
        if (newIndex < oldIndex)
        {
            item.localPosition += new Vector3(0f, (Single)(this.poolSize / this.Column) * this.cellHeight, 0f);
        }
        else
        {
            item.localPosition -= new Vector3(0f, (Single)(this.poolSize / this.Column) * this.cellHeight, 0f);
        }
        item.GetComponent <RecycleListItem>().ItemDataIndex = newIndex;
        UIKeyNavigation component = item.GetComponent <UIKeyNavigation>();

        if (component)
        {
            component.startsSelected = (this.activeNumber == newIndex);
        }
        if (oldIndex == this.activeNumber)
        {
            ButtonGroupState component2 = item.GetComponent <ButtonGroupState>();
            ButtonGroupState.RemoveActiveStateOnGroup(item.gameObject, component2.GroupName);
        }
        if (newIndex == this.activeNumber)
        {
            ButtonGroupState component3 = item.GetComponent <ButtonGroupState>();
            ButtonGroupState.HoldActiveStateOnGroup(item.gameObject, component3.GroupName);
        }
        item.name = "Item " + newIndex;
        this.PopulateListItemWithData(item, this.dataList[newIndex], newIndex, false);
        this.dataTracker.Add(newIndex, this.dataTracker[oldIndex]);
        this.dataTracker.Remove(oldIndex);
    }
Example #2
0
    private void InitListItemWithIndex(Transform item, Int32 dataIndex, Int32 poolIndex)
    {
        RecycleListItem component = item.GetComponent <RecycleListItem>();

        component.ItemDataIndex = dataIndex;
        component.ListPopulator = this;
        component.Panel         = this.panel;
        ScrollItemKeyNavigation component2 = item.GetComponent <ScrollItemKeyNavigation>();

        if (component2)
        {
            component2.ScrollButton = this.ScrollButton;
            component2.ScrollPanel  = this.panel;
        }
        UIKeyNavigation component3;

        if (ButtonGroupState.ActiveGroup == ItemUI.ItemArrangeGroupButton)
        {
            component3 = item.GetChild(1).GetComponent <UIKeyNavigation>();
        }
        else
        {
            component3 = item.GetComponent <UIKeyNavigation>();
        }
        if (component3)
        {
            component3.startsSelected = (this.activeNumber == dataIndex);
        }
        ButtonGroupState component4 = item.GetComponent <ButtonGroupState>();

        if (component4)
        {
            ButtonGroupState.RemoveActiveStateOnGroup(item.gameObject, component4.GroupName);
        }
        item.name = "Item " + dataIndex;
        this.PopulateListItemWithData(item, this.dataList[dataIndex], dataIndex, true);
        this.dataTracker.Add(this.itemsPool[poolIndex].GetComponent <RecycleListItem>().ItemDataIndex, this.itemsPool[poolIndex].GetComponent <RecycleListItem>().ItemNumber);
    }