public void SetState(CatalogShopBuyPanelState state) { State = state; CatalogBuyPanel catalogBuyPanel = CatalogBuyPanels.Find((CatalogBuyPanel x) => x.State == state); if (!(catalogBuyPanel != null)) { return; } for (int i = 0; i < CatalogBuyPanels.Count; i++) { CatalogBuyPanels[i].Hide(); } catalogBuyPanel.SetText(GetItemName(), ItemData.creatorName, ItemData.numberSold.ToString()); if (state == CatalogShopBuyPanelState.Purchase) { CatalogBuyPanelPurchase catalogBuyPanelPurchase = catalogBuyPanel as CatalogBuyPanelPurchase; catalogBuyPanelPurchase.ItemCostText.text = ItemData.cost.ToString(); int coins = Service.Get <CPDataEntityCollection>().GetComponent <CoinsData>(Service.Get <CPDataEntityCollection>().LocalPlayerHandle).Coins; if (coins >= ItemData.cost) { catalogBuyPanelPurchase.SetVisibleButton(hasEnoughCoins: true); AllowPurchase(state: true); } else { catalogBuyPanelPurchase.SetVisibleButton(hasEnoughCoins: false); } } catalogBuyPanel.Show(); }
public void SetPanel(CatalogItemData itemData, int elementIndex, int arrowIndex, bool isMemberUnlocked, bool isRecentlyPurchased) { ElementIndex = elementIndex; ItemData = itemData; CatalogShopBuyPanelState catalogShopBuyPanelState = CatalogShopBuyPanelState.Purchase; catalogShopBuyPanelState = ((!isMemberUnlocked) ? CatalogShopBuyPanelState.MemberLocked : ((((ItemData.equipment.equipmentId != 0) ? true : false) || isRecentlyPurchased) ? CatalogShopBuyPanelState.AlreadyOwned : CatalogShopBuyPanelState.Purchase)); SetState(catalogShopBuyPanelState); SetArrowIndex(arrowIndex); SetEquipment(); }