Added tooltips to ContentPackages
This commit is contained in:
committed by
Matthias Mailänder
parent
9cb2d19654
commit
d61178de41
@@ -58,6 +58,8 @@ namespace OpenRA
|
||||
[FieldLoader.Ignore]
|
||||
public readonly List<MiniYamlNode> Install;
|
||||
|
||||
public readonly string TooltipText;
|
||||
|
||||
public ModSource(MiniYaml yaml, ObjectCreator objectCreator)
|
||||
{
|
||||
ObjectCreator = objectCreator;
|
||||
|
||||
@@ -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<ScrollPanelWidget>("LIST_PANEL");
|
||||
listHeaderTemplate = listPanel.Get("LIST_HEADER_TEMPLATE");
|
||||
labelListTemplate = listPanel.Get<LabelWidget>("LABEL_LIST_TEMPLATE");
|
||||
checkboxListTemplate = listPanel.Get<CheckboxWidget>("CHECKBOX_LIST_TEMPLATE");
|
||||
checkboxListTemplate = listPanel.Get<ContainerWidget>("CHECKBOX_LIST_TEMPLATE");
|
||||
listPanel.RemoveChildren();
|
||||
|
||||
listLabel = listContainer.Get<LabelWidget>("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<CheckboxWidget>("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<ImageWidget>("PACKAGE_INFO");
|
||||
tooltipIcon.IsVisible = () => !string.IsNullOrWhiteSpace(tooltipText);
|
||||
tooltipIcon.GetTooltipText = () => tooltipText;
|
||||
|
||||
listPanel.AddChild(containerWidget);
|
||||
}
|
||||
|
||||
primaryButton.Bounds.Y += listContainer.Bounds.Height - panel.Bounds.Height;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user