Exemplo n.º 1
0
 public void AddItem(StuffItem item, ShopViewer.ExtraPadding padding)
 {
     if (this.mode == ShopViewer.ItemListController.Mode.Normal)
     {
         StuffItem stuffItem = (StuffItem)null;
         foreach (KeyValuePair <int, ItemNodeUI> keyValuePair in (IEnumerable <KeyValuePair <int, ItemNodeUI> >) this._itemListUI.optionTable)
         {
             if (keyValuePair.Value.extraData is ShopViewer.ExtraPadding extraData && extraData.item == padding.item)
             {
                 stuffItem = keyValuePair.Value.Item;
                 break;
             }
         }
         if (stuffItem != null)
         {
             stuffItem.Count += item.Count;
         }
         else
         {
             this.ItemListAddNode(item, padding);
         }
     }
     else
     {
         padding.item.Count += item.Count;
     }
     this._itemListUI.Refresh();
 }
Exemplo n.º 2
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);
            }