示例#1
0
        private void ItemDecideProc(
            int count,
            int sel,
            ShopViewer.ItemListController sender,
            ShopViewer.ItemListController receiver)
        {
            ItemNodeUI node      = sender.itemListUI.GetNode(sel);
            StuffItem  stuffItem = new StuffItem(node.Item);

            stuffItem.Count = count;
            receiver.AddItem(stuffItem, new ShopViewer.ExtraPadding(node.Item, sender));
            if (ShopUI.RemoveItem(count, sel, stuffItem, sender, this._inventoryUI))
            {
                this.SetFocusLevel(sender.itemListUI.FocusLevel);
            }
            bool flag1 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)receiver.itemListUI);

            if (!flag1)
            {
                receiver.itemListUI.Refresh();
            }
            bool flag2 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)sender.itemListUI);

            if (!flag2)
            {
                sender.itemListUI.Refresh();
            }
            if (flag1 || flag2)
            {
                this._inventoryUI.Refresh();
            }
            this._shopInfoPanelUI.Refresh();
            this.SendCheck();
        }
        protected override void ItemInfoEvent()
        {
            int        selectIndex = -1;
            ItemNodeUI selectItem  = (ItemNodeUI)null;

            this.itemListUI.CurrentChanged += (Action <int, ItemNodeUI>)((i, option) =>
            {
                if (Object.op_Equality((Object)option, (Object)null))
                {
                    return;
                }
                selectIndex = i;
                selectItem  = option;
                this.SelectItem(selectItem.Item);
            });
            this._itemInfoUI.OnSubmit += (Action)(() =>
            {
                if (!this.isConfirm || selectItem.isNone)
                {
                    this.EnterItem(selectIndex, selectItem);
                }
                else
                {
                    ConfirmScene.Sentence = this._itemInfoUI.ConfirmLabel;
                    ConfirmScene.OnClickedYes = (Action)(() =>
                    {
                        this.EnterItem(selectIndex, selectItem);
                        this.playSE.Play(SoundPack.SystemSE.OK_L);
                    });
                    ConfirmScene.OnClickedNo = (Action)(() => this.playSE.Play(SoundPack.SystemSE.Cancel));
                    Singleton <Game> .Instance.LoadDialog();
                }
            });
        }
示例#3
0
        private void PlantingForAll(int currentID, ItemNodeUI currentOption)
        {
            int emptySum = this._plantUI.GetEmptySum();

            if (emptySum == 0)
            {
                return;
            }
            StuffItem item      = currentOption.Item;
            StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item));
            int       count     = 0;

            while (stuffItem.Count > 0)
            {
                --stuffItem.Count;
                if (++count >= emptySum)
                {
                    break;
                }
            }
            if (stuffItem.Count <= 0)
            {
                this._inventoryUI.itemList.Remove(stuffItem);
                this._inventoryUI.itemListUI.RemoveItemNode(currentID);
                this._inventoryUI.itemListUI.ForceSetNonSelect();
            }
            this._inventoryUI.itemListUI.Refresh();
            this._plantUI.SetPlantItemForAll(item, count);
            this._plantUI.Refresh();
            this._plantInfoUI.ItemCancelInteractable(((IReadOnlyCollection <StuffItem>) this._inventoryUI.itemList).CanAddItem(this._inventoryUI.slotCounter.y, item));
        }
        private void Send(int currentID, ItemNodeUI currentOption)
        {
            StuffItem item      = currentOption.Item;
            StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item));

            --stuffItem.Count;
            if (stuffItem.Count <= 0)
            {
                this._inventoryUI.itemList.Remove(stuffItem);
                this._inventoryUI.itemListUI.RemoveItemNode(currentID);
                this._inventoryUI.itemListUI.ForceSetNonSelect();
            }
            this._inventoryUI.itemListUI.Refresh();
            int currentIndex = this._chickenCoopListUI.currentIndex;

            while (this.currentChickens.Count <= currentIndex)
            {
                this.currentChickens.Add((AIProject.SaveData.Environment.ChickenInfo)null);
            }
            AIProject.SaveData.Environment.ChickenInfo info = new AIProject.SaveData.Environment.ChickenInfo();
            info.name = "ニワトリ";
            ValueTuple <AIProject.SaveData.AnimalData, PetChicken> chicken = this.CreateChicken(info);

            info.AnimalData = (AIProject.SaveData.AnimalData)chicken.Item1;
            if (Object.op_Inequality((Object)this._currentFarmPoint, (Object)null))
            {
                this._currentFarmPoint.AddChicken(currentIndex, (PetChicken)chicken.Item2);
            }
            this.currentChickens[currentIndex] = info;
            this._chickenCoopListUI.Refresh(currentIndex);
            this._inventoryUI.Visible = false;
        }
        private void OnDeleteOKClick()
        {
            if (this._deleteRequestUI.IsActiveControl)
            {
                this._deleteRequestUI.DoClose();
            }
            RecyclingInfoPanelUI infoPanelUi = this._recyclingUI.InfoPanelUI;

            if (Object.op_Equality((Object)infoPanelUi, (Object)null) || !infoPanelUi.IsNumberInput)
            {
                return;
            }
            ValueTuple <ItemListController, ItemListController, ItemNodeUI, int, ButtonType> itemInfo = infoPanelUi.GetItemInfo();
            ItemNodeUI itemNodeUi = (ItemNodeUI)itemInfo.Item3;
            StuffItem  source     = !Object.op_Inequality((Object)itemNodeUi, (Object)null) ? (StuffItem)null : itemNodeUi.Item;

            if (Object.op_Equality((Object)itemNodeUi, (Object)null) || source == null)
            {
                return;
            }
            int       sel       = (int)itemInfo.Item4;
            StuffItem stuffItem = new StuffItem(source);

            stuffItem.Count = Mathf.Min(source.Count, infoPanelUi.InputNumber);
            bool flag = source.Count <= stuffItem.Count;

            this.ListController.RemoveItem(sel, stuffItem);
            if (!flag)
            {
                return;
            }
            this._itemListUI.ForceSetNonSelect();
            infoPanelUi.DetachItem();
        }
示例#6
0
        public ItemNodeUI AddItemNode(int id, StuffItem item)
        {
            // ISSUE: object of a compiler-generated type is created
            // ISSUE: variable of a compiler-generated type
            ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2 nodeCAnonStorey2 = new ItemListUI.\u003CAddItemNode\u003Ec__AnonStorey2();
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.id = id;
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.\u0024this = this;
            StuffItemInfo itemInfo = ItemNodeUI.GetItemInfo(item);

            if (itemInfo == null)
            {
                return((ItemNodeUI)null);
            }
            GameObject gameObject = itemInfo.isNone ? ItemListUI.SystemNode : this.OptionNode;

            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.opt = (ItemNodeUI)((GameObject)Object.Instantiate <GameObject>((M0)gameObject, this.itemParent)).GetComponent <ItemNodeUI>();
            // ISSUE: reference to a compiler-generated field
            nodeCAnonStorey2.opt.Bind(item, itemInfo);
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated method
            DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <PointerEventData>((IObservable <M0>)nodeCAnonStorey2.opt.onEnter, (Action <M0>) new Action <PointerEventData>(nodeCAnonStorey2.\u003C\u003Em__0)), (Component)this);
            // ISSUE: reference to a compiler-generated field
            // ISSUE: method pointer
            ((UnityEvent)nodeCAnonStorey2.opt.OnClick).AddListener(new UnityAction((object)nodeCAnonStorey2, __methodptr(\u003C\u003Em__1)));
            // ISSUE: reference to a compiler-generated field
            // ISSUE: reference to a compiler-generated field
            this._optionTable.Add(nodeCAnonStorey2.id, nodeCAnonStorey2.opt);
            // ISSUE: reference to a compiler-generated field
            return(nodeCAnonStorey2.opt);
        }
        private void EnterItem(int selectIndex, ItemNodeUI selectItem)
        {
            StuffItem stuffItem = selectItem.Item;

            stuffItem.Count -= this._itemInfoUI.Count;
            Action <StuffItem> onSubmit = this.OnSubmit;

            if (onSubmit != null)
            {
                onSubmit(new StuffItem(stuffItem.CategoryID, stuffItem.ID, this._itemInfoUI.Count));
            }
            bool flag = stuffItem.Count <= 0;

            this._itemInfoUI.Refresh(stuffItem);
            List <StuffItem> stuffItemList = this.itemList();

            if (flag)
            {
                stuffItemList.Remove(stuffItem);
                this.itemListUI.RemoveItemNode(selectIndex);
                this.itemListUI.ForceSetNonSelect();
                this._itemInfoUI.Close();
            }
            this._inventoryUI.Refresh();
        }
示例#8
0
 private void Select(ItemNodeUI option)
 {
     if (Object.op_Equality((Object)option, (Object)null) || !option.IsInteractable)
     {
         return;
     }
     ((UnityEvent)option.OnClick)?.Invoke();
 }
示例#9
0
        private void ItemReturnProc(
            int count,
            int sel,
            ShopViewer.ItemListController sender,
            ShopViewer.ItemListController receiver)
        {
            ItemNodeUI node = sender.itemListUI.GetNode(sel);

            MerchantData.VendorItem source = node.Item as MerchantData.VendorItem;
            StuffItem stuffItem            = this._shopInfoPanelUI.mode != ShopInfoPanelUI.Mode.Shop ? new StuffItem(node.Item) : (StuffItem) new MerchantData.VendorItem(source);

            stuffItem.Count = count;
            sender.RemoveItem(sel, stuffItem);
            ShopViewer.ExtraPadding extraData = node.extraData as ShopViewer.ExtraPadding;
            receiver = extraData.source;
            if (receiver != this._inventoryUI.controller)
            {
                receiver.AddItem(stuffItem, new ShopViewer.ExtraPadding(extraData.item, sender));
            }
            else if (this._inventoryUI.itemList.AddItem(stuffItem))
            {
                this._inventoryUI.ItemListAddNode(this._inventoryUI.itemListUI.SearchNotUsedIndex, stuffItem);
                this._inventoryUI.ItemListNodeFilter(this._inventoryUI.categoryUI.CategoryID, true);
            }
            bool flag1 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)receiver.itemListUI);

            if (!flag1)
            {
                receiver.itemListUI.Refresh();
            }
            bool flag2 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)sender.itemListUI);

            if (!flag2)
            {
                sender.itemListUI.Refresh();
            }
            if (flag1 || flag2)
            {
                this._inventoryUI.Refresh();
            }
            this._shopInfoPanelUI.Refresh();
            int num = node.Rate * count;

            if (sender == this._shopSendViewer.controller)
            {
                this._shopRateViewer.rateCounter.x -= num;
            }
            else
            {
                if (sender != this._shopRateViewer.controller)
                {
                    return;
                }
                this._shopRateViewer.rateCounter.y -= num;
            }
        }
示例#10
0
        private void RefreshInputFieldUI()
        {
            int        num1       = Mathf.Min(Mathf.Max(1, this.InputNumber), this.ItemMaxCount);
            ItemNodeUI itemNodeUi = (ItemNodeUI)this.ItemInfo.Item3;
            StuffItem  stuffItem  = !Object.op_Inequality((Object)itemNodeUi, (Object)null) ? (StuffItem)null : itemNodeUi.Item;
            int        num2       = stuffItem == null ? 0 : stuffItem.Count;
            int        num3       = Mathf.Clamp(num1, 0, num2);

            this._numInputField.set_text(string.Format("{0}", (object)num3));
            this._numInputField.get_textComponent().set_text(string.Format("{0}", (object)num3));
        }
示例#11
0
 public void SetItemInfo(
     ItemListController sender,
     ItemListController receiver,
     ItemNodeUI nodeUI,
     int currentID,
     ButtonType buttonType)
 {
     this.ItemInfo.Item1 = (__Null)sender;
     this.ItemInfo.Item2 = (__Null)receiver;
     this.ItemInfo.Item3 = (__Null)nodeUI;
     this.ItemInfo.Item4 = (__Null)currentID;
     this.ItemInfo.Item5 = (__Null)buttonType;
 }
示例#12
0
        private void ItemDecideProc(
            int count,
            int sel,
            ShopViewer.ItemListController sender,
            ShopViewer.ItemListController receiver)
        {
            ItemNodeUI node = sender.itemListUI.GetNode(sel);

            MerchantData.VendorItem source = node.Item as MerchantData.VendorItem;
            StuffItem stuffItem            = this._shopInfoPanelUI.mode != ShopInfoPanelUI.Mode.Shop ? new StuffItem(node.Item) : (StuffItem) new MerchantData.VendorItem(source);

            stuffItem.Count = count;
            receiver.AddItem(stuffItem, new ShopViewer.ExtraPadding(node.Item, sender));
            if (ShopUI.RemoveItem(count, sel, stuffItem, sender, this._inventoryUI))
            {
                this.SetFocusLevel(sender.itemListUI.FocusLevel);
            }
            bool flag1 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)receiver.itemListUI);

            if (!flag1)
            {
                receiver.itemListUI.Refresh();
            }
            bool flag2 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)sender.itemListUI);

            if (!flag2)
            {
                sender.itemListUI.Refresh();
            }
            if (flag1 || flag2)
            {
                this._inventoryUI.Refresh();
            }
            this._shopInfoPanelUI.Refresh();
            int num = node.Rate * count;

            if (receiver == this._shopSendViewer.controller)
            {
                this._shopRateViewer.rateCounter.x += num;
            }
            else
            {
                if (receiver != this._shopRateViewer.controller)
                {
                    return;
                }
                this._shopRateViewer.rateCounter.y += num;
            }
        }
示例#13
0
            public void RemoveItem(int sel, StuffItem item)
            {
                ItemNodeUI node = this._itemListUI.GetNode(sel);

                node.Item.Count -= item.Count;
                if (node.Item.Count <= 0)
                {
                    if (this.mode == ShopViewer.ItemListController.Mode.Normal)
                    {
                        this._itemListUI.RemoveItemNode(sel);
                    }
                    this._itemListUI.ForceSetNonSelect();
                }
                this._itemListUI.Refresh();
            }
示例#14
0
        private void CurrentChanged(PanelType panelType, int currentID, ItemNodeUI nodeUI)
        {
            if (Object.op_Equality((Object)this._infoPanelUI, (Object)null) || Object.op_Equality((Object)nodeUI, (Object)null) || currentID < 0)
            {
                return;
            }
            ButtonType         buttonType1 = ButtonType.Decide;
            ItemListController listController1;
            ItemListController listController2;
            ButtonType         buttonType2;

            switch (panelType)
            {
            case PanelType.Pouch:
                listController1 = this._pouchInventoryUI.ListController;
                listController2 = this._decidedItemSlotUI.ListController;
                buttonType2     = ButtonType.Decide;
                break;

            case PanelType.Chest:
                listController1 = this._chestInventoryUI.ListController;
                listController2 = this._decidedItemSlotUI.ListController;
                buttonType2     = ButtonType.Decide;
                break;

            case PanelType.DecidedItem:
                listController1 = this._decidedItemSlotUI.ListController;
                listController2 = this.SelectedInventoryUI?.ListController;
                buttonType2     = ButtonType.Return;
                break;

            default:
                this._infoPanelUI.DetachItem();
                buttonType1 = ButtonType.Delete;
                this.NonSelection(this._createItemStockUI.ListController);
                return;
            }
            if (listController1 == null || listController2 == null)
            {
                this._infoPanelUI.DetachItem();
            }
            else
            {
                this.NonSelection(listController1);
                this._infoPanelUI.AttachItem(listController1, listController2, currentID, nodeUI, buttonType2);
            }
        }
        private void OnClickOneGet()
        {
            if (this.ItemList.IsNullOrEmpty <StuffItem>())
            {
                return;
            }
            ItemNodeUI currentOption = this._itemListUI.CurrentOption;
            StuffItem  stuffItem     = !Object.op_Inequality((Object)currentOption, (Object)null) ? (StuffItem)null : currentOption.Item;

            if (stuffItem == null)
            {
                return;
            }
            List <StuffItem> stuffItemList = ListPool <StuffItem> .Get();

            stuffItemList.Add(stuffItem);
            List <RecyclingInventoryFacadeViewer> vieweres = this.GetVieweres();

            foreach (RecyclingInventoryFacadeViewer viewer in vieweres)
            {
                this.GetItemAction(stuffItemList, viewer);
                if (!this.AddFailedList.Contains(stuffItem))
                {
                    this.ItemList.Remove(stuffItem);
                    this._itemListUI.RemoveItemNode(this._itemListUI.CurrentID);
                    this._itemListUI.ForceSetNonSelect();
                    stuffItem = (StuffItem)null;
                    this._recyclingUI.InfoPanelUI.DetachItem();
                }
                if (stuffItem == null)
                {
                    break;
                }
            }
            this.AddFailedList.Clear();
            this.ReturnVieweres(vieweres);
            ListPool <StuffItem> .Release(stuffItemList);

            Action refreshEvent = this.ListController.RefreshEvent;

            if (refreshEvent != null)
            {
                refreshEvent();
            }
            this.RefreshOneGetButtonInteractable();
        }
示例#16
0
        private void Planting(int currentID, ItemNodeUI currentOption)
        {
            StuffItem item      = currentOption.Item;
            StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item));

            --stuffItem.Count;
            if (stuffItem.Count <= 0)
            {
                this._inventoryUI.itemList.Remove(stuffItem);
                this._inventoryUI.itemListUI.RemoveItemNode(currentID);
                this._inventoryUI.itemListUI.ForceSetNonSelect();
            }
            this._inventoryUI.itemListUI.Refresh();
            this._plantUI.SetPlantItem(item);
            this._plantUI.Refresh();
            this._plantInfoUI.ItemCancelInteractable(((IReadOnlyCollection <StuffItem>) this._inventoryUI.itemList).CanAddItem(this._inventoryUI.slotCounter.y, item));
        }
示例#17
0
            public ItemNodeUI ItemListAddNode(int index, StuffItem item)
            {
                ItemNodeUI node = this._viewer.itemListUI.AddItemNode(index, item);

                if (Object.op_Inequality((Object)node, (Object)null))
                {
                    DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <IList <double> >((IObservable <M0>)UnityEventExtensions.AsObservable((UnityEvent)node.OnClick).DoubleInterval <Unit>(250f, false), (Action <M0>)(_ =>
                    {
                        if (this.ItemNodeOnDoubleClick == null)
                        {
                            return;
                        }
                        this.ItemNodeOnDoubleClick(index, node, this.sel);
                    })), (Component)node);
                }
                return(node);
            }
示例#18
0
        public void AttachItem(
            ItemListController sender,
            ItemListController receiver,
            int currentID,
            ItemNodeUI itemUI,
            ButtonType buttonType)
        {
            this.ClearItemInfo();
            if (sender == null || receiver == null)
            {
                this.IsActiveControl = false;
            }
            else if (!Singleton <Resources> .IsInstance() || Object.op_Equality((Object)itemUI, (Object)null) || (itemUI.Item == null || itemUI.Item.Count <= 0))
            {
                this.IsActiveControl = false;
            }
            else
            {
                StuffItem     stuffItem     = itemUI.Item;
                StuffItemInfo stuffItemInfo = Singleton <Resources> .Instance.GameInfo.GetItem(stuffItem.CategoryID, stuffItem.ID);

                if (stuffItemInfo == null)
                {
                    this.IsActiveControl = false;
                }
                else
                {
                    this.SetItemInfo(sender, receiver, itemUI, currentID, buttonType);
                    this.InputNumber = 1;
                    this.RefreshUI();
                    this._itemNameText.set_text(stuffItemInfo.Name);
                    this._flavorText.set_text(stuffItemInfo.Explanation);
                    int num = (int)buttonType;
                    for (int index = 0; index < this._buttons.Length; ++index)
                    {
                        Button element = this._buttons.GetElement <Button>(index);
                        if (!Object.op_Equality((Object)element, (Object)null) && ((Component)element).get_gameObject().get_activeSelf() != (index == num))
                        {
                            ((Component)element).get_gameObject().SetActive(index == num);
                        }
                    }
                    this.IsActiveControl = true;
                }
            }
        }
示例#19
0
 public int SearchIndex(ItemNodeUI node)
 {
     if (Object.op_Inequality((Object)node, (Object)null))
     {
         using (Dictionary <int, ItemNodeUI> .Enumerator enumerator = this._optionTable.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 KeyValuePair <int, ItemNodeUI> current = enumerator.Current;
                 if (Object.op_Equality((Object)current.Value, (Object)node))
                 {
                     return(current.Key);
                 }
             }
         }
     }
     return(-1);
 }
        public virtual ItemNodeUI ItemListAddNode(int index, StuffItem item)
        {
            ItemNodeUI node = this._viewer.itemListUI.AddItemNode(index, item);

            if (Object.op_Inequality((Object)node, (Object)null) && this.ItemNodeOnDoubleClick != null)
            {
                DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <IList <double> >((IObservable <M0>)UnityEventExtensions.AsObservable((UnityEvent)node.OnClick).DoubleInterval <Unit>(250f, false), (Action <M0>)(_ =>
                {
                    Action <InventoryFacadeViewer.DoubleClickData> nodeOnDoubleClick = this.ItemNodeOnDoubleClick;
                    if (nodeOnDoubleClick == null)
                    {
                        return;
                    }
                    nodeOnDoubleClick(new InventoryFacadeViewer.DoubleClickData(index, node));
                })), (Component)node);
            }
            return(node);
        }
示例#21
0
        public int RemoveItem(int sel, StuffItem item)
        {
            ItemNodeUI node = this._itemListUI.GetNode(sel);

            node.Item.Count -= item.Count;
            int count = node.Item.Count;

            if (count <= 0)
            {
                this.ItemList.Remove(node.Item);
                this._itemListUI.RemoveItemNode(sel);
                this._itemListUI.ForceSetNonSelect();
            }
            if (this.RefreshEvent != null)
            {
                this.RefreshEvent();
            }
            return(count);
        }
示例#22
0
            private ItemNodeUI ItemListAddNode(StuffItem item, ShopViewer.ExtraPadding padding)
            {
                int        index = this._itemListUI.SearchNotUsedIndex;
                ItemNodeUI node  = this._itemListUI.AddItemNode(index, item);

                if (Object.op_Inequality((Object)node, (Object)null))
                {
                    node.extraData = (ItemNodeUI.ExtraData)padding;
                    DisposableExtensions.AddTo <IDisposable>((M0)ObservableExtensions.Subscribe <IList <double> >((IObservable <M0>)UnityEventExtensions.AsObservable((UnityEvent)node.OnClick).DoubleInterval <Unit>(250f, false), (Action <M0>)(_ =>
                    {
                        if (this.DoubleClick == null)
                        {
                            return;
                        }
                        this.DoubleClick(index, node);
                    })), (Component)node);
                }
                return(node);
            }
示例#23
0
        private void ItemReturnProc(
            int count,
            int sel,
            ShopViewer.ItemListController sender,
            ShopViewer.ItemListController receiver)
        {
            ItemNodeUI node      = sender.itemListUI.GetNode(sel);
            StuffItem  stuffItem = new StuffItem(node.Item);

            stuffItem.Count = count;
            sender.RemoveItem(sel, stuffItem);
            ShopViewer.ExtraPadding extraData = node.extraData as ShopViewer.ExtraPadding;
            receiver = extraData.source;
            if (receiver != this._inventoryUI.controller)
            {
                receiver.AddItem(stuffItem, new ShopViewer.ExtraPadding(extraData.item, sender));
            }
            else if (this._inventoryUI.itemList.AddItem(stuffItem))
            {
                this._inventoryUI.ItemListAddNode(this._inventoryUI.itemListUI.SearchNotUsedIndex, stuffItem);
                this._inventoryUI.ItemListNodeFilter(this._inventoryUI.categoryUI.CategoryID, true);
            }
            bool flag1 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)receiver.itemListUI);

            if (!flag1)
            {
                receiver.itemListUI.Refresh();
            }
            bool flag2 = Object.op_Equality((Object)this._inventoryUI.itemListUI, (Object)sender.itemListUI);

            if (!flag2)
            {
                sender.itemListUI.Refresh();
            }
            if (flag1 || flag2)
            {
                this._inventoryUI.Refresh();
            }
            this._shopInfoPanelUI.Refresh();
            this.SendCheck();
        }
示例#24
0
        private void Select(ItemBoxUI.ItemBoxDataPack itemPack)
        {
            ItemNodeUI selectedOption = itemPack.itemListUI.SelectedOption;

            if (Object.op_Equality((Object)selectedOption, (Object)null) || !selectedOption.IsInteractable)
            {
                return;
            }
            this._selectedIndexOf = itemPack.itemListUI.CurrentID;
            if (selectedOption.Item == null)
            {
                return;
            }
            this._itemSendPanel.takeout = itemPack.sel == ItemBoxUI.SelectedElement.ItemBox;
            foreach (ItemBoxUI.ItemBoxDataPack itemBoxDataPack in ((IEnumerable <ItemBoxUI.ItemBoxDataPack>) this.itemPacks).Where <ItemBoxUI.ItemBoxDataPack>((Func <ItemBoxUI.ItemBoxDataPack, bool>)(p => p != itemPack)))
            {
                itemBoxDataPack.itemListUI.ForceSetNonSelect();
            }
            this.SortUIClose();
            this._itemSendPanel.Open(selectedOption);
        }
示例#25
0
        private void OnDoubleClick(PanelType panelType, int currnetID, ItemNodeUI nodeUI)
        {
            if (Object.op_Equality((Object)nodeUI, (Object)null))
            {
                return;
            }
            ItemListController listController1;
            ItemListController listController2;

            switch (panelType)
            {
            case PanelType.Pouch:
                listController1 = this._pouchInventoryUI.ListController;
                listController2 = this._decidedItemSlotUI.ListController;
                break;

            case PanelType.Chest:
                listController1 = this._chestInventoryUI.ListController;
                listController2 = this._decidedItemSlotUI.ListController;
                break;

            case PanelType.Info:
                return;

            case PanelType.DecidedItem:
                listController1 = this._decidedItemSlotUI.ListController;
                listController2 = this.SelectedInventoryUI?.ListController;
                break;

            case PanelType.CreatedItem:
                listController1 = this._createItemStockUI.ListController;
                listController2 = this.SelectedInventoryUI?.ListController;
                break;

            default:
                return;
            }
            this.OnDoubleClicked.OnNext(panelType);
            this.SendItem(nodeUI.Item.Count, panelType, listController1, listController2, currnetID, nodeUI);
        }
示例#26
0
 public void SortItems(int type, bool ascending)
 {
     ItemNodeUI.Sort(type, ascending, (IDictionary <int, ItemNodeUI>) this._optionTable);
 }
示例#27
0
        private void Send(int currentID, ItemNodeUI currentOption)
        {
            if (Object.op_Equality((Object)this._currentPetHomePoint, (Object)null))
            {
                return;
            }
            Dictionary <int, List <ValueTuple <ItemIDKeyPair, int> > > dictionary1 = !Singleton <Manager.Resources> .IsInstance() ? (Dictionary <int, List <ValueTuple <ItemIDKeyPair, int> > >)null : Singleton <Manager.Resources> .Instance.AnimalTable.PetItemInfoTable;

            if (((IReadOnlyDictionary <int, List <ValueTuple <ItemIDKeyPair, int> > >)dictionary1).IsNullOrEmpty <int, List <ValueTuple <ItemIDKeyPair, int> > >())
            {
                return;
            }
            int kind = (int)this._currentPetHomePoint.Kind;
            List <ValueTuple <ItemIDKeyPair, int> > valueTupleList;

            if (!dictionary1.TryGetValue(kind, out valueTupleList) || ((IReadOnlyList <ValueTuple <ItemIDKeyPair, int> >)valueTupleList).IsNullOrEmpty <ValueTuple <ItemIDKeyPair, int> >())
            {
                return;
            }
            StuffItem item = currentOption.Item;
            int       index;

            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            // ISSUE: cast to a reference type
            // ISSUE: explicit reference operation
            if ((index = valueTupleList.FindIndex((Predicate <ValueTuple <ItemIDKeyPair, int> >)(x => (^ (ItemIDKeyPair&)ref x.Item1).categoryID == item.CategoryID && (^ (ItemIDKeyPair&)ref x.Item1).itemID == item.ID))) < 0)
            {
                return;
            }
            ValueTuple <ItemIDKeyPair, int> valueTuple = valueTupleList[index];
            StuffItem stuffItem = this._inventoryUI.itemList.Find((Predicate <StuffItem>)(x => x == item));

            --stuffItem.Count;
            if (stuffItem.Count <= 0)
            {
                this._inventoryUI.itemList.Remove(stuffItem);
                this._inventoryUI.itemListUI.RemoveItemNode(currentID);
                this._inventoryUI.itemListUI.ForceSetNonSelect();
            }
            this._inventoryUI.itemListUI.Refresh();
            string name = Singleton <Manager.Resources> .Instance.GameInfo.GetItem(item.CategoryID, item.ID).Name;

            IPetAnimal animal  = (IPetAnimal)null;
            int        pointID = 0;

            switch (this._currentPetHomePoint.Kind)
            {
            case PetHomePoint.HomeKind.PetMat:
                animal = Singleton <AnimalManager> .Instance.CreateBase((int)valueTuple.Item2, 1) as IPetAnimal;

                break;

            case PetHomePoint.HomeKind.FishTank:
                Dictionary <int, Dictionary <int, FishInfo> > dictionary2 = !Singleton <Manager.Resources> .IsInstance() ? (Dictionary <int, Dictionary <int, FishInfo> >)null : Singleton <Manager.Resources> .Instance.Fishing.FishInfoTable;

                Dictionary <int, FishInfo> dictionary3;
                FishInfo fishInfo;
                if (dictionary2 != null && dictionary2.TryGetValue(item.CategoryID, out dictionary3) && (!((IReadOnlyDictionary <int, FishInfo>)dictionary3).IsNullOrEmpty <int, FishInfo>() && dictionary3.TryGetValue(item.ID, out fishInfo)))
                {
                    animal = Singleton <AnimalManager> .Instance.CreateBase((int)valueTuple.Item2, 1) as IPetAnimal;

                    pointID = fishInfo.TankPointID;
                    break;
                }
                break;
            }
            this._elementText.set_text(name ?? this._noneNameStr);
            this.SetActive((Component)this._nameChangeButton, animal != null);
            if (animal != null)
            {
                this._inventoryUI.Visible = false;
                this.SetInteractable((Selectable)this._escapeButton, true);
                animal.AnimalData = new AIProject.SaveData.AnimalData()
                {
                    First            = true,
                    AnimalID         = animal.AnimalID,
                    RegisterID       = this._currentPetHomePoint.RegisterID,
                    AnimalType       = (AnimalTypes)(1 << valueTuple.Item2),
                    AnimalTypeID     = (int)valueTuple.Item2,
                    InitAnimalTypeID = true,
                    BreedingType     = BreedingTypes.Pet,
                    ItemCategoryID   = item.CategoryID,
                    ItemID           = item.ID,
                    ModelID          = this.GetPetAnimalModelID((int)valueTuple.Item2),
                    Position         = this._currentPetHomePoint.Position,
                    Rotation         = this._currentPetHomePoint.Rotation
                };
                animal.Nickname = name;
                if (animal is IGroundPet)
                {
                    (animal as IGroundPet).ChaseActor = this._currentPetHomePoint.SaveData.ChaseActor;
                }
                this._currentPetHomePoint.SetUser(animal);
                this._currentPetHomePoint.SetRootPoint(pointID, animal);
            }
            this.PlaySystemSE(SoundPack.SystemSE.OK_L);
        }
 public void Open(ItemNodeUI node)
 {
     this.selectionItem.set_Value(node);
 }
示例#29
0
        private void Send(
            ItemBoxUI.ItemBoxDataPack sender,
            ItemBoxUI.ItemBoxDataPack receiver,
            int count)
        {
            ItemNodeUI node       = sender.itemListUI.GetNode(this._selectedIndexOf);
            StuffItem  stuffItem1 = new StuffItem(node.Item);
            int        possible;

            if (!((IReadOnlyCollection <StuffItem>)receiver.itemList).CanAddItem(receiver.slotCounter.y, stuffItem1, count, out possible))
            {
                count = this.isSendAll ? possible : 0;
            }
            this.isSendAll = false;
            if (count <= 0)
            {
                return;
            }
            if (receiver.itemList.AddItem(stuffItem1, count))
            {
                receiver.ItemListAddNode(receiver.itemListUI.SearchNotUsedIndex, stuffItem1);
                receiver.ItemListNodeFilter(receiver.categoryUI.CategoryID, true);
            }
            node.Item.Count -= count;
            if (node.Item.Count <= 0)
            {
                count = Mathf.Abs(node.Item.Count);
                sender.itemList.Remove(node.Item);
                sender.itemListUI.RemoveItemNode(this._selectedIndexOf);
                List <StuffItem> stuffItemList = new List <StuffItem>();
                while (count > 0)
                {
                    StuffItem[] array = ((IEnumerable <StuffItem>)sender.itemList.FindItems(stuffItem1)).OrderBy <StuffItem, int>((Func <StuffItem, int>)(x => x.Count)).ToArray <StuffItem>();
                    if (!((IEnumerable <StuffItem>)array).Any <StuffItem>())
                    {
                        Debug.LogError((object)string.Format("RemoveCountOver:{0}", (object)Singleton <Resources> .Instance.GameInfo.GetItem(stuffItem1.CategoryID, stuffItem1.ID).Name));
                        break;
                    }
                    foreach (StuffItem stuffItem2 in array)
                    {
                        int count1 = stuffItem2.Count;
                        stuffItem2.Count -= count;
                        count            -= count1;
                        if (stuffItem2.Count <= 0)
                        {
                            stuffItemList.Add(stuffItem2);
                        }
                        if (count <= 0)
                        {
                            break;
                        }
                    }
                }
                foreach (StuffItem stuffItem2 in stuffItemList)
                {
                    sender.itemList.Remove(stuffItem2);
                    foreach (KeyValuePair <int, ItemNodeUI> keyValuePair in (IEnumerable <KeyValuePair <int, ItemNodeUI> >)sender.itemListUI.optionTable)
                    {
                        if (stuffItem2 == keyValuePair.Value.Item)
                        {
                            sender.itemListUI.RemoveItemNode(keyValuePair.Key);
                            break;
                        }
                    }
                }
                this.SetFocusLevel(sender.itemListUI.FocusLevel);
                sender.itemListUI.ForceSetNonSelect();
            }
            receiver.Refresh();
            sender.Refresh();
            this._itemSendPanel.Refresh();
        }
 public void RefreshOneGetButtonInteractable(ItemNodeUI nodeUI)
 {
     this.Setinteractable((Selectable)this._oneGetButton, !Object.op_Equality((Object)nodeUI, (Object)null) && this.AddableItemToInventory(nodeUI.Item));
 }