Beispiel #1
0
        public void PressCellItem(int index, GameObject listItem)
        {
            // 詳細表示
            var uniq = listItem.GetComponent <PetItem>()?.pet.uniqid;

            if (string.IsNullOrEmpty(uniq))
            {
                uniq = listItem.GetComponent <PetInfo>()?.pet?.uniqid;
            }

            if (!string.IsNullOrEmpty(uniq))
            {
                if (Entity.Instance.UnitList.IsModify(modify))
                {
                    // ユニットが編集した場合、保存してから開く
                    Protocol.Send(new UnitUpdateSend {
                        items = modify.items.ToArray()
                    }, r =>
                    {
                        Entity.Instance.UnitList.Modify(r.items);
                        Open <PetDetailWindow>(uniq, !modify.Exists(uniq));
                        Observer.Instance.Subscribe(PetDetailWindow.CloseEvent, OnSubscribe);
                    });
                }
                else
                {
                    Open <PetDetailWindow>(uniq, !modify.Exists(uniq));
                    Observer.Instance.Subscribe(PetDetailWindow.CloseEvent, OnSubscribe);
                }
            }
        }
Beispiel #2
0
            public GameObject CellViewItem(int index, GameObject item)
            {
                if (item == null)
                {
                    item = Instantiate(petItemPrefab);
                }
                var data = Entity.Instance.PetList.items[index];

                item.GetComponent <PetItem>().Setup(data, modify.Exists(data.uniqid));
                return(item);
            }