public void InitializePage() { this.RemoveAllChildren(); UIElement element = new UIElement(); element.Width.Set(590f, 0.0f); element.Top.Set(220f, 0.0f); element.Height.Set(-220f, 1f); element.HAlign = 0.5f; this._outerContainer = element; this.Append(element); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uiPanel.PaddingTop = 0.0f; element.Append((UIElement)uiPanel); this._container = (UIElement)uiPanel; UIList uiList = new UIList(); uiList.Width.Set(-25f, 1f); uiList.Height.Set(-50f, 1f); uiList.Top.Set(50f, 0.0f); uiList.HAlign = 0.5f; uiList.ListPadding = 14f; uiPanel.Append((UIElement)uiList); this._list = uiList; UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(-20f, 1f); scrollbar.HAlign = 1f; scrollbar.VAlign = 1f; scrollbar.Top = StyleDimension.FromPixels(-5f); uiList.SetScrollbar(scrollbar); this._scrollBar = scrollbar; UITextPanel <LocalizedText> uiTextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel.Width.Set(-10f, 0.5f); uiTextPanel.Height.Set(50f, 0.0f); uiTextPanel.VAlign = 1f; uiTextPanel.HAlign = 0.5f; uiTextPanel.Top.Set(-45f, 0.0f); uiTextPanel.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel.OnClick += new UIElement.MouseEvent(this.GoBackClick); uiTextPanel.SetSnapPoint("Back", 0, new Vector2?(), new Vector2?()); element.Append((UIElement)uiTextPanel); this._backPanel = (UIElement)uiTextPanel; int currentGroupIndex = 0; this.TryAddingList(Language.GetText("UI.EmoteCategoryGeneral"), ref currentGroupIndex, 10, this.GetEmotesGeneral()); this.TryAddingList(Language.GetText("UI.EmoteCategoryRPS"), ref currentGroupIndex, 10, this.GetEmotesRPS()); this.TryAddingList(Language.GetText("UI.EmoteCategoryItems"), ref currentGroupIndex, 11, this.GetEmotesItems()); this.TryAddingList(Language.GetText("UI.EmoteCategoryBiomesAndEvents"), ref currentGroupIndex, 8, this.GetEmotesBiomesAndEvents()); this.TryAddingList(Language.GetText("UI.EmoteCategoryTownNPCs"), ref currentGroupIndex, 9, this.GetEmotesTownNPCs()); this.TryAddingList(Language.GetText("UI.EmoteCategoryCritters"), ref currentGroupIndex, 7, this.GetEmotesCritters()); this.TryAddingList(Language.GetText("UI.EmoteCategoryBosses"), ref currentGroupIndex, 8, this.GetEmotesBosses()); }
public UICharacterNameButton(LocalizedText titleText, LocalizedText emptyContentText, LocalizedText description = null) { Width = StyleDimension.FromPixels(400f); Height = StyleDimension.FromPixels(40f); Description = description; _BasePanelTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1); _selectedBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); _hoveredBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); _textToShowWhenEmpty = emptyContentText; float textScale = 1f; UIText uIText = new UIText(titleText, textScale) { HAlign = 0f, VAlign = 0.5f, Left = StyleDimension.FromPixels(10f) }; Append(uIText); _title = uIText; UIText uIText2 = new UIText(Language.GetText("UI.PlayerNameSlot"), textScale) { HAlign = 0f, VAlign = 0.5f, Left = StyleDimension.FromPixels(150f) }; Append(uIText2); _text = uIText2; SetContents(null); }
public UIHairStyleButton(Player player, int hairStyleId) : base(Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1)) { _player = player; HairStyleId = hairStyleId; Width = StyleDimension.FromPixels(44f); Height = StyleDimension.FromPixels(44f); _selectedBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); _hoveredBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); }
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 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); }
public void SetContents(string name) { this.actualContents = name; if (string.IsNullOrEmpty(this.actualContents)) { this._text.TextColor = Color.Gray; this._text.SetText(this._textToShowWhenEmpty); } else { this._text.TextColor = Color.White; this._text.SetText(this.actualContents); } this._text.Left = StyleDimension.FromPixels(this._title.GetInnerDimensions().Width + this.DistanceFromTitleToOption); }
public UIResourcePack(ResourcePack pack, int order) { ResourcePack = pack; Order = order; BackgroundColor = DefaultBackgroundColor; BorderColor = DefaultBorderColor; Height = StyleDimension.FromPixels(102f); MinHeight = Height; MaxHeight = Height; MinWidth = StyleDimension.FromPixels(102f); Width = StyleDimension.FromPercent(1f); SetPadding(5f); _iconBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/Achievement_Borders", Main.content, (AssetRequestMode)1); OverflowHidden = true; BuildChildren(); }
public UIClothStyleButton(Player player, int clothStyleId) { _player = player; ClothStyleId = clothStyleId; Width = StyleDimension.FromPixels(44f); Height = StyleDimension.FromPixels(80f); _BasePanelTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1); _selectedBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); _hoveredBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); _char = new UICharacter(_player, animated: false, hasBackPanel: false) { HAlign = 0.5f, VAlign = 0.5f }; Append(_char); }
public UIResourcePack(ResourcePack pack, int order) { this.ResourcePack = pack; this.Order = order; this.BackgroundColor = UIResourcePack.DefaultBackgroundColor; this.BorderColor = UIResourcePack.DefaultBorderColor; this.Height = StyleDimension.FromPixels(102f); this.MinHeight = this.Height; this.MaxHeight = this.Height; this.MinWidth = StyleDimension.FromPixels(102f); this.Width = StyleDimension.FromPercent(1f); this.SetPadding(5f); this._iconBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Achievement_Borders", (AssetRequestMode)1); this.OverflowHidden = true; this.BuildChildren(); }
public UIClothStyleButton(Player player, int clothStyleId) { this._player = player; this.ClothStyleId = clothStyleId; this.Width = StyleDimension.FromPixels(44f); this.Height = StyleDimension.FromPixels(80f); this._BasePanelTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanel", (AssetRequestMode)1); this._selectedBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); this._hoveredBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); UICharacter uiCharacter = new UICharacter(this._player, false, false, 1f); uiCharacter.HAlign = 0.5f; uiCharacter.VAlign = 0.5f; this._char = uiCharacter; this.Append((UIElement)this._char); }
private void MakeExitButton(UIElement outerContainer) { UITextPanel <LocalizedText> uiTextPanel1 = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel1.Width = StyleDimension.FromPixelsAndPercent(-10f, 0.5f); uiTextPanel1.Height = StyleDimension.FromPixels(50f); uiTextPanel1.VAlign = 1f; uiTextPanel1.HAlign = 0.5f; uiTextPanel1.Top = StyleDimension.FromPixels(-25f); UITextPanel <LocalizedText> uiTextPanel2 = uiTextPanel1; uiTextPanel2.OnMouseOver += new UIElement.MouseEvent(this.FadedMouseOver); uiTextPanel2.OnMouseOut += new UIElement.MouseEvent(this.FadedMouseOut); uiTextPanel2.OnMouseDown += new UIElement.MouseEvent(this.Click_GoBack); uiTextPanel2.SetSnapPoint("ExitButton", 0, new Vector2?(), new Vector2?()); outerContainer.Append((UIElement)uiTextPanel2); }
private void MakeExitButton(UIElement outerContainer) { UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, large: true) { Width = StyleDimension.FromPixelsAndPercent(-10f, 0.5f), Height = StyleDimension.FromPixels(50f), VAlign = 1f, HAlign = 0.5f, Top = StyleDimension.FromPixels(-25f) }; uITextPanel.OnMouseOver += FadedMouseOver; uITextPanel.OnMouseOut += FadedMouseOut; uITextPanel.OnMouseDown += Click_GoBack; uITextPanel.SetSnapPoint("ExitButton", 0); outerContainer.Append(uITextPanel); }
public void SetText(LocalizedText text, float textSize, Color color) { if (_title != null) { _title.Remove(); } UIText uIText = new UIText(text, textSize) { HAlign = 0.5f, VAlign = 0.5f, Width = StyleDimension.FromPixelsAndPercent(-10f, 1f), Top = StyleDimension.FromPixels(0f) }; uIText.TextColor = color; Append(uIText); _title = uIText; }
public void SetText(LocalizedText text, float textSize, Color color) { if (this._title != null) { this._title.Remove(); } UIText uiText1 = new UIText(text, textSize, false); uiText1.HAlign = 0.5f; uiText1.VAlign = 0.5f; uiText1.Width = StyleDimension.FromPixelsAndPercent(-10f, 1f); uiText1.Top = StyleDimension.FromPixels(0.0f); UIText uiText2 = uiText1; uiText2.TextColor = color; this.Append((UIElement)uiText2); this._title = uiText2; }
private void BuildChildren() { StyleDimension styleDimension1 = StyleDimension.FromPixels(77f); StyleDimension styleDimension2 = StyleDimension.FromPixels(4f); UIText uiText1 = new UIText(this.ResourcePack.Name, 1f, false); uiText1.Left = styleDimension1; uiText1.Top = styleDimension2; UIText uiText2 = uiText1; this.Append((UIElement)uiText2); styleDimension2.Pixels += uiText2.GetOuterDimensions().Height + 6f; UIText uiText3 = new UIText(Language.GetTextValue("UI.Author", (object)this.ResourcePack.Author), 0.7f, false); uiText3.Left = styleDimension1; uiText3.Top = styleDimension2; UIText uiText4 = uiText3; this.Append((UIElement)uiText4); styleDimension2.Pixels += uiText4.GetOuterDimensions().Height + 10f; Asset <Texture2D> asset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Divider", (AssetRequestMode)1); UIImage uiImage1 = new UIImage(asset); uiImage1.Left = StyleDimension.FromPixels(72f); uiImage1.Top = styleDimension2; uiImage1.Height = StyleDimension.FromPixels((float)asset.Height()); uiImage1.Width = StyleDimension.FromPixelsAndPercent(-80f, 1f); uiImage1.ScaleToFit = true; UIImage uiImage2 = uiImage1; this.Recalculate(); this.Append((UIElement)uiImage2); styleDimension2.Pixels += uiImage2.GetOuterDimensions().Height + 5f; UIElement element = new UIElement() { Left = styleDimension1, Top = styleDimension2, Height = StyleDimension.FromPixels(92f - styleDimension2.Pixels), Width = StyleDimension.FromPixelsAndPercent(-styleDimension1.Pixels, 1f) }; this.Append(element); this.ContentPanel = element; }
private void BuildChildren() { StyleDimension left = StyleDimension.FromPixels(77f); StyleDimension top = StyleDimension.FromPixels(4f); UIText uIText = new UIText(ResourcePack.Name) { Left = left, Top = top }; Append(uIText); top.Pixels += uIText.GetOuterDimensions().Height + 6f; UIText uIText2 = new UIText(Language.GetTextValue("UI.Author", ResourcePack.Author), 0.7f) { Left = left, Top = top }; Append(uIText2); top.Pixels += uIText2.GetOuterDimensions().Height + 10f; Asset <Texture2D> val = Main.Assets.Request <Texture2D>("Images/UI/Divider", Main.content, (AssetRequestMode)1); UIImage uIImage = new UIImage(val) { Left = StyleDimension.FromPixels(72f), Top = top, Height = StyleDimension.FromPixels(val.Height()), Width = StyleDimension.FromPixelsAndPercent(-80f, 1f), ScaleToFit = true }; Recalculate(); Append(uIImage); top.Pixels += uIImage.GetOuterDimensions().Height + 5f; UIElement uIElement = new UIElement { Left = left, Top = top, Height = StyleDimension.FromPixels(92f - top.Pixels), Width = StyleDimension.FromPixelsAndPercent(0f - left.Pixels, 1f) }; Append(uIElement); ContentPanel = uIElement; }
public UIDifficultyButton(Player player, LocalizedText title, LocalizedText description, byte difficulty, Color color) { _player = player; _difficulty = difficulty; Width = StyleDimension.FromPixels(44f); Height = StyleDimension.FromPixels(110f); _BasePanelTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/PanelGrayscale", Main.content, (AssetRequestMode)1); _selectedBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", Main.content, (AssetRequestMode)1); _hoveredBorderTexture = Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", Main.content, (AssetRequestMode)1); _color = color; UIText element = new UIText(title, 0.9f) { HAlign = 0.5f, VAlign = 0f, Width = StyleDimension.FromPixelsAndPercent(-10f, 1f), Top = StyleDimension.FromPixels(5f) }; Append(element); }
private void BuildPage() { int num = 18; this.RemoveAllChildren(); UIElement uiElement1 = new UIElement() { Width = StyleDimension.FromPixels(500f), Height = StyleDimension.FromPixels(434f + (float)num), Top = StyleDimension.FromPixels(170f - (float)num), HAlign = 0.5f, VAlign = 0.0f }; uiElement1.SetPadding(0.0f); this.Append(uiElement1); UIPanel uiPanel1 = new UIPanel(); uiPanel1.Width = StyleDimension.FromPercent(1f); uiPanel1.Height = StyleDimension.FromPixels((float)(280 + num)); uiPanel1.Top = StyleDimension.FromPixels(50f); uiPanel1.BackgroundColor = new Color(33, 43, 79) * 0.8f; UIPanel uiPanel2 = uiPanel1; uiPanel2.SetPadding(0.0f); uiElement1.Append((UIElement)uiPanel2); this.MakeBackAndCreatebuttons(uiElement1); UIElement uiElement2 = new UIElement() { Top = StyleDimension.FromPixelsAndPercent(0.0f, 0.0f), Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0.0f, 1f), HAlign = 1f }; uiElement2.SetPadding(0.0f); uiElement2.PaddingTop = 8f; uiElement2.PaddingBottom = 12f; uiPanel2.Append(uiElement2); this.MakeInfoMenu(uiElement2); }
private void BuildPage() { int num = 18; RemoveAllChildren(); UIElement uIElement = new UIElement { Width = StyleDimension.FromPixels(500f), Height = StyleDimension.FromPixels(434f + (float)num), Top = StyleDimension.FromPixels(170f - (float)num), HAlign = 0.5f, VAlign = 0f }; uIElement.SetPadding(0f); Append(uIElement); UIPanel uIPanel = new UIPanel { Width = StyleDimension.FromPercent(1f), Height = StyleDimension.FromPixels(280 + num), Top = StyleDimension.FromPixels(50f), BackgroundColor = new Color(33, 43, 79) * 0.8f }; uIPanel.SetPadding(0f); uIElement.Append(uIPanel); MakeBackAndCreatebuttons(uIElement); UIElement uIElement2 = new UIElement { Top = StyleDimension.FromPixelsAndPercent(0f, 0f), Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0f, 1f), HAlign = 1f }; uIElement2.SetPadding(0f); uIElement2.PaddingTop = 8f; uIElement2.PaddingBottom = 12f; uIPanel.Append(uIElement2); MakeInfoMenu(uIElement2); }
public GroupOptionButton( T option, LocalizedText title, LocalizedText description, Color textColor, string iconTexturePath, float textSize = 1f, float titleAlignmentX = 0.5f, float titleWidthReduction = 10f) { this._borderColor = Color.White; this._currentOption = option; this._myOption = option; this.Description = description; this.Width = StyleDimension.FromPixels(44f); this.Height = StyleDimension.FromPixels(34f); this._BasePanelTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/PanelGrayscale", (AssetRequestMode)1); this._selectedBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); this._hoveredBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); if (iconTexturePath != null) { this._iconTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>(iconTexturePath, (AssetRequestMode)1); } this._color = Colors.InventoryDefaultColor; if (title == null) { return; } UIText uiText1 = new UIText(title, textSize, false); uiText1.HAlign = titleAlignmentX; uiText1.VAlign = 0.5f; uiText1.Width = StyleDimension.FromPixelsAndPercent(-titleWidthReduction, 1f); uiText1.Top = StyleDimension.FromPixels(0.0f); UIText uiText2 = uiText1; uiText2.TextColor = textColor; this.Append((UIElement)uiText2); this._title = uiText2; }
public UIDifficultyButton( Player player, LocalizedText title, LocalizedText description, byte difficulty, Color color) { this._player = player; this._difficulty = difficulty; this.Width = StyleDimension.FromPixels(44f); this.Height = StyleDimension.FromPixels(110f); this._BasePanelTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/PanelGrayscale", (AssetRequestMode)1); this._selectedBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelHighlight", (AssetRequestMode)1); this._hoveredBorderTexture = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/CharCreation/CategoryPanelBorder", (AssetRequestMode)1); this._color = color; UIText uiText = new UIText(title, 0.9f, false); uiText.HAlign = 0.5f; uiText.VAlign = 0.0f; uiText.Width = StyleDimension.FromPixelsAndPercent(-10f, 1f); uiText.Top = StyleDimension.FromPixels(5f); this.Append((UIElement)uiText); }
private void BuildPage() { this.RemoveAllChildren(); UIElement element1 = new UIElement(); element1.Width.Set(0.0f, 0.8f); element1.MaxWidth.Set(500f, 0.0f); element1.MinWidth.Set(300f, 0.0f); element1.Top.Set(230f, 0.0f); element1.Height.Set(-element1.Top.Pixels, 1f); element1.HAlign = 0.5f; this.Append(element1); UIPanel uiPanel = new UIPanel(); uiPanel.Width.Set(0.0f, 1f); uiPanel.Height.Set(-110f, 1f); uiPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; element1.Append((UIElement)uiPanel); UIElement element2 = new UIElement() { Width = StyleDimension.Fill, Height = StyleDimension.FromPixelsAndPercent(0.0f, 1f) }; uiPanel.Append(element2); UIElement element3 = new UIElement() { Width = new StyleDimension(0.0f, 1f), Height = new StyleDimension(52f, 0.0f) }; element3.SetPadding(0.0f); element2.Append(element3); UIText uiText1 = new UIText(this._pack.Name, 0.7f, true) { TextColor = Color.Gold }; uiText1.HAlign = 0.5f; uiText1.VAlign = 0.0f; element3.Append((UIElement)uiText1); UIText uiText2 = new UIText(Language.GetTextValue("UI.Author", (object)this._pack.Author), 0.9f, false); uiText2.HAlign = 0.0f; uiText2.VAlign = 1f; UIText uiText3 = uiText2; uiText3.Top.Set(-6f, 0.0f); element3.Append((UIElement)uiText3); UIText uiText4 = new UIText(Language.GetTextValue("UI.Version", (object)this._pack.Version.GetFormattedVersion()), 0.9f, false); uiText4.HAlign = 1f; uiText4.VAlign = 1f; uiText4.TextColor = Color.Silver; UIText uiText5 = uiText4; uiText5.Top.Set(-6f, 0.0f); element3.Append((UIElement)uiText5); Asset <Texture2D> asset = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/Divider", (AssetRequestMode)1); UIImage uiImage1 = new UIImage(asset); uiImage1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); uiImage1.Height = StyleDimension.FromPixels((float)asset.Height()); uiImage1.ScaleToFit = true; UIImage uiImage2 = uiImage1; uiImage2.Top.Set(52f, 0.0f); uiImage2.SetPadding(6f); element2.Append((UIElement)uiImage2); UIElement element4 = new UIElement() { HAlign = 0.5f, VAlign = 1f, Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f), Height = StyleDimension.FromPixelsAndPercent(-74f, 1f) }; element2.Append(element4); this._container = element4; UIText uiText6 = new UIText(this._pack.Description, 1f, false); uiText6.HAlign = 0.5f; uiText6.VAlign = 0.0f; uiText6.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); uiText6.Height = StyleDimension.FromPixelsAndPercent(0.0f, 0.0f); uiText6.IsWrapped = true; uiText6.WrappedTextBottomPadding = 0.0f; UIText uiText7 = uiText6; UIList uiList1 = new UIList(); uiList1.HAlign = 0.5f; uiList1.VAlign = 0.0f; uiList1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); uiList1.Height = StyleDimension.FromPixelsAndPercent(0.0f, 1f); uiList1.PaddingRight = 20f; UIList uiList2 = uiList1; uiList2.ListPadding = 5f; uiList2.Add((UIElement)uiText7); element4.Append((UIElement)uiList2); this._list = uiList2; UIScrollbar scrollbar = new UIScrollbar(); scrollbar.SetView(100f, 1000f); scrollbar.Height.Set(0.0f, 1f); scrollbar.HAlign = 1f; this._scrollbar = scrollbar; uiList2.SetScrollbar(scrollbar); UITextPanel <LocalizedText> uiTextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, true); uiTextPanel.Width.Set(-10f, 0.5f); uiTextPanel.Height.Set(50f, 0.0f); uiTextPanel.VAlign = 1f; uiTextPanel.HAlign = 0.5f; uiTextPanel.Top.Set(-45f, 0.0f); uiTextPanel.OnMouseOver += new UIElement.MouseEvent(UIResourcePackInfoMenu.FadedMouseOver); uiTextPanel.OnMouseOut += new UIElement.MouseEvent(UIResourcePackInfoMenu.FadedMouseOut); uiTextPanel.OnClick += new UIElement.MouseEvent(this.GoBackClick); uiTextPanel.SetSnapPoint("GoBack", 0, new Vector2?(), new Vector2?()); element1.Append((UIElement)uiTextPanel); }
public EmotesGroupListItem( LocalizedText groupTitle, int groupIndex, int maxEmotesPerRow, params int[] emotes) { maxEmotesPerRow = 14; this.SetPadding(0.0f); this._groupIndex = groupIndex; this._maxEmotesPerRow = maxEmotesPerRow; this._tempTex = (Asset <Texture2D>)Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1); int num1 = emotes.Length / this._maxEmotesPerRow; if (emotes.Length % this._maxEmotesPerRow != 0) { ++num1; } this.Height.Set((float)(30 + 36 * num1), 0.0f); this.Width.Set(0.0f, 1f); UIElement element = new UIElement() { Height = StyleDimension.FromPixels(30f), Width = StyleDimension.FromPixelsAndPercent(-20f, 1f), HAlign = 0.5f }; element.SetPadding(0.0f); this.Append(element); UIHorizontalSeparator horizontalSeparator1 = new UIHorizontalSeparator(2, true); horizontalSeparator1.Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f); horizontalSeparator1.VAlign = 1f; horizontalSeparator1.HAlign = 0.5f; horizontalSeparator1.Color = Color.Lerp(Color.White, new Color(63, 65, 151, (int)byte.MaxValue), 0.85f) * 0.9f; UIHorizontalSeparator horizontalSeparator2 = horizontalSeparator1; element.Append((UIElement)horizontalSeparator2); UIText uiText1 = new UIText(groupTitle, 1f, false); uiText1.VAlign = 1f; uiText1.HAlign = 0.5f; uiText1.Top = StyleDimension.FromPixels(-6f); UIText uiText2 = uiText1; element.Append((UIElement)uiText2); float num2 = 6f; for (int id = 0; id < emotes.Length; ++id) { int emote = emotes[id]; int num3 = id / this._maxEmotesPerRow; int num4 = id % this._maxEmotesPerRow; int num5 = emotes.Length % this._maxEmotesPerRow; if (emotes.Length / this._maxEmotesPerRow != num3) { num5 = this._maxEmotesPerRow; } if (num5 == 0) { num5 = this._maxEmotesPerRow; } float num6 = (float)(36.0 * ((double)num5 / 2.0)) - 16f; float num7 = -16f; EmoteButton emoteButton1 = new EmoteButton(emote); emoteButton1.HAlign = 0.0f; emoteButton1.VAlign = 0.0f; emoteButton1.Top = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2); emoteButton1.Left = StyleDimension.FromPixels((float)(36 * num4) - num7); EmoteButton emoteButton2 = emoteButton1; this.Append((UIElement)emoteButton2); emoteButton2.SetSnapPoint("Group " + (object)groupIndex, id, new Vector2?(), new Vector2?()); } }
private void MakeInfoMenu(UIElement parentContainer) { UIElement uIElement = new UIElement { Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0f, 1f), HAlign = 0.5f, VAlign = 0f }; uIElement.SetPadding(10f); uIElement.PaddingBottom = 0f; uIElement.PaddingTop = 0f; parentContainer.Append(uIElement); float num = 0f; float num2 = 44f; float num3 = 88f + num2; float pixels = num2; GroupOptionButton <bool> groupOptionButton = new GroupOptionButton <bool>(option: true, null, Language.GetText("UI.WorldCreationRandomizeNameDescription"), Color.White, "Images/UI/WorldCreation/IconRandomName") { Width = StyleDimension.FromPixelsAndPercent(40f, 0f), Height = new StyleDimension(40f, 0f), HAlign = 0f, Top = StyleDimension.FromPixelsAndPercent(num, 0f), ShowHighlightWhenSelected = false }; groupOptionButton.OnMouseDown += ClickRandomizeName; groupOptionButton.OnMouseOver += ShowOptionDescription; groupOptionButton.OnMouseOut += ClearOptionDescription; groupOptionButton.SetSnapPoint("RandomizeName", 0); uIElement.Append(groupOptionButton); UICharacterNameButton uICharacterNameButton = new UICharacterNameButton(Language.GetText("UI.WorldCreationName"), Language.GetText("UI.WorldCreationNameEmpty"), Language.GetText("UI.WorldDescriptionName")) { Width = StyleDimension.FromPixelsAndPercent(0f - num3, 1f), HAlign = 0f, Left = new StyleDimension(pixels, 0f), Top = StyleDimension.FromPixelsAndPercent(num, 0f) }; uICharacterNameButton.OnMouseDown += Click_SetName; uICharacterNameButton.OnMouseOver += ShowOptionDescription; uICharacterNameButton.OnMouseOut += ClearOptionDescription; uICharacterNameButton.SetSnapPoint("Name", 0); uIElement.Append(uICharacterNameButton); _namePlate = uICharacterNameButton; num += uICharacterNameButton.GetDimensions().Height + 4f; GroupOptionButton <bool> groupOptionButton2 = new GroupOptionButton <bool>(option: true, null, Language.GetText("UI.WorldCreationRandomizeSeedDescription"), Color.White, "Images/UI/WorldCreation/IconRandomSeed") { Width = StyleDimension.FromPixelsAndPercent(40f, 0f), Height = new StyleDimension(40f, 0f), HAlign = 0f, Top = StyleDimension.FromPixelsAndPercent(num, 0f), ShowHighlightWhenSelected = false }; groupOptionButton2.OnMouseDown += ClickRandomizeSeed; groupOptionButton2.OnMouseOver += ShowOptionDescription; groupOptionButton2.OnMouseOut += ClearOptionDescription; groupOptionButton2.SetSnapPoint("RandomizeSeed", 0); uIElement.Append(groupOptionButton2); UICharacterNameButton uICharacterNameButton2 = new UICharacterNameButton(Language.GetText("UI.WorldCreationSeed"), Language.GetText("UI.WorldCreationSeedEmpty"), Language.GetText("UI.WorldDescriptionSeed")) { Width = StyleDimension.FromPixelsAndPercent(0f - num3, 1f), HAlign = 0f, Left = new StyleDimension(pixels, 0f), Top = StyleDimension.FromPixelsAndPercent(num, 0f), DistanceFromTitleToOption = 29f }; uICharacterNameButton2.OnMouseDown += Click_SetSeed; uICharacterNameButton2.OnMouseOver += ShowOptionDescription; uICharacterNameButton2.OnMouseOut += ClearOptionDescription; uICharacterNameButton2.SetSnapPoint("Seed", 0); uIElement.Append(uICharacterNameButton2); _seedPlate = uICharacterNameButton2; UIWorldCreationPreview uIWorldCreationPreview = new UIWorldCreationPreview { Width = StyleDimension.FromPixels(84f), Height = StyleDimension.FromPixels(84f), HAlign = 1f, VAlign = 0f }; uIElement.Append(uIWorldCreationPreview); _previewPlate = uIWorldCreationPreview; num += uICharacterNameButton2.GetDimensions().Height + 10f; AddHorizontalSeparator(uIElement, num + 2f); float usableWidthPercent = 1f; AddWorldSizeOptions(uIElement, num, ClickSizeOption, "size", usableWidthPercent); num += 48f; AddHorizontalSeparator(uIElement, num); AddWorldDifficultyOptions(uIElement, num, ClickDifficultyOption, "difficulty", usableWidthPercent); num += 48f; AddHorizontalSeparator(uIElement, num); AddWorldEvilOptions(uIElement, num, ClickEvilOption, "evil", usableWidthPercent); num += 48f; AddHorizontalSeparator(uIElement, num); AddDescriptionPanel(uIElement, num, "desc"); SetDefaultOptions(); }
public EmotesGroupListItem(LocalizedText groupTitle, int groupIndex, int maxEmotesPerRow, params int[] emotes) { maxEmotesPerRow = 14; SetPadding(0f); _groupIndex = groupIndex; _maxEmotesPerRow = maxEmotesPerRow; _tempTex = Main.Assets.Request <Texture2D>("Images/UI/ButtonFavoriteInactive", (AssetRequestMode)1); int num = emotes.Length / _maxEmotesPerRow; if (emotes.Length % _maxEmotesPerRow != 0) { num++; } Height.Set(30 + 36 * num, 0f); Width.Set(0f, 1f); UIElement uIElement = new UIElement { Height = StyleDimension.FromPixels(30f), Width = StyleDimension.FromPixelsAndPercent(-20f, 1f), HAlign = 0.5f }; uIElement.SetPadding(0f); Append(uIElement); UIHorizontalSeparator element = new UIHorizontalSeparator { Width = StyleDimension.FromPixelsAndPercent(0f, 1f), VAlign = 1f, HAlign = 0.5f, Color = Color.Lerp(Color.White, new Color(63, 65, 151, 255), 0.85f) * 0.9f }; uIElement.Append(element); UIText element2 = new UIText(groupTitle) { VAlign = 1f, HAlign = 0.5f, Top = StyleDimension.FromPixels(-6f) }; uIElement.Append(element2); float num2 = 6f; for (int i = 0; i < emotes.Length; i++) { int emoteIndex = emotes[i]; int num3 = i / _maxEmotesPerRow; int num4 = i % _maxEmotesPerRow; int num5 = emotes.Length % _maxEmotesPerRow; if (emotes.Length / _maxEmotesPerRow != num3) { num5 = _maxEmotesPerRow; } if (num5 == 0) { num5 = _maxEmotesPerRow; } float num6 = 36f * ((float)num5 / 2f); num6 -= 16f; num6 = -16f; EmoteButton emoteButton = new EmoteButton(emoteIndex) { HAlign = 0f, VAlign = 0f, Top = StyleDimension.FromPixels((float)(30 + num3 * 36) + num2), Left = StyleDimension.FromPixels((float)(36 * num4) - num6) }; Append(emoteButton); emoteButton.SetSnapPoint("Group " + groupIndex, i); } }
private void BuildPage() { RemoveAllChildren(); UIElement uIElement = new UIElement(); uIElement.Width.Set(0f, 0.8f); uIElement.MaxWidth.Set(500f, 0f); uIElement.MinWidth.Set(300f, 0f); uIElement.Top.Set(230f, 0f); uIElement.Height.Set(0f - uIElement.Top.Pixels, 1f); uIElement.HAlign = 0.5f; Append(uIElement); UIPanel uIPanel = new UIPanel(); uIPanel.Width.Set(0f, 1f); uIPanel.Height.Set(-110f, 1f); uIPanel.BackgroundColor = new Color(33, 43, 79) * 0.8f; uIElement.Append(uIPanel); UIElement uIElement2 = new UIElement { Width = StyleDimension.Fill, Height = StyleDimension.FromPixelsAndPercent(0f, 1f) }; uIPanel.Append(uIElement2); UIElement uIElement3 = new UIElement { Width = new StyleDimension(0f, 1f), Height = new StyleDimension(52f, 0f) }; uIElement3.SetPadding(0f); uIElement2.Append(uIElement3); UIText uIText = new UIText(_pack.Name, 0.7f, large: true) { TextColor = Color.Gold }; uIText.HAlign = 0.5f; uIText.VAlign = 0f; uIElement3.Append(uIText); UIText uIText2 = new UIText(Language.GetTextValue("UI.Author", _pack.Author), 0.9f) { HAlign = 0f, VAlign = 1f }; uIText2.Top.Set(-6f, 0f); uIElement3.Append(uIText2); UIText uIText3 = new UIText(Language.GetTextValue("UI.Version", _pack.Version.GetFormattedVersion()), 0.9f) { HAlign = 1f, VAlign = 1f, TextColor = Color.Silver }; uIText3.Top.Set(-6f, 0f); uIElement3.Append(uIText3); Asset <Texture2D> val = Main.Assets.Request <Texture2D>("Images/UI/Divider", Main.content, (AssetRequestMode)1); UIImage uIImage = new UIImage(val) { Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixels(val.Height()), ScaleToFit = true }; uIImage.Top.Set(52f, 0f); uIImage.SetPadding(6f); uIElement2.Append(uIImage); UIElement uIElement4 = new UIElement { HAlign = 0.5f, VAlign = 1f, Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixelsAndPercent(-74f, 1f) }; uIElement2.Append(uIElement4); _container = uIElement4; UIText item = new UIText(_pack.Description) { HAlign = 0.5f, VAlign = 0f, Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0f, 0f), IsWrapped = true, WrappedTextBottomPadding = 0f }; UIList uIList = new UIList { HAlign = 0.5f, VAlign = 0f, Width = StyleDimension.FromPixelsAndPercent(0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0f, 1f), PaddingRight = 20f }; uIList.ListPadding = 5f; uIList.Add(item); uIElement4.Append(uIList); _list = uIList; UIScrollbar uIScrollbar = new UIScrollbar(); uIScrollbar.SetView(100f, 1000f); uIScrollbar.Height.Set(0f, 1f); uIScrollbar.HAlign = 1f; _scrollbar = uIScrollbar; uIList.SetScrollbar(uIScrollbar); UITextPanel <LocalizedText> uITextPanel = new UITextPanel <LocalizedText>(Language.GetText("UI.Back"), 0.7f, large: true); uITextPanel.Width.Set(-10f, 0.5f); uITextPanel.Height.Set(50f, 0f); uITextPanel.VAlign = 1f; uITextPanel.HAlign = 0.5f; uITextPanel.Top.Set(-45f, 0f); uITextPanel.OnMouseOver += FadedMouseOver; uITextPanel.OnMouseOut += FadedMouseOut; uITextPanel.OnClick += GoBackClick; uITextPanel.SetSnapPoint("GoBack", 0); uIElement.Append(uITextPanel); }
private void MakeInfoMenu(UIElement parentContainer) { UIElement uiElement = new UIElement() { Width = StyleDimension.FromPixelsAndPercent(0.0f, 1f), Height = StyleDimension.FromPixelsAndPercent(0.0f, 1f), HAlign = 0.5f, VAlign = 0.0f }; uiElement.SetPadding(10f); uiElement.PaddingBottom = 0.0f; uiElement.PaddingTop = 0.0f; parentContainer.Append(uiElement); float pixels1 = 0.0f; float num1 = 44f; float num2 = (float)(88.0 + (double)num1); float pixels2 = num1; GroupOptionButton <bool> groupOptionButton1 = new GroupOptionButton <bool>(true, (LocalizedText)null, Language.GetText("UI.WorldCreationRandomizeNameDescription"), Color.White, "Images/UI/WorldCreation/IconRandomName", 1f, 0.5f, 10f); groupOptionButton1.Width = StyleDimension.FromPixelsAndPercent(40f, 0.0f); groupOptionButton1.Height = new StyleDimension(40f, 0.0f); groupOptionButton1.HAlign = 0.0f; groupOptionButton1.Top = StyleDimension.FromPixelsAndPercent(pixels1, 0.0f); groupOptionButton1.ShowHighlightWhenSelected = false; GroupOptionButton <bool> groupOptionButton2 = groupOptionButton1; groupOptionButton2.OnMouseDown += new UIElement.MouseEvent(this.ClickRandomizeName); groupOptionButton2.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription); groupOptionButton2.OnMouseOut += new UIElement.MouseEvent(this.ClearOptionDescription); groupOptionButton2.SetSnapPoint("RandomizeName", 0, new Vector2?(), new Vector2?()); uiElement.Append((UIElement)groupOptionButton2); UICharacterNameButton characterNameButton1 = new UICharacterNameButton(Language.GetText("UI.WorldCreationName"), Language.GetText("UI.WorldCreationNameEmpty"), Language.GetText("UI.WorldDescriptionName")); characterNameButton1.Width = StyleDimension.FromPixelsAndPercent(-num2, 1f); characterNameButton1.HAlign = 0.0f; characterNameButton1.Left = new StyleDimension(pixels2, 0.0f); characterNameButton1.Top = StyleDimension.FromPixelsAndPercent(pixels1, 0.0f); UICharacterNameButton characterNameButton2 = characterNameButton1; characterNameButton2.OnMouseDown += new UIElement.MouseEvent(this.Click_SetName); characterNameButton2.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription); characterNameButton2.OnMouseOut += new UIElement.MouseEvent(this.ClearOptionDescription); characterNameButton2.SetSnapPoint("Name", 0, new Vector2?(), new Vector2?()); uiElement.Append((UIElement)characterNameButton2); this._namePlate = characterNameButton2; CalculatedStyle dimensions1 = characterNameButton2.GetDimensions(); float pixels3 = pixels1 + (dimensions1.Height + 4f); GroupOptionButton <bool> groupOptionButton3 = new GroupOptionButton <bool>(true, (LocalizedText)null, Language.GetText("UI.WorldCreationRandomizeSeedDescription"), Color.White, "Images/UI/WorldCreation/IconRandomSeed", 1f, 0.5f, 10f); groupOptionButton3.Width = StyleDimension.FromPixelsAndPercent(40f, 0.0f); groupOptionButton3.Height = new StyleDimension(40f, 0.0f); groupOptionButton3.HAlign = 0.0f; groupOptionButton3.Top = StyleDimension.FromPixelsAndPercent(pixels3, 0.0f); groupOptionButton3.ShowHighlightWhenSelected = false; GroupOptionButton <bool> groupOptionButton4 = groupOptionButton3; groupOptionButton4.OnMouseDown += new UIElement.MouseEvent(this.ClickRandomizeSeed); groupOptionButton4.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription); groupOptionButton4.OnMouseOut += new UIElement.MouseEvent(this.ClearOptionDescription); groupOptionButton4.SetSnapPoint("RandomizeSeed", 0, new Vector2?(), new Vector2?()); uiElement.Append((UIElement)groupOptionButton4); UICharacterNameButton characterNameButton3 = new UICharacterNameButton(Language.GetText("UI.WorldCreationSeed"), Language.GetText("UI.WorldCreationSeedEmpty"), Language.GetText("UI.WorldDescriptionSeed")); characterNameButton3.Width = StyleDimension.FromPixelsAndPercent(-num2, 1f); characterNameButton3.HAlign = 0.0f; characterNameButton3.Left = new StyleDimension(pixels2, 0.0f); characterNameButton3.Top = StyleDimension.FromPixelsAndPercent(pixels3, 0.0f); characterNameButton3.DistanceFromTitleToOption = 29f; UICharacterNameButton characterNameButton4 = characterNameButton3; characterNameButton4.OnMouseDown += new UIElement.MouseEvent(this.Click_SetSeed); characterNameButton4.OnMouseOver += new UIElement.MouseEvent(this.ShowOptionDescription); characterNameButton4.OnMouseOut += new UIElement.MouseEvent(this.ClearOptionDescription); characterNameButton4.SetSnapPoint("Seed", 0, new Vector2?(), new Vector2?()); uiElement.Append((UIElement)characterNameButton4); this._seedPlate = characterNameButton4; UIWorldCreationPreview worldCreationPreview1 = new UIWorldCreationPreview(); worldCreationPreview1.Width = StyleDimension.FromPixels(84f); worldCreationPreview1.Height = StyleDimension.FromPixels(84f); worldCreationPreview1.HAlign = 1f; worldCreationPreview1.VAlign = 0.0f; UIWorldCreationPreview worldCreationPreview2 = worldCreationPreview1; uiElement.Append((UIElement)worldCreationPreview2); this._previewPlate = worldCreationPreview2; CalculatedStyle dimensions2 = characterNameButton4.GetDimensions(); float accumualtedHeight1 = pixels3 + (dimensions2.Height + 10f); UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight1 + 2f); float usableWidthPercent = 1f; this.AddWorldSizeOptions(uiElement, accumualtedHeight1, new UIElement.MouseEvent(this.ClickSizeOption), "size", usableWidthPercent); float accumualtedHeight2 = accumualtedHeight1 + 48f; UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight2); this.AddWorldDifficultyOptions(uiElement, accumualtedHeight2, new UIElement.MouseEvent(this.ClickDifficultyOption), "difficulty", usableWidthPercent); float accumualtedHeight3 = accumualtedHeight2 + 48f; UIWorldCreation.AddHorizontalSeparator(uiElement, accumualtedHeight3); this.AddWorldEvilOptions(uiElement, accumualtedHeight3, new UIElement.MouseEvent(this.ClickEvilOption), "evil", usableWidthPercent); float num3 = accumualtedHeight3 + 48f; UIWorldCreation.AddHorizontalSeparator(uiElement, num3); this.AddDescriptionPanel(uiElement, num3, "desc"); this.SetDefaultOptions(); }