Exemple #1
0
            /// <summary>
            /// 서브 아이템 인벤
            /// </summary>
            /// <param name="saveInven"></param>
            /// <param name="itemList"></param>
            void SubItemDataSave(List <SubItemData> saveInven, List <GameObject> itemList)
            {
                Black.Manager.SubItemData   item     = new Black.Manager.SubItemData(); //where T : new()
                Black.Inventory.SubItemData slotData = new Inventory.SubItemData();

                //슬롯을 돌면서
                for (int i = 0; i < itemList.Count; i++)
                {
                    //슬롯의 하위 오브젝트가 있음면
                    if (itemList[i].transform.childCount != 0)
                    {
                        //   Debug.Log("save Item Info : " + itemList[i].GetComponentInChildren<Black.Inventory.SubItemData>());

                        //저장된 정보를 저장
                        slotData = itemList[i].GetComponentInChildren <Inventory.SubItemData>();

                        item.id       = slotData._SubItem._Id;
                        item.type     = slotData._SubItem._Type;
                        item.itemType = slotData._SubItem._ItemType;
                        item.name     = slotData._SubItem._Name;
                        item.minDmg   = slotData._SubItem._MinDmg;
                        item.maxDmg   = slotData._SubItem._MaxDmg;

                        item.count = slotData.NCount; //개수(데이터의 개수가 아닌 실제 개수 값을 넘김)

                        item.price = slotData._SubItem._Price;
                        item.tip   = slotData._SubItem._Tip;
                        item.path  = slotData._SubItem._Path;

                        saveInven.Add(item);
                    }
                }
            }
Exemple #2
0
            /// <summary>
            /// 퀵 슬롯은 아이템의 종류룰 파악해야 된다
            /// </summary>
            /// <param name="player"></param>
            /// <param name="itemList"></param>
            void QuickSlotDataSave(List <QuickSlotData> saveInven, List <GameObject> itemList)
            {
                //퀵 슬롯 루프를 돈다
                for (int i = 0; i < itemList.Count; i++)
                {
                    //저장 시킬 아이템이 있는지 확인
                    if (itemList[i].transform.childCount != 0)
                    {
                        if (itemList[i].GetComponentInChildren <Inventory.BagItemData>())
                        {
                            QuickSlotData item = new QuickSlotData();
                            //슬롯에 있는 아이템 정보를 가져온다
                            Inventory.BagItemData slotData = itemList[i].GetComponentInChildren <Inventory.BagItemData>();

                            item.bagItem.id      = slotData._BagItem._Id;
                            item.bagItem.type    = slotData._BagItem._Type;
                            item.bagItem.useType = slotData._BagItem._UseType;
                            item.bagItem.name    = slotData._BagItem._Name;
                            item.bagItem.value   = slotData._BagItem._Value;
                            item.bagItem.weight  = slotData._BagItem._Weight;
                            item.bagItem.count   = slotData.NCount; //개수(데이터의 개수가 아닌 실제 개수 값을 넘김)
                            item.bagItem.price   = slotData._BagItem._Price;
                            item.bagItem.tip     = slotData._BagItem._Tip;
                            item.bagItem.path    = slotData._BagItem._Path;


                            saveInven.Add(item);
                        }

                        //있으면 타입을 확인
                        if (itemList[i].GetComponentInChildren <Inventory.SubItemData>())
                        {
                            QuickSlotData item = new QuickSlotData();
                            //슬롯에 있는 아이템 정보를 가져온다
                            Inventory.SubItemData slotData = itemList[i].GetComponentInChildren <Inventory.SubItemData>();

                            //임시 변수에 저장
                            item.subItem.id       = slotData._SubItem._Id;
                            item.subItem.type     = slotData._SubItem._Type;
                            item.subItem.itemType = slotData._SubItem._ItemType;
                            item.subItem.name     = slotData._SubItem._Name;
                            item.subItem.minDmg   = slotData._SubItem._MinDmg;
                            item.subItem.maxDmg   = slotData._SubItem._MaxDmg;

                            item.subItem.count = slotData.NCount; //개수(데이터의 개수가 아닌 실제 개수 값을 넘김)

                            item.subItem.price = slotData._SubItem._Price;
                            item.subItem.tip   = slotData._SubItem._Tip;
                            item.subItem.path  = slotData._SubItem._Path;

                            saveInven.Add(item);
                        }
                    }
                }
            }