コード例 #1
0
        public virtual void CloseBuyPanel()
        {
            buyPanelIndex = -1;
            if (!(buyPanel != null))
            {
                return;
            }
            GameObject gameObject = null;

            try
            {
                gameObject = Scroller.GetElementAtIndex(buyPanel.ElementIndex + IndexOffset);
            }
            catch (Exception)
            {
            }
            if (gameObject != null)
            {
                LayoutElement component = gameObject.transform.parent.gameObject.GetComponent <LayoutElement>();
                if (component != null)
                {
                    component.preferredHeight = gameObject.GetComponent <LayoutElement>().preferredHeight;
                }
            }
            buyPanel.ClosePanel();
            buyPanel = null;
        }
コード例 #2
0
        public virtual void ShowShopItemPanel(int scrollIndex, int rowIndex, bool isMemberUnlocked, bool isRecentlyPurchased)
        {
            int             index      = scrollIndex * CatalogShopItemsPerRow + (rowIndex - 1);
            CatalogItemData itemData   = filteredItems[index];
            int             arrowIndex = rowIndex - 1;

            try
            {
                GameObject elementAtIndex = Scroller.GetElementAtIndex(scrollIndex + IndexOffset);
                if (elementAtIndex != null)
                {
                    CatalogShopRowItem component = elementAtIndex.GetComponent <CatalogShopRowItem>();
                    if (component != null)
                    {
                        int count = component.GetShopItems().Count;
                        if (count == 1)
                        {
                            arrowIndex = 1;
                        }
                        if (count == 2)
                        {
                            arrowIndex = CatalogShopItemsPerRow + rowIndex - 1;
                        }
                        CatalogShopItem catalogShopItem = component.GetShopItems()[rowIndex - 1];
                        catalogShopItem.AddListeners();
                    }
                }
            }
            catch (Exception)
            {
            }
            selectedItem = itemData;
            bool flag = false;

            if (buyPanel != null)
            {
                if (buyPanel.ElementIndex == scrollIndex)
                {
                    buyPanel.SetPanel(itemData, scrollIndex, arrowIndex, isMemberUnlocked, isRecentlyPurchased);
                    flag = true;
                }
                else
                {
                    CloseBuyPanel();
                }
            }
            if (flag)
            {
                return;
            }
            GameObject elementAtIndex2 = Scroller.GetElementAtIndex(scrollIndex + IndexOffset);

            if (elementAtIndex2 != null)
            {
                LayoutElement component2 = elementAtIndex2.transform.parent.gameObject.GetComponent <LayoutElement>();
                if (component2 != null)
                {
                    GameObject gameObject = UnityEngine.Object.Instantiate(ClothingPurchase);
                    DefaultValuesPooledLayoutElement component3 = gameObject.GetComponent <DefaultValuesPooledLayoutElement>();
                    component2.preferredHeight = component3.DefaultHeight + elementAtIndex2.GetComponent <LayoutElement>().preferredHeight;
                    gameObject.transform.SetParent(elementAtIndex2.transform, worldPositionStays: false);
                    buyPanel      = gameObject.GetComponent <CatalogShopBuyPanelController>();
                    buyPanelIndex = scrollIndex;
                    buyPanel.SetPanel(itemData, scrollIndex, arrowIndex, isMemberUnlocked, isRecentlyPurchased);
                    CoroutineRunner.Start(ScrollToElement(scrollIndex + IndexOffset), this, "ScrollToElement");
                }
            }
        }