private DecInfo SearchSame(int searchIndex) { DecInfo result = null; for (int i = 0; i < decData.decList.Count; ++i) { if (decData.decList[i].type == curType && decData.decList[i].ownedIndex == searchIndex) { result = decData.decList[i]; break; } } return(result); }
/// <summary> /// 슬롯 선택시 /// </summary> /// <param name="_slotIndex"></param> public void SelectSlot(int _slotIndex) { DataArea db = Management.MenuGameManager.Instance.DataArea; DecInfo curUnit = null; // 덱에 세팅되있는 값이면 취소하고 if ((curUnit = SearchSame(_slotIndex)) != null) { --decData.decCount; decData.decList.Remove(curUnit); slotList[_slotIndex].selectedImage.SetActive(false); } // 없으면 덱에 넣고 selected else if (decData.decCount < (int)DecMax.UnitMax) { ++decData.decCount; decData.decList.Add(new DecInfo(curType, _slotIndex)); slotList[_slotIndex].selectedImage.SetActive(true); } }