// public BowlAudioSystem BowlAudioSystem = new BowlAudioSystem(); private void Start() { int itemType = (int)ShopMenuEventListener.ShopStates.Bowls; for (int i = 0; i < Inventory.GetItemCount(itemType); i++) { if (!PlayerPreferencesManager.IsItemInitialized(itemType, i, false)) { PlayerPreferencesManager.SetPurchasedState ( itemType, i, Inventory.allBowls[i].IsPurchased ); } } for (int i = 0; i < Inventory.GetItemCount(itemType); i++) { if (Inventory.allBowls[i].CurrentState != Item.State.Loaded) { Inventory.allBowls[i].CurrentState = PlayerPreferencesManager.GetPurchasedState(itemType, i, false) ? Item.State.Purchased : Item.State.Locked; } } }
public void OnItemPurchased(int type, int index) { PopupManager.Instance.spinnerLoading.Hide(); // PopupManager.Instance.messagePopup.Show("Congratulations!", "Your purchase was successful."); // Debug.Log("Selected Index: " + selectedItem.index); // Debug.Log("Index: " + index); switch (type) { case 0: // carpet Inventory.allCarpets[index].CurrentState = Item.State.Purchased; OnClickItemButton(index); content.SetItems((int)currentState); break; case 1: // bowl Inventory.allBowls[index].CurrentState = Item.State.Purchased; OnClickItemButton(index); content.SetItems((int)currentState); break; case 2: // slideshow Inventory.allSlideShows[index].CurrentState = Item.State.Purchased; OnClickItemButton(index); Inventory.slideShowManager.activeMusicIndex = 0; content.SetItems((int)currentState); break; } PlayerPreferencesManager.SetPurchasedState((int)currentState, index, true); }