diff --git a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs index 89a59b9715..84101a31e9 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/MainMenuLogic.cs @@ -43,6 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic protected MenuType menuType = MenuType.Main; readonly Widget rootMenu; readonly ScrollPanelWidget newsPanel; + readonly int maxNewsHeight; readonly Widget newsTemplate; readonly LabelWidget newsStatus; readonly ModData modData; @@ -230,6 +231,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic newsPanel = Ui.LoadWidget("NEWS_PANEL", null, new WidgetArgs()); newsTemplate = newsPanel.Get("NEWS_ITEM_TEMPLATE"); newsPanel.RemoveChild(newsTemplate); + maxNewsHeight = newsPanel.Bounds.Height; newsStatus = newsPanel.Get("NEWS_STATUS"); SetNewsStatus(FluentProvider.GetMessage(LoadingNews)); @@ -416,10 +418,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic newsPanel.RemoveChildren(); SetNewsStatus(""); - foreach (var i in newsItems) + foreach (var item in newsItems) { - var item = i; - var newsItem = newsTemplate.Clone(); var titleLabel = newsItem.Get("TITLE"); @@ -441,6 +441,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic newsPanel.AddChild(newsItem); newsPanel.Layout.AdjustChildren(); + newsPanel.Bounds.Height = Math.Min(newsPanel.ContentHeight, maxNewsHeight); } } diff --git a/mods/cnc/chrome/dialogs.yaml b/mods/cnc/chrome/dialogs.yaml index 34f3d7697d..8bf87f2f37 100644 --- a/mods/cnc/chrome/dialogs.yaml +++ b/mods/cnc/chrome/dialogs.yaml @@ -284,29 +284,27 @@ ScrollPanel@NEWS_PANEL: Width: 400 Height: 265 Background: panel-black - TopBottomSpacing: 5 + TopBottomSpacing: 10 ItemSpacing: 5 Children: Container@NEWS_ITEM_TEMPLATE: X: 10 - Y: 5 Width: PARENT_WIDTH - 40 - Height: 45 + Height: 40 Children: Label@TITLE: - Y: 1 Width: PARENT_WIDTH - Height: 25 + Height: 20 Align: Center Font: Bold Label@AUTHOR_DATETIME: - Y: 26 + Y: 21 Width: PARENT_WIDTH Height: 15 Align: Center Font: TinyBold Label@CONTENT: - Y: 46 + Y: 40 Width: PARENT_WIDTH Label@NEWS_STATUS: X: 80 diff --git a/mods/common/chrome/dropdowns.yaml b/mods/common/chrome/dropdowns.yaml index 0e2bc764ba..30a9b777f4 100644 --- a/mods/common/chrome/dropdowns.yaml +++ b/mods/common/chrome/dropdowns.yaml @@ -152,32 +152,30 @@ ScrollPanel@SPECTATOR_LABEL_DROPDOWN_TEMPLATE: ScrollPanel@NEWS_PANEL: Width: 400 Height: 265 - TopBottomSpacing: 5 + TopBottomSpacing: 15 ItemSpacing: 5 Children: Container@NEWS_ITEM_TEMPLATE: X: 10 - Y: 5 Width: PARENT_WIDTH - 40 - Height: 45 + Height: 40 Children: Label@TITLE: Width: PARENT_WIDTH - Height: 25 + Height: 15 Align: Center Font: Bold Label@AUTHOR_DATETIME: - Y: 25 + Y: 20 Width: PARENT_WIDTH Height: 15 Align: Center Font: TinyBold Label@CONTENT: - Y: 45 + Y: 40 Width: PARENT_WIDTH Label@NEWS_STATUS: X: 80 - Y: 0 Width: PARENT_WIDTH - 80 - 80 - 24 Height: PARENT_HEIGHT Align: Center diff --git a/mods/d2k/chrome/dropdowns.yaml b/mods/d2k/chrome/dropdowns.yaml index b397f7e143..c663033b7c 100644 --- a/mods/d2k/chrome/dropdowns.yaml +++ b/mods/d2k/chrome/dropdowns.yaml @@ -116,32 +116,30 @@ ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE: ScrollPanel@NEWS_PANEL: Width: 400 Height: 265 - TopBottomSpacing: 5 + TopBottomSpacing: 15 ItemSpacing: 5 Children: Container@NEWS_ITEM_TEMPLATE: X: 10 - Y: 5 Width: PARENT_WIDTH - 40 - Height: 45 + Height: 40 Children: Label@TITLE: Width: PARENT_WIDTH - Height: 25 + Height: 15 Align: Center Font: Bold Label@AUTHOR_DATETIME: - Y: 25 + Y: 20 Width: PARENT_WIDTH Height: 15 Align: Center Font: TinyBold Label@CONTENT: - Y: 45 + Y: 40 Width: PARENT_WIDTH Label@NEWS_STATUS: X: 80 - Y: 0 Width: PARENT_WIDTH - 80 - 80 - 24 Height: PARENT_HEIGHT Align: Center diff --git a/mods/ts/chrome/dropdowns.yaml b/mods/ts/chrome/dropdowns.yaml index 7cdfc6c0c4..9038890827 100644 --- a/mods/ts/chrome/dropdowns.yaml +++ b/mods/ts/chrome/dropdowns.yaml @@ -116,32 +116,30 @@ ScrollPanel@SPECTATOR_DROPDOWN_TEMPLATE: ScrollPanel@NEWS_PANEL: Width: 400 Height: 265 - TopBottomSpacing: 5 + TopBottomSpacing: 15 ItemSpacing: 5 Children: Container@NEWS_ITEM_TEMPLATE: X: 10 - Y: 6 Width: PARENT_WIDTH - 40 - Height: 45 + Height: 40 Children: Label@TITLE: Width: PARENT_WIDTH - Height: 25 + Height: 15 Align: Center Font: Bold Label@AUTHOR_DATETIME: - Y: 25 + Y: 20 Width: PARENT_WIDTH Height: 15 Align: Center Font: TinyBold Label@CONTENT: - Y: 45 + Y: 40 Width: PARENT_WIDTH Label@NEWS_STATUS: X: 80 - Y: 1 Width: PARENT_WIDTH - 80 - 80 - 24 Height: PARENT_HEIGHT Align: Center