diff --git a/OpenRA.Mods.Common/ModContent.cs b/OpenRA.Mods.Common/ModContent.cs index 74b63559c0..1fda933bf9 100644 --- a/OpenRA.Mods.Common/ModContent.cs +++ b/OpenRA.Mods.Common/ModContent.cs @@ -58,6 +58,8 @@ namespace OpenRA [FieldLoader.Ignore] public readonly List Install; + public readonly string TooltipText; + public ModSource(MiniYaml yaml, ObjectCreator objectCreator) { ObjectCreator = objectCreator; diff --git a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs index fe7cf637c7..4893ce9e6d 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Installation/InstallFromSourceLogic.cs @@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic readonly ScrollPanelWidget listPanel; readonly Widget listHeaderTemplate; readonly LabelWidget labelListTemplate; - readonly CheckboxWidget checkboxListTemplate; + readonly ContainerWidget checkboxListTemplate; readonly LabelWidget listLabel; ModContent.ModPackage[] availablePackages; @@ -149,7 +149,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic listPanel = listContainer.Get("LIST_PANEL"); listHeaderTemplate = listPanel.Get("LIST_HEADER_TEMPLATE"); labelListTemplate = listPanel.Get("LABEL_LIST_TEMPLATE"); - checkboxListTemplate = listPanel.Get("CHECKBOX_LIST_TEMPLATE"); + checkboxListTemplate = listPanel.Get("CHECKBOX_LIST_TEMPLATE"); listPanel.RemoveChildren(); listLabel = listContainer.Get("LIST_MESSAGE"); @@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic { Game.RunAfterTick(() => { - ShowList(kv.Value.Title, modData.Translation.GetString(ContentPackageInstallation)); + ShowList(kv.Value, modData.Translation.GetString(ContentPackageInstallation)); ShowContinueCancel(() => InstallFromSource(path, kv.Value)); }); @@ -321,21 +321,31 @@ namespace OpenRA.Mods.Common.Widgets.Logic panel.Bounds.Height = progressContainer.Bounds.Height; } - void ShowList(string title, string message) + void ShowList(ModContent.ModSource source, string message) { visible = Mode.List; - titleLabel.Text = title; + titleLabel.Text = source.Title; listLabel.Text = message; listPanel.RemoveChildren(); foreach (var package in availablePackages) { - var checkboxWidget = (CheckboxWidget)checkboxListTemplate.Clone(); + var containerWidget = (ContainerWidget)checkboxListTemplate.Clone(); + var checkboxWidget = containerWidget.Get("PACKAGE_CHECKBOX"); checkboxWidget.GetText = () => package.Title; checkboxWidget.IsDisabled = () => package.Required; checkboxWidget.IsChecked = () => selectedPackages[package.Identifier]; checkboxWidget.OnClick = () => selectedPackages[package.Identifier] = !selectedPackages[package.Identifier]; - listPanel.AddChild(checkboxWidget); + + var contentPackageNode = source.Install.FirstOrDefault(x => + x.Value.Nodes.FirstOrDefault(y => y.Key == "Name")?.Value.Value == package.Identifier); + + var tooltipText = contentPackageNode?.Value.Nodes.FirstOrDefault(x => x.Key == nameof(ModContent.ModSource.TooltipText))?.Value.Value; + var tooltipIcon = containerWidget.Get("PACKAGE_INFO"); + tooltipIcon.IsVisible = () => !string.IsNullOrWhiteSpace(tooltipText); + tooltipIcon.GetTooltipText = () => tooltipText; + + listPanel.AddChild(containerWidget); } primaryButton.Bounds.Y += listContainer.Bounds.Height - panel.Bounds.Height; diff --git a/mods/cnc/installer/origin.yaml b/mods/cnc/installer/origin.yaml index c7e5078f74..72bb418e68 100644 --- a/mods/cnc/installer/origin.yaml +++ b/mods/cnc/installer/origin.yaml @@ -208,6 +208,7 @@ cncr-origin: C&C Remastered Collection (Origin version, English) # The Remastered Collection doesn't include trailer.vqa. ContentPackage: Name: movies-gdi + TooltipText: The Remastered Collection doesn't include trailer.vqa. Actions: ExtractMix: Data/CNCDATA/TIBERIAN_DAWN/CD1/MOVIES.MIX ^SupportDir|Content/cnc/movies/visor.vqa: visor.vqa @@ -278,6 +279,7 @@ cncr-origin: C&C Remastered Collection (Origin version, English) # The Remastered Collection doesn't include trailer.vqa. ContentPackage: Name: movies-nod + TooltipText: The Remastered Collection doesn't include trailer.vqa. Actions: ExtractMix: Data/CNCDATA/TIBERIAN_DAWN/CD2/MOVIES.MIX ^SupportDir|Content/cnc/movies/visor.vqa: visor.vqa diff --git a/mods/cnc/installer/steam.yaml b/mods/cnc/installer/steam.yaml index bae5076b2a..b2fd5cdf37 100644 --- a/mods/cnc/installer/steam.yaml +++ b/mods/cnc/installer/steam.yaml @@ -34,6 +34,7 @@ cncr-steam: C&C Remastered Collection (Steam version, English) # The Remastered Collection doesn't include trailer.vqa. ContentPackage: Name: movies-gdi + TooltipText: The Remastered Collection doesn't include trailer.vqa. Actions: ExtractMix: Data/CNCDATA/TIBERIAN_DAWN/CD1/MOVIES.MIX ^SupportDir|Content/cnc/movies/visor.vqa: visor.vqa @@ -104,6 +105,7 @@ cncr-steam: C&C Remastered Collection (Steam version, English) # The Remastered Collection doesn't include trailer.vqa. ContentPackage: Name: movies-nod + TooltipText: The Remastered Collection doesn't include trailer.vqa. Actions: ExtractMix: Data/CNCDATA/TIBERIAN_DAWN/CD2/MOVIES.MIX ^SupportDir|Content/cnc/movies/visor.vqa: visor.vqa diff --git a/mods/modcontent/content.yaml b/mods/modcontent/content.yaml index b154bcb1c2..096bd6389a 100644 --- a/mods/modcontent/content.yaml +++ b/mods/modcontent/content.yaml @@ -121,6 +121,19 @@ Background@SOURCE_TOOLTIP: Height: 14 Font: TinyBold +Background@INFO_TOOLTIP: + Logic: SimpleTooltipLogic + Background: panel-thinborder + Height: 25 + Children: + Container@LINE_HEIGHT: + Y: 2 + Height: 19 + Label@LABEL: + X: 5 + Height: 23 + Font: Bold + Container@PACKAGE_DOWNLOAD_PANEL: Logic: DownloadPackageLogic X: (WINDOW_RIGHT - WIDTH) / 2 @@ -268,10 +281,26 @@ Background@SOURCE_INSTALL_PANEL: X: 6 Width: PARENT_RIGHT - 16 Height: 23 - Checkbox@CHECKBOX_LIST_TEMPLATE: + Container@CHECKBOX_LIST_TEMPLATE: X: 6 Width: PARENT_RIGHT - 16 Height: 23 + Children: + Checkbox@PACKAGE_CHECKBOX: + X: 6 + Width: PARENT_RIGHT - 16 + Height: 23 + Children: + Image@PACKAGE_INFO: + X: 275 + Y: 2 + Width: 20 + Height: 20 + Visible: false + ImageCollection: modcontent + ImageName: cdicon + TooltipContainer: TOOLTIP_CONTAINER + TooltipTemplate: INFO_TOOLTIP Button@PRIMARY_BUTTON: X: 30 Y: PARENT_BOTTOM - 52 @@ -288,6 +317,7 @@ Background@SOURCE_INSTALL_PANEL: Height: 32 Font: Bold Key: escape + TooltipContainer@TOOLTIP_CONTAINER: Background@CONTENT_PROMPT_PANEL: Logic: ModContentPromptLogic