示例#1
0
 protected override void onPreWarm([Optional, DefaultParameterValue(null)] object param)
 {
     this.m_params = (InputParameters)param;
 }
        protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
        {
            this.m_inputParameters = (InputParameters)param;
            CharacterInstance activeCharacter = GameLogic.Binder.GameState.Player.ActiveCharacter;

            GameLogic.Item item = this.getReferenceItem();
            switch (item.Type)
            {
            case ItemType.Weapon:
                this.Header.text           = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_WEAPON, null, false));
                this.PowerIcon.sprite      = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_weapon");
                this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_ATTACK, null, false));
                break;

            case ItemType.Armor:
                this.Header.text           = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_ARMOR, null, false));
                this.PowerIcon.sprite      = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_armor");
                this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_DEFENSE, null, false));
                break;

            case ItemType.Cloak:
                this.Header.text           = StringExtensions.ToUpperLoca(_.L(ConfigLoca.ITEMS_CLOAK, null, false));
                this.PowerIcon.sprite      = PlayerView.Binder.SpriteResources.getSprite("Menu", "icon_mini_spell");
                this.PowerDescription.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.HEROVIEW_POWER_SKILLDMG, null, false));
                break;

            default:
                this.Header.text      = "CHANGE ME";
                this.PowerIcon.sprite = null;
                break;
            }
            this.Title.text  = StringExtensions.ToUpperLoca(item.Name);
            this.Icon.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", item.SpriteId);
            MenuHelpers.RefreshStarContainer(this.Stars, item.Rarity);
            if (this.ItemInstance != null)
            {
                double num;
                double num2;
                if (!this.ItemInstance.InspectedByPlayer)
                {
                    CmdInspectItem.ExecuteStatic(this.ItemInstance);
                }
                App.Binder.ConfigMeta.ItemSellCurve(activeCharacter, this.ItemInstance.Item.Type, this.ItemInstance.Rarity, this.ItemInstance.Level, this.ItemInstance.Rank, out num, out num2);
                this.SellButton.gameObject.SetActive(true);
                if (num > 0.0)
                {
                    this.SellButton.ButtonLabelIcon.sprite = PlayerView.Binder.SpriteResources.getSprite(ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Token]);
                    this.SellButton.ButtonLabel.text       = MenuHelpers.BigValueToString(num);
                }
                else
                {
                    this.SellButton.ButtonLabelIcon.sprite = PlayerView.Binder.SpriteResources.getSprite(ConfigUi.RESOURCE_TYPE_SPRITES[ResourceType.Coin]);
                    this.SellButton.ButtonLabel.text       = MenuHelpers.BigValueToString(num2);
                }
                if (!ConfigMeta.CAN_SELL_HIGHEST_RARITY_ITEM && (this.ItemInstance.Rarity == ConfigMeta.ITEM_HIGHEST_RARITY))
                {
                    this.SellButton.ButtonHeader.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_VALUE, null, false));
                }
                else
                {
                    this.SellButton.ButtonHeader.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.UI_PROMPT_SELL, null, false));
                }
                this.EquipButton.gameObject.SetActive(true);
                this.EquipButtonImage.sprite = PlayerView.Binder.SpriteResources.getSprite("Menu", "uix_button_selected");
            }
            else
            {
                this.SellButton.gameObject.SetActive(false);
                this.EquipButton.gameObject.SetActive(false);
            }
            this.onRefresh();
        }
示例#3
0
 protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
 {
     this.m_params = (InputParameters)param;
     this.ScrollRect.verticalNormalizedPosition = 1f;
     this.onRefresh();
 }
 protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
 {
     this.m_inputParameters = (InputParameters)param;
     if (!string.IsNullOrEmpty(this.m_inputParameters.Headline))
     {
         this.HeaderTitle.text    = StringExtensions.ToUpperLoca(this.m_inputParameters.Headline);
         this.HeaderTitle.enabled = true;
     }
     else
     {
         this.HeaderTitle.enabled = false;
     }
     if (!string.IsNullOrEmpty(this.m_inputParameters.Title))
     {
         this.DividerRoot.SetActive(true);
         this.DividerTitle.enabled = true;
         this.DividerTitle.text    = StringExtensions.ToUpperLoca(this.m_inputParameters.Title);
     }
     else
     {
         this.DividerRoot.SetActive(false);
         this.DividerTitle.enabled = false;
     }
     if (!string.IsNullOrEmpty(this.m_inputParameters.Message))
     {
         this.MessageText.enabled = true;
         this.MessageText.text    = this.m_inputParameters.Message;
     }
     else
     {
         this.MessageText.enabled = false;
     }
     if (this.m_inputParameters.CostAmount > 0.0)
     {
         this.Button.SetActive(true);
         this.ButtonIcon.gameObject.SetActive(true);
         this.ButtonText.text = MenuHelpers.BigValueToString(Math.Round(this.m_inputParameters.CostAmount));
         this.SetIconForResource(ref this.ButtonIcon, this.m_inputParameters.CostResourceType);
     }
     else if (!string.IsNullOrEmpty(this.m_inputParameters.ButtonText))
     {
         this.Button.SetActive(true);
         this.ButtonIcon.gameObject.SetActive(false);
         this.ButtonText.text = this.m_inputParameters.ButtonText;
         if (this.m_inputParameters.ButtonIcon != null)
         {
             Sprite iconForSprite = this.GetIconForSprite(this.m_inputParameters.ButtonIcon);
             if (iconForSprite != null)
             {
                 this.ButtonIcon.gameObject.SetActive(true);
                 this.ButtonIcon.sprite = iconForSprite;
             }
         }
     }
     else
     {
         this.Button.SetActive(false);
     }
     if (this.m_inputParameters.DisposableBackgroundTexture != null)
     {
         this.RawBg.enabled = true;
         this.RawBg.texture = this.m_inputParameters.DisposableBackgroundTexture;
         float num     = ((float)this.m_inputParameters.DisposableBackgroundTexture.width) / ((float)this.m_inputParameters.DisposableBackgroundTexture.height);
         float newSize = Mathf.Clamp((float)(this.m_defaultWidth / num), (float)200f, (float)1880f);
         RectTransformExtensions.SetHeight(base.RectTm, newSize);
         base.RewardsGrid.gameObject.SetActive(false);
     }
     else
     {
         this.RawBg.enabled = false;
         RectTransformExtensions.SetHeight(base.RectTm, this.m_defaultHeight);
         List <Reward> rewards = Service.Binder.PromotionManager.GetRewards(this.m_inputParameters.Promotion);
         if ((rewards != null) && (rewards.Count > 0))
         {
             base.RewardsGrid.gameObject.SetActive(true);
             base.InitRewardGrid(rewards);
         }
         else
         {
             base.RewardsGrid.gameObject.SetActive(false);
         }
     }
 }
        protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
        {
            this.m_inputParameters = (InputParameters)param;
            if (!string.IsNullOrEmpty(this.m_inputParameters.Headline))
            {
                this.PopupTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Headline);
            }
            else
            {
                this.PopupTitle.enabled = false;
            }
            if (!string.IsNullOrEmpty(this.m_inputParameters.Title))
            {
                this.DividerTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Title);
            }
            else
            {
                this.DividerTitle.enabled = false;
            }
            if (!string.IsNullOrEmpty(this.m_inputParameters.Message))
            {
                this.DescriptionText.enabled = true;
                this.DescriptionText.text    = this.m_inputParameters.Message;
            }
            else
            {
                this.DescriptionText.enabled = false;
            }
            if (this.m_inputParameters.DisposableBackgroundTexture != null)
            {
                this.RawBg.enabled = true;
                this.RawBg.texture = this.m_inputParameters.DisposableBackgroundTexture;
                float num     = ((float)this.m_inputParameters.DisposableBackgroundTexture.width) / ((float)this.m_inputParameters.DisposableBackgroundTexture.height);
                float newSize = Mathf.Clamp((float)(this.m_defaultWidth / num), (float)200f, (float)1880f);
                RectTransformExtensions.SetHeight(base.RectTm, newSize);
            }
            else
            {
                this.RawBg.enabled = false;
                RectTransformExtensions.SetHeight(base.RectTm, this.m_defaultHeight);
            }
            string flareProductIdForPromoSlot = Service.Binder.PromotionManager.GetFlareProductIdForPromoSlot(this.m_inputParameters.Slot);

            if (!string.IsNullOrEmpty(flareProductIdForPromoSlot))
            {
                ShopEntry shopEntryByFlareProductId = Service.Binder.ShopManager.GetShopEntryByFlareProductId(flareProductIdForPromoSlot);
                if (shopEntryByFlareProductId != null)
                {
                    this.m_purchaseController    = new ShopPurchaseController(shopEntryByFlareProductId, null, PathToShopType.Vendor, null, new Action <ShopEntry, PurchaseResult>(this.onPurchaseComplete));
                    this.PurchaseButtonText.text = this.m_purchaseController.getPriceText(1);
                    if (this.m_inputParameters.DisposableBackgroundTexture == null)
                    {
                        base.RewardsGrid.gameObject.SetActive(true);
                        List <Reward>  rewards = new List <Reward>();
                        PremiumProduct prod    = Service.Binder.ShopService.GetProduct(flareProductIdForPromoSlot);
                        foreach (ProductReward reward in ConfigShops.GetRewardsFromProduct(prod))
                        {
                            rewards.Add(ConfigShops.GetRewardFromProductReward(reward, prod));
                        }
                        base.InitRewardGrid(rewards);
                    }
                    else
                    {
                        base.RewardsGrid.gameObject.SetActive(false);
                    }
                }
            }
        }
示例#6
0
 protected override void onPreShow([Optional, DefaultParameterValue(null)] object param)
 {
     this.m_inputParameters = (InputParameters)param;
     if (!string.IsNullOrEmpty(this.m_inputParameters.Headline))
     {
         this.HeaderTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Headline);
     }
     else
     {
         this.HeaderTitle.text = StringExtensions.ToUpperLoca(_.L(ConfigLoca.APPBOY_POPUP_HEADER, null, false));
     }
     if (!string.IsNullOrEmpty(this.m_inputParameters.Title))
     {
         this.DividerRoot.SetActive(true);
         this.DividerTitle.text = StringExtensions.ToUpperLoca(this.m_inputParameters.Title);
     }
     else
     {
         this.DividerRoot.SetActive(false);
     }
     if (!string.IsNullOrEmpty(this.m_inputParameters.Message))
     {
         this.MessageText.enabled = true;
         this.MessageText.text    = this.m_inputParameters.Message;
     }
     else
     {
         this.MessageText.enabled = false;
     }
     if (!string.IsNullOrEmpty(this.m_inputParameters.SingleButtonText))
     {
         this.SingleButton.SetActive(true);
         this.DualButtonRoot.SetActive(false);
         this.SingleButtonText.text = this.m_inputParameters.SingleButtonText;
     }
     else
     {
         this.SingleButton.gameObject.SetActive(false);
         if (!string.IsNullOrEmpty(this.m_inputParameters.DualButtonLeftText))
         {
             this.DualButtonRoot.SetActive(true);
             this.DualButtonLeftText.text  = this.m_inputParameters.DualButtonLeftText;
             this.DualButtonRightText.text = this.m_inputParameters.DualButtonRightText;
         }
         else
         {
             this.DualButtonRoot.SetActive(false);
         }
     }
     if (this.m_inputParameters.DisposableIconTexture != null)
     {
         this.DefaultIcon.enabled = false;
         this.RawIcon.enabled     = true;
         this.RawIcon.texture     = this.m_inputParameters.DisposableIconTexture;
     }
     else
     {
         this.DefaultIcon.enabled = true;
         this.RawIcon.enabled     = false;
     }
     if (this.m_inputParameters.DisposableBackgroundTexture != null)
     {
         this.RawBg.enabled = true;
         this.RawBg.texture = this.m_inputParameters.DisposableBackgroundTexture;
         float num     = ((float)this.m_inputParameters.DisposableBackgroundTexture.width) / ((float)this.m_inputParameters.DisposableBackgroundTexture.height);
         float newSize = Mathf.Clamp((float)(this.m_defaultWidth / num), (float)200f, (float)1880f);
         RectTransformExtensions.SetHeight(base.RectTm, newSize);
     }
     else
     {
         this.RawBg.enabled = false;
         RectTransformExtensions.SetHeight(base.RectTm, this.m_defaultHeight);
     }
     PlayerView.Binder.EventBus.AppboyAction("message-displayed", this.m_inputParameters.CampaignId);
 }