Пример #1
0
        private void Buy(long key)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(key);

            FindObjectOfType <Dialogs60Component>().Get <BuyConfirmationDialog>().Show(item, new Action(this.SendOpenAvatarsEvent), this.GetName(item.Name), new Action(this.SendOpenAvatarsEvent));
            base.GetComponent <AvatarDialogComponent>().Hide();
        }
Пример #2
0
        public void XShow(GarageItem item, Action boughtAction, int price, int amount = 1, string customLabel = null, bool shopContext = false, Action cancelAction = null)
        {
            this.amount      = amount;
            this.item        = item;
            this.contextShop = shopContext;
            base.gameObject.SetActive(true);
            MainScreenComponent.Instance.OverrideOnBack(new Action(this.Cancel));
            long money = SelfUserComponent.SelfUser.GetComponent <UserXCrystalsComponent>().Money;

            this.priceValue = price;
            if (money < this.priceValue)
            {
                this.addCryDialog.SetActive(false);
                this.addXCryDialog.SetActive(true);
                this.confirmationDialog.SetActive(false);
                this.addXCry.text = string.Format((string)this.addXCryText, this.priceValue - money);
            }
            else
            {
                this.xBuyButton.GetComponent <Button>().interactable = true;
                this.onBought = boughtAction;
                this.onCancel = cancelAction;
                this.addCryDialog.SetActive(false);
                this.addXCryDialog.SetActive(false);
                this.confirmationDialog.SetActive(true);
                this.confirmationText.text = string.Format((string)this.confirmation, this.GetName(item, amount, customLabel));
                this.buyButton.SetActive(false);
                this.xBuyButton.SetActive(true);
                this.xPrice.text = this.priceValue.ToStringSeparatedByThousands();
            }
        }
Пример #3
0
 public void Init(GarageItem item, Carousel carousel)
 {
     this.Item = item;
     this.preview.SpriteUid = item.Preview;
     this.shadow.SpriteUid  = item.Preview;
     this.state             = false;
     this.carousel          = carousel;
 }
Пример #4
0
        public void UpdateViewByMarketItem(long marketItem)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(marketItem);

            this.imageSkin.SpriteUid = item.Preview;
            this.text.text           = item.Name.ToUpper();
            this.back.SetActive(true);
        }
Пример #5
0
        public void UpdateView(DailyBonusGarageItemReward containerItem)
        {
            GarageItem item = GarageItemsRegistry.GetItem <GarageItem>(containerItem.MarketItemId);

            this.imageSkin.SpriteUid = item.Preview;
            this.text.text           = item.Name.ToUpper();
            this.back.SetActive(true);
        }
Пример #6
0
        private void SetNameTo(TextMeshProUGUI tmpName, GarageItem newItem)
        {
            ContainerContentUI componentInParent        = base.GetComponentInParent <ContainerContentUI>();
            string             categoryName             = MarketItemNameLocalization.Instance.GetCategoryName(newItem.MarketItem);
            string             localizedContentItemName = string.Empty;

            if (newItem.MarketItem != null)
            {
                localizedContentItemName = componentInParent.Item.GetLocalizedContentItemName(newItem.MarketItem.Id);
            }
            if (string.IsNullOrEmpty(localizedContentItemName) || !string.IsNullOrEmpty(categoryName))
            {
                localizedContentItemName = $"{categoryName} {MarketItemNameLocalization.Instance.GetGarageItemName(this._item)}";
            }
            tmpName.text  = localizedContentItemName;
            tmpName.color = newItem.Rarity.GetRarityColor();
            base.GetComponentInParent <TooltipShowBehaviour>().TipText = MarketItemNameLocalization.GetFullItemDescription(newItem, true, (string)this._commonString, (string)this._rareString, (string)this._epicString, (string)this._legendaryString);
        }
Пример #7
0
 public void Set(ContainerBoxItem item, bool selectionIsOn)
 {
     this.Item = item;
     this.dataProvider.ClearItems();
     this._itemBuffer.AddRange(item.Content);
     this._itemBuffer.Sort(this._comparer);
     if (!selectionIsOn)
     {
         this.dataProvider.Init <GarageItem>(this._itemBuffer);
     }
     else
     {
         GarageItem selected = this._itemBuffer.First <GarageItem>();
         this.dataProvider.Init <GarageItem>(this._itemBuffer, selected);
         selected.Select();
     }
     this._itemBuffer.Clear();
     this.containerDescription.text = item.GetLocalizedDescription(item.MarketItem.Id);
     base.GetComponentInChildren <ScrollRect>().verticalNormalizedPosition = 1f;
 }
Пример #8
0
 public void Select(GarageItem item, bool immediately = false)
 {
     if ((this.selectedItem < 0) || !ReferenceEquals(this.items[this.selectedItem].Item, item))
     {
         for (int i = 0; i < this.itemsCount; i++)
         {
             GarageItemUI mui = this.items[i];
             if (ReferenceEquals(mui.Item, item))
             {
                 this.selectedItem = i;
                 if (immediately)
                 {
                     this.targetPosition = -this.items[this.selectedItem].RectTransform.anchoredPosition.x;
                     Vector2 anchoredPosition = this.content.anchoredPosition;
                     anchoredPosition.x            = this.targetPosition;
                     this.content.anchoredPosition = anchoredPosition;
                 }
             }
         }
     }
 }
Пример #9
0
 public void Set(GarageItem item)
 {
     if (item.UserItem != null)
     {
         base.gameObject.SetActive(false);
     }
     else
     {
         int price  = item.Price;
         int xPrice = item.XPrice;
         this.price.transform.parent.gameObject.SetActive(price > 0);
         if (price > 0)
         {
             this.price.SetPrice(item.OldPrice, price);
         }
         this.xPrice.transform.parent.gameObject.SetActive(xPrice > 0);
         if (xPrice > 0)
         {
             this.xPrice.SetPrice(item.OldXPrice, xPrice);
         }
         base.gameObject.SetActive((xPrice != 0) || (price != 0));
     }
 }
Пример #10
0
 public void SetDataProvider(object dataProvider)
 {
     if (!ReferenceEquals(this._item, dataProvider))
     {
         this._item = dataProvider as GarageItem;
         if (this._item != null)
         {
             this.SetNameTo(this._name, this._item);
             this._own.SetActive(!ReferenceEquals(this._item.UserItem, null));
             this._preview.SpriteUid = this._item.Preview;
             RectTransform component = this._preview.GetComponent <RectTransform>();
             if (dataProvider is PremiumItem)
             {
                 component.anchoredPosition = Vector2.zero;
                 this._preview.GetComponent <Image>().SetNativeSize();
             }
             else
             {
                 VisualItem item = dataProvider as VisualItem;
                 if (item != null)
                 {
                     if ((item.Type != VisualItem.VisualItemType.Paint) && (item.Type != VisualItem.VisualItemType.Coating))
                     {
                         component.anchoredPosition = Vector2.zero;
                         component.sizeDelta        = new Vector2(500f, 300f);
                     }
                     else
                     {
                         component.anchoredPosition = new Vector2(-76f, -88f);
                         component.sizeDelta        = new Vector2(1121f, 544f);
                     }
                 }
             }
         }
     }
 }
Пример #11
0
 private string GetName(GarageItem item, int amount, string customLabel) =>
 !string.IsNullOrEmpty(customLabel) ? customLabel : (((amount <= 1) ? string.Empty : (amount + " ")) + this.GetName(item));
Пример #12
0
        private string GetName(GarageItem item)
        {
            VisualItem item2 = item as VisualItem;

            return(((item2 == null) || (item2.ParentItem == null)) ? item.Name : MarketItemNameLocalization.GetDetailedName(item2.MarketItem));
        }