private static void AddHorizontalSeparator(UIElement Container, float accumualtedHeight) { UIHorizontalSeparator element = new UIHorizontalSeparator { Width = StyleDimension.FromPercent(1f), Top = StyleDimension.FromPixels(accumualtedHeight - 8f), Color = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f }; Container.Append(element); }
private static void AddHorizontalSeparator(UIElement Container, float accumualtedHeight) { UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true); horizontalSeparator1.Width = StyleDimension.FromPercent(1f); horizontalSeparator1.Top = StyleDimension.FromPixels(accumualtedHeight - 8f); horizontalSeparator1.Color = Color.Lerp(Color.White, new Color(63, 65, 151, (int)byte.MaxValue), 0.85f) * 0.9f; UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1; Container.Append((UIElement)horizontalSeparator2); }
private void BuildPage() { this.RemoveAllChildren(); UIElement uiElement = new UIElement(); uiElement.Width.Set(0.0f, 0.8f); uiElement.MaxWidth.Set(800f, 0.0f); uiElement.MinWidth.Set(600f, 0.0f); uiElement.Top.Set(240f, 0.0f); uiElement.Height.Set(-240f, 1f); uiElement.HAlign = 0.5f; this.Append(uiElement); UIPanel uiPanel1 = new UIPanel(); uiPanel1.Width = StyleDimension.Fill; uiPanel1.Height = new StyleDimension(-110f, 1f); uiPanel1.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel1.PaddingRight = 0.0f; uiPanel1.PaddingLeft = 0.0f; UIPanel uiPanel2 = uiPanel1; uiElement.Append((UIElement)uiPanel2); int num1 = 35; int num2 = num1; int num3 = 30; UIElement element1 = new UIElement() { Width = StyleDimension.Fill, Height = StyleDimension.FromPixelsAndPercent((float)-(num3 + 4 + 5), 1f), VAlign = 1f }; element1.SetPadding(0.0f); uiPanel2.Append(element1); UIElement element2 = new UIElement() { Width = new StyleDimension(-20f, 0.5f), Height = new StyleDimension(0.0f, 1f), Left = new StyleDimension(10f, 0.0f) }; element2.SetPadding(0.0f); element1.Append(element2); UIElement element3 = new UIElement() { Width = new StyleDimension(-20f, 0.5f), Height = new StyleDimension(0.0f, 1f), Left = new StyleDimension(-10f, 0.0f), HAlign = 1f }; element3.SetPadding(0.0f); element1.Append(element3); UIList uiList1 = new UIList(); uiList1.Width = new StyleDimension(-25f, 1f); uiList1.Height = new StyleDimension(0.0f, 1f); uiList1.ListPadding = 5f; uiList1.HAlign = 1f; UIList uiList2 = uiList1; element2.Append((UIElement)uiList2); this._availablePacksList = uiList2; UIList uiList3 = new UIList(); uiList3.Width = new StyleDimension(-25f, 1f); uiList3.Height = new StyleDimension(0.0f, 1f); uiList3.ListPadding = 5f; uiList3.HAlign = 0.0f; uiList3.Left = new StyleDimension(0.0f, 0.0f); UIList uiList4 = uiList3; element3.Append((UIElement)uiList4); this._enabledPacksList = uiList4; UIText uiText1 = new UIText(Language.GetText("UI.AvailableResourcePacksTitle"), 1f, false); uiText1.HAlign = 0.0f; uiText1.Left = new StyleDimension(25f, 0.0f); uiText1.Width = new StyleDimension(-25f, 0.5f); uiText1.VAlign = 0.0f; uiText1.Top = new StyleDimension(10f, 0.0f); UIText uiText2 = uiText1; this._titleAvailable = uiText2; uiPanel2.Append((UIElement)uiText2); UIText uiText3 = new UIText(Language.GetText("UI.EnabledResourcePacksTitle"), 1f, false); uiText3.HAlign = 1f; uiText3.Left = new StyleDimension(-25f, 0.0f); uiText3.Width = new StyleDimension(-25f, 0.5f); uiText3.VAlign = 0.0f; uiText3.Top = new StyleDimension(10f, 0.0f); UIText uiText4 = uiText3; this._titleEnabled = uiText4; uiPanel2.Append((UIElement)uiText4); UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.ResourcePacks"), 1f, true); uiTextPanel1.HAlign = 0.5f; uiTextPanel1.VAlign = 0.0f; uiTextPanel1.Top = new StyleDimension(-44f, 0.0f); uiTextPanel1.BackgroundColor = new Color(73, 94, 171); UITextPanel <LocalizedText> uiTextPanel2 = uiTextPanel1; uiTextPanel2.SetPadding(13f); uiElement.Append((UIElement)uiTextPanel2); UIScrollbar uiScrollbar1 = new UIScrollbar(); uiScrollbar1.Height = new StyleDimension(0.0f, 1f); uiScrollbar1.HAlign = 0.0f; uiScrollbar1.Left = new StyleDimension(0.0f, 0.0f); UIScrollbar scrollbar1 = uiScrollbar1; element2.Append((UIElement)scrollbar1); this._availablePacksList.SetScrollbar(scrollbar1); UIVerticalSeparator verticalSeparator1 = new UIVerticalSeparator(); verticalSeparator1.Height = new StyleDimension(-12f, 1f); verticalSeparator1.HAlign = 0.5f; verticalSeparator1.VAlign = 1f; verticalSeparator1.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f; UIVerticalSeparator verticalSeparator2 = verticalSeparator1; uiPanel2.Append((UIElement)verticalSeparator2); UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true); horizontalSeparator1.Width = new StyleDimension((float)-num2, 0.5f); horizontalSeparator1.VAlign = 0.0f; horizontalSeparator1.HAlign = 0.0f; horizontalSeparator1.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f; horizontalSeparator1.Top = new StyleDimension((float)num3, 0.0f); horizontalSeparator1.Left = new StyleDimension((float)num1, 0.0f); UIHorizontalSeparator horizontalSeparator2 = new UIHorizontalSeparator(2, true); horizontalSeparator2.Width = new StyleDimension((float)-num2, 0.5f); horizontalSeparator2.VAlign = 0.0f; horizontalSeparator2.HAlign = 1f; horizontalSeparator2.Color = new Color(89, 116, 213, (int)byte.MaxValue) * 0.9f; horizontalSeparator2.Top = new StyleDimension((float)num3, 0.0f); horizontalSeparator2.Left = new StyleDimension((float)-num1, 0.0f); UIScrollbar uiScrollbar2 = new UIScrollbar(); uiScrollbar2.Height = new StyleDimension(0.0f, 1f); uiScrollbar2.HAlign = 1f; UIScrollbar scrollbar2 = uiScrollbar2; element3.Append((UIElement)scrollbar2); this._enabledPacksList.SetScrollbar(scrollbar2); this.AddBackAndFolderButtons(uiElement); }
public UIElement ProvideUIElement(BestiaryUICollectionInfo info) { if (info.UnlockState == BestiaryEntryUnlockState.NotKnownAtAll_0) { return((UIElement)null); } if (this.GameMode != Main.GameMode) { return((UIElement)null); } UIElement uiElement = new UIElement() { Width = new StyleDimension(0.0f, 1f), Height = new StyleDimension(109f, 0.0f) }; int num1 = 99; int num2 = 35; int num3 = 3; int num4 = 0; UIImage uiImage1 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_HP", (AssetRequestMode)1)); uiImage1.Top = new StyleDimension((float)num4, 0.0f); uiImage1.Left = new StyleDimension((float)num3, 0.0f); UIImage uiImage2 = uiImage1; UIImage uiImage3 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Attack", (AssetRequestMode)1)); uiImage3.Top = new StyleDimension((float)(num4 + num2), 0.0f); uiImage3.Left = new StyleDimension((float)num3, 0.0f); UIImage uiImage4 = uiImage3; UIImage uiImage5 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Defense", (AssetRequestMode)1)); uiImage5.Top = new StyleDimension((float)(num4 + num2), 0.0f); uiImage5.Left = new StyleDimension((float)(num3 + num1), 0.0f); UIImage uiImage6 = uiImage5; UIImage uiImage7 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Knockback", (AssetRequestMode)1)); uiImage7.Top = new StyleDimension((float)num4, 0.0f); uiImage7.Left = new StyleDimension((float)(num3 + num1), 0.0f); UIImage uiImage8 = uiImage7; uiElement.Append((UIElement)uiImage2); uiElement.Append((UIElement)uiImage4); uiElement.Append((UIElement)uiImage6); uiElement.Append((UIElement)uiImage8); int num5 = -10; int num6 = 0; int monetaryValue = (int)this.MonetaryValue; string text1 = Utils.Clamp <int>(monetaryValue / 1000000, 0, 999).ToString(); string text2 = Utils.Clamp <int>(monetaryValue % 1000000 / 10000, 0, 99).ToString(); string text3 = Utils.Clamp <int>(monetaryValue % 10000 / 100, 0, 99).ToString(); string text4 = Utils.Clamp <int>(monetaryValue % 100 / 1, 0, 99).ToString(); if (monetaryValue / 1000000 < 1) { text1 = "-"; } if (monetaryValue / 10000 < 1) { text2 = "-"; } if (monetaryValue / 100 < 1) { text3 = "-"; } if (monetaryValue < 1) { text4 = "-"; } string text5 = this.LifeMax.ToString(); string text6 = this.Damage.ToString(); string text7 = this.Defense.ToString(); string text8 = (double)this.KnockbackResist <= 0.800000011920929 ? ((double)this.KnockbackResist <= 0.400000005960464 ? ((double)this.KnockbackResist <= 0.0 ? Language.GetText("BestiaryInfo.KnockbackNone").Value : Language.GetText("BestiaryInfo.KnockbackLow").Value) : Language.GetText("BestiaryInfo.KnockbackMedium").Value) : Language.GetText("BestiaryInfo.KnockbackHigh").Value; if (info.UnlockState < BestiaryEntryUnlockState.CanShowStats_2) { string str1; text4 = str1 = "?"; text3 = str1; text2 = str1; text1 = str1; string str2; text8 = str2 = "???"; text7 = str2; text6 = str2; text5 = str2; } UIText uiText1 = new UIText(text5, 1f, false); uiText1.HAlign = 1f; uiText1.VAlign = 0.5f; uiText1.Left = new StyleDimension((float)num5, 0.0f); uiText1.Top = new StyleDimension((float)num6, 0.0f); uiText1.IgnoresMouseInteraction = true; UIText uiText2 = uiText1; UIText uiText3 = new UIText(text8, 1f, false); uiText3.HAlign = 1f; uiText3.VAlign = 0.5f; uiText3.Left = new StyleDimension((float)num5, 0.0f); uiText3.Top = new StyleDimension((float)num6, 0.0f); uiText3.IgnoresMouseInteraction = true; UIText uiText4 = uiText3; UIText uiText5 = new UIText(text6, 1f, false); uiText5.HAlign = 1f; uiText5.VAlign = 0.5f; uiText5.Left = new StyleDimension((float)num5, 0.0f); uiText5.Top = new StyleDimension((float)num6, 0.0f); uiText5.IgnoresMouseInteraction = true; UIText uiText6 = uiText5; UIText uiText7 = new UIText(text7, 1f, false); uiText7.HAlign = 1f; uiText7.VAlign = 0.5f; uiText7.Left = new StyleDimension((float)num5, 0.0f); uiText7.Top = new StyleDimension((float)num6, 0.0f); uiText7.IgnoresMouseInteraction = true; UIText uiText8 = uiText7; uiImage2.Append((UIElement)uiText2); uiImage4.Append((UIElement)uiText6); uiImage6.Append((UIElement)uiText8); uiImage8.Append((UIElement)uiText4); if (monetaryValue > 0) { 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; horizontalSeparator1.Left = new StyleDimension(0.0f, 0.0f); horizontalSeparator1.Top = new StyleDimension((float)(num6 + num2 * 2), 0.0f); UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1; uiElement.Append((UIElement)horizontalSeparator2); int num7 = num3; int num8 = num6 + num2 * 2 + 8; int num9 = 49; UIImage uiImage9 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Platinum", (AssetRequestMode)1)); uiImage9.Top = new StyleDimension((float)num8, 0.0f); uiImage9.Left = new StyleDimension((float)num7, 0.0f); UIImage uiImage10 = uiImage9; UIImage uiImage11 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Gold", (AssetRequestMode)1)); uiImage11.Top = new StyleDimension((float)num8, 0.0f); uiImage11.Left = new StyleDimension((float)(num7 + num9), 0.0f); UIImage uiImage12 = uiImage11; UIImage uiImage13 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Silver", (AssetRequestMode)1)); uiImage13.Top = new StyleDimension((float)num8, 0.0f); uiImage13.Left = new StyleDimension((float)(num7 + num9 * 2 + 1), 0.0f); UIImage uiImage14 = uiImage13; UIImage uiImage15 = new UIImage((Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Copper", (AssetRequestMode)1)); uiImage15.Top = new StyleDimension((float)num8, 0.0f); uiImage15.Left = new StyleDimension((float)(num7 + num9 * 3 + 1), 0.0f); UIImage uiImage16 = uiImage15; if (text1 != "-") { uiElement.Append((UIElement)uiImage10); } if (text2 != "-") { uiElement.Append((UIElement)uiImage12); } if (text3 != "-") { uiElement.Append((UIElement)uiImage14); } if (text4 != "-") { uiElement.Append((UIElement)uiImage16); } int num10 = num5 + 3; float textScale = 0.85f; UIText uiText9 = new UIText(text1, textScale, false); uiText9.HAlign = 1f; uiText9.VAlign = 0.5f; uiText9.Left = new StyleDimension((float)num10, 0.0f); uiText9.Top = new StyleDimension((float)num6, 0.0f); UIText uiText10 = uiText9; UIText uiText11 = new UIText(text2, textScale, false); uiText11.HAlign = 1f; uiText11.VAlign = 0.5f; uiText11.Left = new StyleDimension((float)num10, 0.0f); uiText11.Top = new StyleDimension((float)num6, 0.0f); UIText uiText12 = uiText11; UIText uiText13 = new UIText(text3, textScale, false); uiText13.HAlign = 1f; uiText13.VAlign = 0.5f; uiText13.Left = new StyleDimension((float)num10, 0.0f); uiText13.Top = new StyleDimension((float)num6, 0.0f); UIText uiText14 = uiText13; UIText uiText15 = new UIText(text4, textScale, false); uiText15.HAlign = 1f; uiText15.VAlign = 0.5f; uiText15.Left = new StyleDimension((float)num10, 0.0f); uiText15.Top = new StyleDimension((float)num6, 0.0f); UIText uiText16 = uiText15; uiImage10.Append((UIElement)uiText10); uiImage12.Append((UIElement)uiText12); uiImage14.Append((UIElement)uiText14); uiImage16.Append((UIElement)uiText16); } else { uiElement.Height.Pixels = (float)(num6 + num2 * 2 - 4); } uiImage4.OnUpdate += new UIElement.ElementEvent(this.ShowStats_Attack); uiImage6.OnUpdate += new UIElement.ElementEvent(this.ShowStats_Defense); uiImage2.OnUpdate += new UIElement.ElementEvent(this.ShowStats_Life); uiImage8.OnUpdate += new UIElement.ElementEvent(this.ShowStats_Knockback); return(uiElement); }
public UIElement ProvideUIElement(BestiaryUICollectionInfo info) { if (info.UnlockState == BestiaryEntryUnlockState.NotKnownAtAll_0) { return(null); } int gameMode = Main.GameMode; if (GameMode != gameMode) { return(null); } UIElement uIElement = new UIElement { Width = new StyleDimension(0f, 1f), Height = new StyleDimension(109f, 0f) }; int num = 99; int num2 = 35; int num3 = 3; int num4 = 0; UIImage uIImage = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_HP", (AssetRequestMode)1)) { Top = new StyleDimension(num4, 0f), Left = new StyleDimension(num3, 0f) }; UIImage uIImage2 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Attack", (AssetRequestMode)1)) { Top = new StyleDimension(num4 + num2, 0f), Left = new StyleDimension(num3, 0f) }; UIImage uIImage3 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Defense", (AssetRequestMode)1)) { Top = new StyleDimension(num4 + num2, 0f), Left = new StyleDimension(num3 + num, 0f) }; UIImage uIImage4 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Knockback", (AssetRequestMode)1)) { Top = new StyleDimension(num4, 0f), Left = new StyleDimension(num3 + num, 0f) }; uIElement.Append(uIImage); uIElement.Append(uIImage2); uIElement.Append(uIImage3); uIElement.Append(uIImage4); int num5 = -10; int num6 = 0; int num7 = (int)MonetaryValue; string text = Utils.Clamp(num7 / 1000000, 0, 999).ToString(); string text2 = Utils.Clamp(num7 % 1000000 / 10000, 0, 99).ToString(); string text3 = Utils.Clamp(num7 % 10000 / 100, 0, 99).ToString(); string text4 = Utils.Clamp(num7 % 100 / 1, 0, 99).ToString(); if (num7 / 1000000 < 1) { text = "-"; } if (num7 / 10000 < 1) { text2 = "-"; } if (num7 / 100 < 1) { text3 = "-"; } if (num7 < 1) { text4 = "-"; } string text5 = LifeMax.ToString(); string text6 = Damage.ToString(); string text7 = Defense.ToString(); string text8 = (KnockbackResist > 0.8f) ? Language.GetText("BestiaryInfo.KnockbackHigh").Value : ((KnockbackResist > 0.4f) ? Language.GetText("BestiaryInfo.KnockbackMedium").Value : ((!(KnockbackResist > 0f)) ? Language.GetText("BestiaryInfo.KnockbackNone").Value : Language.GetText("BestiaryInfo.KnockbackLow").Value)); if (info.UnlockState < BestiaryEntryUnlockState.CanShowStats_2) { text = (text2 = (text3 = (text4 = "?"))); text5 = (text6 = (text7 = (text8 = "???"))); } UIText element = new UIText(text5) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num5, 0f), Top = new StyleDimension(num6, 0f), IgnoresMouseInteraction = true }; UIText element2 = new UIText(text8) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num5, 0f), Top = new StyleDimension(num6, 0f), IgnoresMouseInteraction = true }; UIText element3 = new UIText(text6) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num5, 0f), Top = new StyleDimension(num6, 0f), IgnoresMouseInteraction = true }; UIText element4 = new UIText(text7) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num5, 0f), Top = new StyleDimension(num6, 0f), IgnoresMouseInteraction = true }; uIImage.Append(element); uIImage2.Append(element3); uIImage3.Append(element4); uIImage4.Append(element2); if (num7 > 0) { UIHorizontalSeparator element5 = new UIHorizontalSeparator { Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Color = new Color(89, 116, 213, 255) * 0.9f, Left = new StyleDimension(0f, 0f), Top = new StyleDimension(num6 + num2 * 2, 0f) }; uIElement.Append(element5); int num8 = num3; int num9 = num6 + num2 * 2 + 8; int num10 = 49; UIImage uIImage5 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Platinum", (AssetRequestMode)1)) { Top = new StyleDimension(num9, 0f), Left = new StyleDimension(num8, 0f) }; UIImage uIImage6 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Gold", (AssetRequestMode)1)) { Top = new StyleDimension(num9, 0f), Left = new StyleDimension(num8 + num10, 0f) }; UIImage uIImage7 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Silver", (AssetRequestMode)1)) { Top = new StyleDimension(num9, 0f), Left = new StyleDimension(num8 + num10 * 2 + 1, 0f) }; UIImage uIImage8 = new UIImage(Main.Assets.Request <Texture2D>("Images/UI/Bestiary/Stat_Copper", (AssetRequestMode)1)) { Top = new StyleDimension(num9, 0f), Left = new StyleDimension(num8 + num10 * 3 + 1, 0f) }; if (text != "-") { uIElement.Append(uIImage5); } if (text2 != "-") { uIElement.Append(uIImage6); } if (text3 != "-") { uIElement.Append(uIImage7); } if (text4 != "-") { uIElement.Append(uIImage8); } int num11 = num5 + 3; float textScale = 0.85f; UIText element6 = new UIText(text, textScale) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num11, 0f), Top = new StyleDimension(num6, 0f) }; UIText element7 = new UIText(text2, textScale) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num11, 0f), Top = new StyleDimension(num6, 0f) }; UIText element8 = new UIText(text3, textScale) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num11, 0f), Top = new StyleDimension(num6, 0f) }; UIText element9 = new UIText(text4, textScale) { HAlign = 1f, VAlign = 0.5f, Left = new StyleDimension(num11, 0f), Top = new StyleDimension(num6, 0f) }; uIImage5.Append(element6); uIImage6.Append(element7); uIImage7.Append(element8); uIImage8.Append(element9); } else { uIElement.Height.Pixels = num6 + num2 * 2 - 4; } uIImage2.OnUpdate += ShowStats_Attack; uIImage3.OnUpdate += ShowStats_Defense; uIImage.OnUpdate += ShowStats_Life; uIImage4.OnUpdate += ShowStats_Knockback; return(uIElement); }