private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo) { BestiaryUICollectionInfo uiCollectionInfo = this.GetUICollectionInfo(entry, extraInfo); IOrderedEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = new List <IBestiaryInfoElement>((IEnumerable <IBestiaryInfoElement>)entry.Info).GroupBy <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(new Func <IBestiaryInfoElement, UIBestiaryEntryInfoPage.BestiaryInfoCategory>(this.GetBestiaryInfoCategory)).OrderBy <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>((Func <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement>, UIBestiaryEntryInfoPage.BestiaryInfoCategory>)(x => x.Key)); UIElement uiElement1 = (UIElement)null; foreach (IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> source in (IEnumerable <IGrouping <UIBestiaryEntryInfoPage.BestiaryInfoCategory, IBestiaryInfoElement> >)orderedEnumerable) { if (source.Count <IBestiaryInfoElement>() != 0) { bool flag = false; foreach (IBestiaryInfoElement bestiaryInfoElement in (IEnumerable <IBestiaryInfoElement>)source) { UIElement uiElement2 = bestiaryInfoElement.ProvideUIElement(uiCollectionInfo); if (uiElement2 != null) { this._list.Add(uiElement2); flag = true; } } if (flag) { UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true); horizontalSeparator1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); horizontalSeparator1.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f; UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1; this._list.Add((UIElement)horizontalSeparator2); uiElement1 = (UIElement)horizontalSeparator2; } } } this._list.Remove(uiElement1); }
private BestiaryUICollectionInfo GetUICollectionInfo(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo) { BestiaryUICollectionInfo result = entry.UIInfoProvider?.GetEntryUICollectionInfo() ?? default(BestiaryUICollectionInfo); result.OwnerEntry = entry; return(result); }
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); } }
protected void GetDropInfo(DropRateInfo dropRateInfo, BestiaryUICollectionInfo uiinfo, out string stackRange, out string droprate) { if (dropRateInfo.stackMin != dropRateInfo.stackMax) { stackRange = $" ({dropRateInfo.stackMin}-{dropRateInfo.stackMax})"; } else if (dropRateInfo.stackMin == 1) { stackRange = ""; } else { stackRange = " (" + dropRateInfo.stackMin + ")"; } string originalFormat = "P"; if ((double)dropRateInfo.dropRate < 0.001) { originalFormat = "P4"; } if (dropRateInfo.dropRate != 1f) { droprate = Utils.PrettifyPercentDisplay(dropRateInfo.dropRate, originalFormat); } else { droprate = "100%"; } if (uiinfo.UnlockState != BestiaryEntryUnlockState.CanShowDropsWithDropRates_4) { droprate = "???"; stackRange = ""; } }
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); } }
private BestiaryUICollectionInfo GetUICollectionInfo( BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo) { IBestiaryUICollectionInfoProvider uiInfoProvider = entry.UIInfoProvider; BestiaryUICollectionInfo uiCollectionInfo = uiInfoProvider == null ? new BestiaryUICollectionInfo() : uiInfoProvider.GetEntryUICollectionInfo(); uiCollectionInfo.OwnerEntry = entry; return(uiCollectionInfo); }
public UIBestiaryEntryIcon(BestiaryEntry entry, bool isPortrait) { _entry = entry; IgnoresMouseInteraction = true; OverrideSamplerState = Main.DefaultSamplerState; UseImmediateMode = true; Width.Set(0f, 1f); Height.Set(0f, 1f); _notUnlockedTexture = Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", Main.content, (AssetRequestMode)1); _isPortrait = isPortrait; _collectionInfo = _entry.UIInfoProvider.GetEntryUICollectionInfo(); }
public UIBestiaryEntryIcon(BestiaryEntry entry, bool isPortrait) { this._entry = entry; this.IgnoresMouseInteraction = true; this.OverrideSamplerState = Main.DefaultSamplerState; this.UseImmediateMode = true; this.Width.Set(0.0f, 1f); this.Height.Set(0.0f, 1f); this._notUnlockedTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Icon_Locked", (AssetRequestMode)1); this._isPortrait = isPortrait; this._collectionInfo = this._entry.UIInfoProvider.GetEntryUICollectionInfo(); }
public override void Update(GameTime gameTime) { _collectionInfo = _entry.UIInfoProvider.GetEntryUICollectionInfo(); CalculatedStyle dimensions = GetDimensions(); bool isHovered = base.IsMouseHovering || ForceHover; _entry.Icon.Update(_collectionInfo, dimensions.ToRectangle(), new EntryIconDrawSettings { iconbox = dimensions.ToRectangle(), IsPortrait = _isPortrait, IsHovered = isHovered }); base.Update(gameTime); }
public override void Update(GameTime gameTime) { this._collectionInfo = this._entry.UIInfoProvider.GetEntryUICollectionInfo(); CalculatedStyle dimensions = this.GetDimensions(); bool flag = this.IsMouseHovering || this.ForceHover; this._entry.Icon.Update(this._collectionInfo, dimensions.ToRectangle(), new EntryIconDrawSettings() { iconbox = dimensions.ToRectangle(), IsPortrait = this._isPortrait, IsHovered = flag }); base.Update(gameTime); }
protected void GetDropInfo( DropRateInfo dropRateInfo, BestiaryUICollectionInfo uiinfo, out string stackRange, out string droprate) { stackRange = dropRateInfo.stackMin == dropRateInfo.stackMax ? (dropRateInfo.stackMin != 1 ? " (" + (object)dropRateInfo.stackMin + ")" : "") : string.Format(" ({0}-{1})", (object)dropRateInfo.stackMin, (object)dropRateInfo.stackMax); string originalFormat = "P"; if ((double)dropRateInfo.dropRate < 0.001) { originalFormat = "P4"; } droprate = (double)dropRateInfo.dropRate == 1.0 ? "100%" : Utils.PrettifyPercentDisplay(dropRateInfo.dropRate, originalFormat); if (uiinfo.UnlockState == BestiaryEntryUnlockState.CanShowDropsWithDropRates_4) { return; } droprate = "???"; stackRange = ""; }
private void AddInfoToList(BestiaryEntry entry, ExtraBestiaryInfoPageInformation extraInfo) { BestiaryUICollectionInfo uICollectionInfo = GetUICollectionInfo(entry, extraInfo); IOrderedEnumerable <IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> > orderedEnumerable = from x in new List <IBestiaryInfoElement>(entry.Info).GroupBy(GetBestiaryInfoCategory) orderby x.Key select x; UIElement item = null; foreach (IGrouping <BestiaryInfoCategory, IBestiaryInfoElement> item2 in orderedEnumerable) { if (item2.Count() == 0) { continue; } bool flag = false; foreach (IBestiaryInfoElement item3 in item2) { UIElement uIElement = item3.ProvideUIElement(uICollectionInfo); if (uIElement != null) { _list.Add(uIElement); flag = true; } } if (flag) { UIHorizontalSeparator uIHorizontalSeparator = new UIHorizontalSeparator { Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Color = new Color(89, 116, 213, 255) * 0.9f }; _list.Add(uIHorizontalSeparator); item = uIHorizontalSeparator; } } _list.Remove(item); }