| | |
| | | using System.Collections.Generic;
|
| | | using System.Linq;
|
| | | using UnityEngine;
|
| | | using UnityEngine.UI;
|
| | |
|
| | | public class CommonGetItemCell : CellView
|
| | | public class CommonGetItemCell : CellView
|
| | | {
|
| | | [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>();
|
| | | public void Display(int index, List<Item> showItems)
|
| | | {
|
| | | [SerializeField] List<CommonGetItem> commonGetItems = new List<CommonGetItem>();
|
| | | [SerializeField] HorizontalLayoutGroup horizontalLayout;
|
| | | public void Display(int rowIndex)
|
| | | for (int i = 0; i < commonGetItems.Count; i++)
|
| | | {
|
| | | var dict = ItemLogicUtility.Instance.totalShowItems;
|
| | | var list = dict.Keys.ToList();
|
| | | int rowCount = (int)Mathf.Ceil((float)list.Count / 5);
|
| | | horizontalLayout.childAlignment= rowCount > 1?TextAnchor.MiddleLeft: TextAnchor.MiddleCenter;
|
| | |
|
| | | for (int i = 0; i < commonGetItems.Count; i++)
|
| | | if (index + i < showItems.Count)
|
| | | {
|
| | | int index = rowIndex * 5 + i;
|
| | | if (index < list.Count)
|
| | | {
|
| | | int itemId = list[index];
|
| | | commonGetItems[i].Display(itemId);
|
| | | commonGetItems[i].SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | commonGetItems[i].SetActive(false);
|
| | | }
|
| | | int itemId = showItems[index + i].id;
|
| | | commonGetItems[i].Display(itemId);
|
| | | commonGetItems[i].SetActive(true);
|
| | | }
|
| | | else
|
| | | {
|
| | | commonGetItems[i].SetActive(false);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|