//------------------------------------------------------------ public void Setup(EventCallback _callback, int _mode) { OnEventCallback = _callback; //add item itemList.Clear(); ShopScrollItem item1 = new ShopScrollItem(); item1.uid = 1; item1.itemName = "test1"; item1.item_value = 100; itemList.Add(item1); /* * // 목록 초기화. * itemList.Clear(); * for (int i = 0; i < CGameTable.Instance.kInfo_shop.Length; i++) * { * TableInfo_shop table = CGameTable.Instance.kInfo_shop[i]; * if (table == null) continue; * if (_mode == 1) if (table.index < 7200 || table.index > 7299) continue; //hero * if (_mode == 2) if (table.index < 7100 || table.index > 7199) continue; //coin * if (_mode == 3) if (table.index < 7000 || table.index > 7099) continue; //cash * * ShopScrollItem item = new ShopScrollItem(); * item.uid = table.index; //상품목록 * item.itemName = table.name; * item.item_index = table.item_index; * item.item_value = table.item_value; * item.price_type = table.price_type; * item.price_value = table.price_value; * itemList.Add(item); * } */ RefreshDisplay(); //init }
void Sort() { int count = itemList.Count; long[] _uid_list = new long[count]; // 현재 리스트의 정렬할 대상 아이디 추가. for (int i = 0; i < count; i++) { _uid_list[i] = itemList[i].uid; } // 특정 기준으로 아이디 정렬. SortByOrder(0, _uid_list); //for (int i = 0; i < count; i++) print("" + _uid_list[i]); // 정렬된 _uid_list 순서대로 리스트 추가 작업. itemList.Clear(); for (int i = 0; i < count; i++) { long uid = _uid_list[i]; ShopScrollItem item = new ShopScrollItem(); item.uid = uid; //todo AddItem(item, this); } }
private void RemoveItem(ShopScrollItem itemToRemove, ShopScrollList shopList) { for (int i = shopList.itemList.Count - 1; i >= 0; i--) { if (shopList.itemList[i] == itemToRemove) { shopList.itemList.RemoveAt(i); } } }
public void Setup(ShopScrollItem currentItem, ShopScrollList currentScrollList) { item = currentItem; scrollList = currentScrollList; //ui //CGame.Instance.Icon_set_by_item_index(item.item_index, iconImage); //nameLabel.text = item.itemName; //CGame.Instance.Icon_set_by_price_type(item.price_type, priceImage); //priceText.text = item.price_value.ToString(); }
private void AddButtons() { for (int i = 0; i < itemList.Count; i++) { ShopScrollItem item = itemList[i]; GameObject newButton = ObjectPool.GetObject(); //Pool에서 가져온다. newButton.transform.SetParent(contentPanel); newButton.transform.localScale = new Vector3(1, 1, 1); ShopScrollElement element = newButton.GetComponent <ShopScrollElement>(); element.Setup(item, this); // 초기화. } }
void AddItem(ShopScrollItem itemToAdd, ShopScrollList shopList) { shopList.itemList.Add(itemToAdd); }