public void Show(AugmentTabController.AugmentRecipe recipe)
        {
            gameObject.SetActive(true);

            var item        = recipe.FromItem;
            var rarity      = item.GetRarity();
            var magicItem   = item.GetMagicItem();
            var rarityColor = item.GetRarityColor();

            MagicBG.enabled = item.IsMagic();
            MagicBG.color   = rarityColor;

            NameText.text = Localization.instance.Localize(item.GetDecoratedName());
            Icon.sprite   = item.GetIcon();

            var availableEffects = AugmentTabController.GetAvailableAugments(recipe, item, magicItem, rarity);
            var t = new StringBuilder();

            foreach (var effectDef in availableEffects)
            {
                var values       = effectDef.GetValuesForRarity(item.GetRarity());
                var valueDisplay = values != null ? $"({values.MinValue}-{values.MaxValue})" : "";
                t.AppendLine($"‣ {string.Format(effectDef.DisplayText, valueDisplay)}");
            }

            Description.color = rarityColor;
            Description.text  = t.ToString();
        }
Exemplo n.º 2
0
        public void Show(AugmentTabController.AugmentRecipe recipe, Action <AugmentTabController.AugmentRecipe, MagicItemEffect> onCompleteCallback)
        {
            gameObject.SetActive(true);

            _audioSource.loop   = true;
            _audioSource.clip   = EpicLoot.Assets.ItemLoopSFX;
            _audioSource.volume = 0.5f;
            _audioSource.Play();

            var item        = recipe.FromItem.Extended();
            var rarity      = item.GetRarity();
            var magicItem   = item.GetMagicItem();
            var rarityColor = item.GetRarityColor();

            MagicBG.enabled = item.IsMagic();
            MagicBG.color   = rarityColor;

            NameText.text    = Localization.instance.Localize(item.GetDecoratedName());
            Description.text = Localization.instance.Localize(item.GetTooltip());
            Icon.sprite      = item.GetIcon();

            foreach (var button in EffectChoiceButtons)
            {
                button.gameObject.SetActive(false);
            }

            var newEffectOptions = LootRoller.RollAugmentEffects(item, magicItem, recipe.EffectIndex);

            for (var index = 0; index < newEffectOptions.Count; index++)
            {
                var effect = newEffectOptions[index];
                var button = EffectChoiceButtons[index];
                button.gameObject.SetActive(true);
                var text = button.GetComponentInChildren <Text>();
                text.text  = (index == 0 ? "<color=white>(keep)</color> " : "") + MagicItem.GetEffectText(effect, rarity, true);
                text.color = rarityColor;
                var buttonColor = button.GetComponent <ButtonTextColor>();
                buttonColor.m_defaultColor = rarityColor;
                button.onClick.RemoveAllListeners();
                button.onClick.AddListener(() => {
                    onCompleteCallback(recipe, effect);
                    OnClose();
                });
            }
        }