private void AddUpgradeListForItem(VirtualItem item) { if (item.HasUpgrades) { ReorderableListControl listControl = new ReorderableListControl(ReorderableListFlags.DisableDuplicateCommand); listControl.ItemInserted += OnItemInsert <UpgradeItem>; listControl.ItemRemoving += OnItemRemoving <UpgradeItem>; UpgradeItemListAdaptor listAdaptor = new UpgradeItemListAdaptor(item.Upgrades, 20, () => { return(new UpgradeItem()); }, DrawItem <UpgradeItem>); _upgradesListAdaptors.Add(item, listAdaptor); _upgradesListControls.Add(item, listControl); } }
protected override void DoOnExplorerSelectionChange(IItem item) { if (item is VirtualItem) { GUI.FocusControl(string.Empty); if (item is SingleUseItem || item is LifeTimeItem) { (item as VirtualItem).RefreshUpgrades(); _upgradeListAdaptor = new UpgradeItemListAdaptor((item as VirtualItem).Upgrades, 20, () => { return(new UpgradeItem()); }, (position, theItem, index) => { var size = GUI.skin.GetStyle("label").CalcSize(new GUIContent(theItem.ID)); GUI.Label(new Rect(position.x, position.y, size.x, position.height), theItem.ID); if (GUI.Button(new Rect(position.x + size.x + 10, position.y, 50, position.height), "Edit")) { _treeExplorer.SelectItem(theItem); } return(theItem); }); } if (item is PurchasableItem) { if (item is VirtualItemPack) { _packListView.UpdateDisplayItem(item as VirtualItemPack); } _purchaseListView.UpdateDisplayItem(item as PurchasableItem); } //Debug.Log(GameKitEditorWindow.GetInstance().FindVirtualItemPropertyPath(item as VirtualItem)); } else if (item is VirtualCategory) { _categoryPropertyView.UpdateDisplayItem(item as VirtualCategory); } }