public void ReSetDispatchTeam(ulong kCreatureKey)
    {
        for (int i = 0; i < itemsPool.Count; ++i)
        {
            InfiniteItemBehavior ItemBehavior = itemsPool[i].GetComponent <InfiniteItemBehavior>();
            if (ItemBehavior == null)
            {
                continue;
            }

            for (int k = 0; k < ItemBehavior.ItemElementList.Count; ++k)
            {
                CreatureIcon icon = ItemBehavior.ItemElementList[k];
                if (icon == null)
                {
                    continue;
                }

                if (icon.CreatureKey == kCreatureKey)
                {
                    if (OnClickEvent != null)
                    {
                        OnClickEvent(icon);
                    }

                    SetDispatchSelect(icon);

                    return;
                }
            }
        }
    }
    private void SetCreatureItem(InfiniteItemBehavior itemBehaver, int dataIndex)
    {
        List <CreatureIcon> ItemElementList = itemBehaver.ItemElementList;
        int iCount = ItemElementList.Count;

        for (int i = 0; i < iCount; ++i)
        {
            int aIdx = ((dataIndex * iCount) + i);

            CreatureIcon ItemElement = ItemElementList[i];
            if (ItemElement == null)
            {
                continue;
            }

            if (_CreatureItemInfoList.Count > aIdx)
            {
                CreatureItemInfo ItemInfo = _CreatureItemInfoList[aIdx];
                if (ItemInfo == null)
                {
                    continue;
                }

                ItemElement.gameObject.SetActive(true);
                ItemElement.SetIcon(ItemInfo, enCreatureIcon_Type.Dispatch);

                ItemElement.SetActiveDispatchSelect(ItemInfo.IsDispatchSelect);
                ItemElement.SetDispatchSelectNumberLabel(ItemInfo.DispatchSelectNumber);
            }
            else
            {
                ItemElement.gameObject.SetActive(false);
            }
        }
    }
    protected override void CreateItem(InfiniteItemBehavior ItemBehavior)
    {
        for (int k = 0; k < _BaseCreatureCount; ++k)
        {
            float        posx = k * 150.0f;
            CreatureIcon icon = UIResourceMgr.CreatePrefab <CreatureIcon>(BUNDLELIST.PREFABS_UI_COMMON, ItemBehavior.transform, "CreatureIcon");
            icon.name = k.ToString();
            icon.transform.localPosition = new Vector3(posx, 0.0f, 0.0f);

            ItemBehavior.AddItemElement(icon);
        }
    }
    public override void RefreshItemVisable()
    {
        for (int i = 0; i < itemsPool.Count; ++i)
        {
            InfiniteItemBehavior ItemBehavior = itemsPool[i].GetComponent <InfiniteItemBehavior>();
            if (ItemBehavior == null)
            {
                continue;
            }

            SetCreatureItem(ItemBehavior, ItemBehavior.ItemDataIndex);
        }
    }
示例#5
0
    public override void RefreshItemVisable()
    {
        for (int i = 0; i < itemsPool.Count; ++i)
        {
            InfiniteItemBehavior ItemBehavior = itemsPool[i].GetComponent <InfiniteItemBehavior>();
            if (ItemBehavior == null)
            {
                continue;
            }

            ItemBehavior.guildRaidRankElement.Init(_guildRaidRankInfo[ItemBehavior.ItemDataIndex]);
        }
    }
    public IEnumerator ItemIsInvisible(int itemNumber)
    {
        if (isUpdatingList)
        {
            yield return(null);
        }
        isUpdatingList = true;
        if (dataList.Count > poolSize)       // we need to do something "smart"...
        {
            Transform item          = itemsPool[itemNumber];
            int       itemDataIndex = 0;
            if (item.tag.Equals(listItemTag))
            {
                itemDataIndex = item.GetComponent <InfiniteItemBehavior>().itemDataIndex;
            }
            if (item.tag.Equals(listSectionTag))
            {
                itemDataIndex = item.GetComponent <InfiniteSectionBehavior>().itemDataIndex;
            }

            int indexToCheck = 0;
            InfiniteItemBehavior    infItem    = null;
            InfiniteSectionBehavior infSection = null;
            if (dataTracker.ContainsKey(itemDataIndex + 1))
            {
                infItem    = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <InfiniteItemBehavior>();
                infSection = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <InfiniteSectionBehavior>();

                if ((infItem != null && infItem.verifyVisibility()) || (infSection != null && infSection.verifyVisibility()))
                {
                    // dragging upwards (scrolling down)
                    indexToCheck = itemDataIndex - (extraBuffer / 2);
                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        //do we have an extra item(s) as well?
                        for (int i = indexToCheck; i >= 0; i--)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem    = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();
                                infSection = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteSectionBehavior>();
                                if ((infItem != null && !infItem.verifyVisibility()) || (infSection != null && !infSection.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) + poolSize < dataList.Count && i > -1)
                                    {
                                        // is it a section index?
                                        if (sectionsIndices.Contains(i + poolSize))
                                        {
                                            // change item to section
                                            ChangeItemToSection(item, i + poolSize, i);
                                        }
                                        else if (item.tag.Equals(listSectionTag))
                                        {
                                            // change section to item
                                            ChangeSectionToItem(item, i + poolSize, i);
                                        }
                                        else
                                        {
                                            PrepareListItemWithIndex(item, i + poolSize, i);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex - 1;
                                break;
                            }
                        }
                    }
                }
            }
            if (dataTracker.ContainsKey(itemDataIndex - 1))
            {
                infItem    = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <InfiniteItemBehavior>();
                infSection = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <InfiniteSectionBehavior>();

                if ((infItem != null && infItem.verifyVisibility()) || (infSection != null && infSection.verifyVisibility()))
                {
                    //dragging downwards check the item below
                    indexToCheck = itemDataIndex + (extraBuffer / 2);

                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        // if we have an extra item
                        for (int i = indexToCheck; i < dataList.Count; i++)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem    = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();
                                infSection = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteSectionBehavior>();
                                if ((infItem != null && !infItem.verifyVisibility()) || (infSection != null && !infSection.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) - poolSize > -1 && (i) < dataList.Count)
                                    {
                                        // is it a section index?
                                        if (sectionsIndices.Contains(i - poolSize))
                                        {
                                            // change item to section
                                            ChangeItemToSection(item, i - poolSize, i);
                                        }
                                        else if (item.tag.Equals(listSectionTag))
                                        {
                                            // change section to item
                                            ChangeSectionToItem(item, i - poolSize, i);
                                        }
                                        else
                                        {
                                            PrepareListItemWithIndex(item, i - poolSize, i);
                                        }
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex + 1;
                                break;
                            }
                        }
                    }
                }
            }
        }
        isUpdatingList = false;
    }
    //===================================================================================
    //
    // Default Method
    //
    //===================================================================================

    protected override void PopulateListItemWithIndex(InfiniteItemBehavior Item, int dataIndex)
    {
        SetCreatureItem(Item, dataIndex);
    }
示例#8
0
    //ItemIsInvisible相同的函数,主要是协程调试不方便
    public void TestItemIsInvisible(int itemNumber)
    {
        if (isUpdatingList)
        {
            return;
        }
        isUpdatingList = true;
        if (m_nTotalDataCount > poolSize)// we need to do something "smart"...
        {
            Transform            item          = itemsPool[itemNumber];
            int                  itemDataIndex = item.GetComponent <InfiniteItemBehavior>().itemDataIndex;
            int                  indexToCheck  = 0;
            InfiniteItemBehavior infItem       = null;

            if (dataTracker.ContainsKey(itemDataIndex + 1))
            {
                infItem = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <InfiniteItemBehavior>();


                if ((infItem != null && infItem.verifyVisibility()))
                {
                    // dragging upwards (scrolling down)
                    indexToCheck = itemDataIndex - (extraBuffer / 2);
                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        //do we have an extra item(s) as well?
                        for (int i = indexToCheck; i >= 0; i--)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();

                                if ((infItem != null && !infItem.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) + poolSize < m_nTotalDataCount && i > -1)
                                    {
                                        PrepareListItemWithIndex(item, i + poolSize, i);
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex - 1;
                                break;
                            }
                        }
                    }
                }
            }
            if (dataTracker.ContainsKey(itemDataIndex - 1))
            {
                infItem = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <InfiniteItemBehavior>();


                if ((infItem != null && infItem.verifyVisibility()))
                {
                    //dragging downwards check the item below
                    indexToCheck = itemDataIndex + (extraBuffer / 2);

                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        // if we have an extra item
                        for (int i = indexToCheck; i < m_nTotalDataCount; i++)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();

                                if ((infItem != null && !infItem.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) - poolSize > -1 && (i) < m_nTotalDataCount)
                                    {
                                        PrepareListItemWithIndex(item, i - poolSize, i);
                                    }
                                }
                            }
                            else
                            {
                                scrollCursor = itemDataIndex + 1;
                                break;
                            }
                        }
                    }
                }
            }
        }
        isUpdatingList = false;
    }
示例#9
0
    public IEnumerator ItemIsInvisible(int itemNumber)
    {
        if (isUpdatingList)
        {
            yield return(null);
        }
        isUpdatingList = true;
        if (m_nTotalDataCount > poolSize)// we need to do something "smart"...
        {
            Transform item = itemsPool[itemNumber];


            int itemDataIndex = item.GetComponent <InfiniteItemBehavior>().itemDataIndex;

            int indexToCheck             = 0;
            InfiniteItemBehavior infItem = null;

            if (dataTracker.ContainsKey(itemDataIndex + 1))
            {
                //Debug.LogError("1 itemNumber = " + itemNumber + " data idx " + itemDataIndex);
                infItem = itemsPool[(int)(dataTracker[itemDataIndex + 1])].GetComponent <InfiniteItemBehavior>();


                if ((infItem != null && infItem.verifyVisibility()))
                {
                    // dragging upwards (scrolling down)
                    indexToCheck = itemDataIndex - (extraBuffer / 2);
                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        //  Debug.LogError("indexToCheck1  = " + indexToCheck.ToString());
                        //do we have an extra item(s) as well?
                        for (int i = 0; i <= indexToCheck; i++)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();

                                if ((infItem != null && !infItem.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) + poolSize < m_nTotalDataCount && i > -1)
                                    {
                                        PrepareListItemWithIndex(item, i + poolSize, i);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            if (dataTracker.ContainsKey(itemDataIndex - 1))
            {
                //Debug.LogError("2 itemNumber = " + itemNumber + " data idx " + itemDataIndex);
                infItem = itemsPool[(int)(dataTracker[itemDataIndex - 1])].GetComponent <InfiniteItemBehavior>();


                if ((infItem != null && infItem.verifyVisibility()))
                {
                    //dragging downwards check the item below
                    indexToCheck = itemDataIndex + (extraBuffer / 2);

                    if (dataTracker.ContainsKey(indexToCheck))
                    {
                        //   Debug.LogError("indexToCheck2 " + indexToCheck.ToString());
                        // if we have an extra item
                        for (int i = m_nTotalDataCount - 1; i >= indexToCheck; i--)
                        {
                            if (dataTracker.ContainsKey(i))
                            {
                                infItem = itemsPool[(int)(dataTracker[i])].GetComponent <InfiniteItemBehavior>();

                                if ((infItem != null && !infItem.verifyVisibility()))
                                {
                                    item = itemsPool[(int)(dataTracker[i])];
                                    if ((i) - poolSize > -1 && (i) < m_nTotalDataCount)
                                    {
                                        PrepareListItemWithIndex(item, i - poolSize, i);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        isUpdatingList = false;
    }
示例#10
0
    private IEnumerator RefreshPoolCo(int inStartIndex)
    {
        if (m_bGrid == false)
        {
            if (m_Movement == UIScrollView.Movement.Horizontal)
            {
                poolSize = (int)(m_UIPanel.baseClipRegion.z / cellHeight) + extraBuffer;
            }
            else if (m_Movement == UIScrollView.Movement.Vertical)
            {
                poolSize = (int)(m_UIPanel.baseClipRegion.w / cellHeight) + extraBuffer;
            }
            else
            {
                poolSize = (int)(m_UIPanel.baseClipRegion.w / cellHeight) + extraBuffer;
            }
        }
        else
        {
            poolSize = extraBuffer; //通过外部指定个数一定是倍数
        }

        if (enableLog)
        {
            Debug.Log("REFRESH POOL SIZE:::" + poolSize);
        }

        // destroy current items
        for (int i = 0; i < itemsPool.Count; i++)
        {
            Object.DestroyImmediate(itemsPool[i].gameObject);
        }
        itemsPool.Clear();

        int j = startIndex;

        for (int i = 0; i < poolSize; i++) // the pool will use itemPrefab as a default
        {
            if (m_nFirstCreateCnt > 0 && i == m_nFirstCreateCnt)
            {
                m_bFirstRefresh = true;
                RepositionList();
                yield return(null);
            }

            Transform item = Instantiate(itemPrefab) as Transform;
            if (item != null)
            {
                InfiniteItemBehavior behav = item.GetComponent <InfiniteItemBehavior>();
                if (behav == null)
                {
                    behav = item.gameObject.AddComponent <InfiniteItemBehavior>();
                }
                TransformIdentity(item);

                item.gameObject.SetActive(false);
                behav.itemNumber    = i;
                behav.listPopulator = this;
                item.name           = "item" + i;
                if (m_bGrid)
                {
                    item.parent = m_Grid.transform;
                }
                else
                {
                    item.parent = m_Table.transform;
                }

                itemsPool.Add(item);

                if (i >= startIndex && i < m_nTotalDataCount)
                {
                    InitListItemWithIndex(item, j, i);
                    j++;
                }
            }
        }
        m_bFirstRefresh = true;
        RepositionList();
    }
示例#11
0
    protected override void CreateItem(InfiniteItemBehavior ItemBehavior)
    {
        GuildRaidRankingItem guildRaidRankElement = UIResourceMgr.CreatePrefab <GuildRaidRankingItem>(BUNDLELIST.PREFABS_UI_GUILDRAID, ItemBehavior.transform, "GuildRaidRankingItem");

        ItemBehavior.AddItemElement(guildRaidRankElement);
    }
示例#12
0
 //===================================================================================
 //
 // Default Method
 //
 //===================================================================================
 protected override void PopulateListItemWithIndex(InfiniteItemBehavior ItemBehavior, int dataIndex)
 {
     ItemBehavior.guildRaidRankElement.Init(_guildRaidRankInfo[ItemBehavior.ItemDataIndex]);
 }