public const int InvenMax = 6; // 애기 당 최대 인벤토리 슬롯 수 /* 슬롯 번호 * 0 ~ 5 0번 애기 * 6 ~ 11 1번 애기 * 12 ~ 17 2번 애기 */ private void Start() // 인벤토리 상황 불러와서 UI 설정하기 { /* 설명 슬롯 버튼 가져오기 */ checkBtn = InfoSlot.Find("BtnCheck").GetComponent <Button>(); useBtn = InfoSlot.Find("BtnUse").GetComponent <Button>(); trashBtn = InfoSlot.Find("BtnThrow").GetComponent <Button>(); /* 슬롯들 리스트에 저장하기 */ for (int i = 0; i < SlotsParent.transform.childCount; i++) { slots.Add(SlotsParent.transform.GetChild(i).gameObject); slots[i].GetComponent <Slot>().SetChildNum(i / 6); } /* xml에서 아이템 데이터 가져오기 */ Item[] items = ItemIO.LoadData(); if (items != null) { for (int i = 0; i < items.Length; i++) { Slot slot = slots[i].GetComponent <Slot>(); try { slot.AddItem(items[i]); } catch (Exception ex) { } } RenewInventory(); } }
//XML에서 아이템 데이터 로드 void Init() { ItemIO.LoadData(AllSlot); Inventory.Instance.gameObject.SetActive(false); }