protected void onObjectAddedOrRemoved(ManipulatableObject manipulatableObject) { inventoryCountPairs = GetAvailableItems(); if (manipulatableObject.Type != decorationDefinitionType || inventoryCountPairs == null) { return; } inventoryCountPairs = sortInventoryList(inventoryCountPairs); bool flag = false; int count = inventoryCountPairs.Count; for (int i = 0; i < count; i++) { DecorationDefinitionType key = inventoryCountPairs[i].Key; if (key.GetId() == manipulatableObject.DefinitionId) { if (PooledScrollRect.IsIndexCellVisible(i + numberOfStaticButtons)) { IglooCustomizationButton component = PooledScrollRect.GetCellAtIndex(i + numberOfStaticButtons).GetComponent <IglooCustomizationButton>(); component.SetItemCount(inventoryCountPairs[i].Value, showItemCountsWithZeroCount, tintItemsWithZeroCount); } objectAddedOrRemoved(i, manipulatableObject); flag = true; break; } } if (!flag) { manipulatedObjectNotFound(manipulatableObject); } }
protected void scrollToLatestPurchase() { if (recentDecorationsService == null || !recentDecorationsService.ShouldShowMostRecentPurchase || recentDecorationsService.MostRecentPurchaseType != decorationType) { return; } int elementIndex = 0; for (int i = 0; i < inventoryCountPairs.Count; i++) { DecorationDefinitionType key = inventoryCountPairs[i].Key; if (key.GetId() == recentDecorationsService.MostRecentPurchaseId) { elementIndex = i; break; } } PooledScrollRect.CenterOnElement(elementIndex); resetScrollRectPersistentPosition(); recentDecorationsService.ShouldShowMostRecentPurchase = false; }