Exemple #1
0
        public UIBestiaryInfoItemLine(
            DropRateInfo info,
            BestiaryUICollectionInfo uiinfo,
            float textScale = 1f)
        {
            this._infoDisplayItem = new Item();
            this._infoDisplayItem.SetDefaults(info.itemId);
            this.SetBestiaryNotesOnItemCache(info);
            this.SetPadding(0.0f);
            this.PaddingLeft  = 10f;
            this.PaddingRight = 10f;
            this.Width.Set(-14f, 1f);
            this.Height.Set(32f, 0.0f);
            this.Left.Set(5f, 0.0f);
            this.OnMouseOver += new UIElement.MouseEvent(this.MouseOver);
            this.OnMouseOut  += new UIElement.MouseEvent(this.MouseOut);
            this.BorderColor  = new Color(89, 116, 213, (int)byte.MaxValue);
            string stackRange;
            string droprate;

            this.GetDropInfo(info, uiinfo, out stackRange, out droprate);
            if (uiinfo.UnlockState < BestiaryEntryUnlockState.CanShowDropsWithoutDropRates_3)
            {
                this._hideMouseOver = true;
                Asset <M0> asset   = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", (AssetRequestMode)1);
                UIElement  element = new UIElement()
                {
                    Height = new StyleDimension(0.0f, 1f),
                    Width  = new StyleDimension(0.0f, 1f),
                    HAlign = 0.5f,
                    VAlign = 0.5f
                };
                element.SetPadding(0.0f);
                UIImage uiImage1 = new UIImage((Asset <Texture2D>)asset);
                uiImage1.ImageScale = 0.55f;
                uiImage1.HAlign     = 0.5f;
                uiImage1.VAlign     = 0.5f;
                UIImage uiImage2 = uiImage1;
                element.Append((UIElement)uiImage2);
                this.Append(element);
            }
            else
            {
                UIItemIcon uiItemIcon = new UIItemIcon(this._infoDisplayItem, uiinfo.UnlockState < BestiaryEntryUnlockState.CanShowDropsWithoutDropRates_3);
                uiItemIcon.IgnoresMouseInteraction = true;
                uiItemIcon.HAlign = 0.0f;
                uiItemIcon.Left   = new StyleDimension(4f, 0.0f);
                this.Append((UIElement)uiItemIcon);
                if (!string.IsNullOrEmpty(stackRange))
                {
                    droprate = stackRange + " " + droprate;
                }
                UITextPanel <string> uiTextPanel = new UITextPanel <string>(droprate, textScale, false);
                uiTextPanel.IgnoresMouseInteraction = true;
                uiTextPanel.DrawPanel = false;
                uiTextPanel.HAlign    = 1f;
                uiTextPanel.Top       = new StyleDimension(-4f, 0.0f);
                this.Append((UIElement)uiTextPanel);
            }
        }
 public UIBestiaryInfoItemLine(DropRateInfo info, BestiaryUICollectionInfo uiinfo, float textScale = 1f)
 {
     _infoDisplayItem = new Item();
     _infoDisplayItem.SetDefaults(info.itemId);
     SetBestiaryNotesOnItemCache(info);
     SetPadding(0f);
     PaddingLeft  = 10f;
     PaddingRight = 10f;
     Width.Set(-14f, 1f);
     Height.Set(32f, 0f);
     Left.Set(5f, 0f);
     base.OnMouseOver += MouseOver;
     base.OnMouseOut  += MouseOut;
     BorderColor       = new Color(89, 116, 213, 255);
     GetDropInfo(info, uiinfo, out string stackRange, out string droprate);
     if (uiinfo.UnlockState < BestiaryEntryUnlockState.CanShowDropsWithoutDropRates_3)
     {
         _hideMouseOver = true;
         Asset <Texture2D> texture   = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", (AssetRequestMode)1);
         UIElement         uIElement = new UIElement
         {
             Height = new StyleDimension(0f, 1f),
             Width  = new StyleDimension(0f, 1f),
             HAlign = 0.5f,
             VAlign = 0.5f
         };
         uIElement.SetPadding(0f);
         UIImage element = new UIImage(texture)
         {
             ImageScale = 0.55f,
             HAlign     = 0.5f,
             VAlign     = 0.5f
         };
         uIElement.Append(element);
         Append(uIElement);
     }
     else
     {
         UIItemIcon element2 = new UIItemIcon(_infoDisplayItem, uiinfo.UnlockState < BestiaryEntryUnlockState.CanShowDropsWithoutDropRates_3)
         {
             IgnoresMouseInteraction = true,
             HAlign = 0f,
             Left   = new StyleDimension(4f, 0f)
         };
         Append(element2);
         if (!string.IsNullOrEmpty(stackRange))
         {
             droprate = stackRange + " " + droprate;
         }
         UITextPanel <string> element3 = new UITextPanel <string>(droprate, textScale)
         {
             IgnoresMouseInteraction = true,
             DrawPanel = false,
             HAlign    = 1f,
             Top       = new StyleDimension(-4f, 0f)
         };
         Append(element3);
     }
 }