diff --git a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs index 5870a9df0c..75bc3009f2 100644 --- a/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs +++ b/OpenRA.Mods.Cnc/Widgets/Logic/ProductionTooltipLogic.cs @@ -32,8 +32,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic var powerLabel = widget.Get("POWER"); var timeLabel = widget.Get("TIME"); var costLabel = widget.Get("COST"); + var descLabel = widget.Get("DESC"); var font = Game.Renderer.Fonts[nameLabel.Font]; + var descFont = Game.Renderer.Fonts[descLabel.Font]; var requiresFont = Game.Renderer.Fonts[requiresLabel.Font]; string lastActor = null; @@ -70,12 +72,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost ? Color.White : Color.Red; - var leftWidth = Math.Max(font.Measure(tooltip.Name).X, requiresFont.Measure(requiresString).X); + var descString = tooltip.Description.Replace("\\n", "\n"); + descLabel.GetText = () => descString; + + var leftWidth = new [] {font.Measure(tooltip.Name).X, requiresFont.Measure(requiresString).X, descFont.Measure(descString).X}.Aggregate(Math.Max); var rightWidth = new [] {font.Measure(powerString).X, font.Measure(timeString).X, font.Measure(costString).X}.Aggregate(Math.Max); timeLabel.Bounds.X = powerLabel.Bounds.X = costLabel.Bounds.X = leftWidth + 2*nameLabel.Bounds.X; widget.Bounds.Width = leftWidth + rightWidth + 3*nameLabel.Bounds.X; - widget.Bounds.Height = power != 0 ? 65 : 45; + var leftHeight = font.Measure(tooltip.Name).Y + requiresFont.Measure(requiresString).Y + descFont.Measure(descString).Y; + var rightHeight = font.Measure(powerString).Y + font.Measure(timeString).Y + font.Measure(costString).Y; + widget.Bounds.Height = Math.Max(leftHeight, rightHeight)*3/2 + 3*nameLabel.Bounds.Y; + lastActor = actor; }; } diff --git a/mods/cnc/chrome/tooltips.yaml b/mods/cnc/chrome/tooltips.yaml index 06b92935de..6860027c99 100644 --- a/mods/cnc/chrome/tooltips.yaml +++ b/mods/cnc/chrome/tooltips.yaml @@ -41,6 +41,7 @@ Background@WORLD_TOOLTIP: Y:19 Height:23 Font:Bold + Background@PRODUCTION_TOOLTIP: Logic:ProductionTooltipLogic Background:panel-black @@ -56,6 +57,12 @@ Background@PRODUCTION_TOOLTIP: Y:19 Height:23 Font:TinyBold + Label@DESC: + X:5 + Y:39 + Height:23 + Font:TinyBold + VAlign:Top Label@COST: Height:23 Font:Bold diff --git a/mods/cnc/rules/structures.yaml b/mods/cnc/rules/structures.yaml index 502c0d51af..c84fb9e367 100644 --- a/mods/cnc/rules/structures.yaml +++ b/mods/cnc/rules/structures.yaml @@ -52,12 +52,13 @@ NUKE: Tooltip: Name: Power Plant Icon: nukeicnh - Description: Provides power for other structures + Description: Generates power ProvidesCustomPrerequisite: Prerequisite: anypower Buildable: BuildPaletteOrder: 10 Owner: gdi,nod + Prerequisites: fact Building: Power: 100 Footprint: x_ xx @@ -75,7 +76,7 @@ PROC: Tooltip: Name: Tiberium Refinery Icon: procicnh - Description: Processes raw Tiberium into useable resources + Description: Processes raw Tiberium\ninto useable resources Buildable: BuildPaletteOrder: 30 Prerequisites: anypower @@ -232,7 +233,7 @@ AFLD: Tooltip: Name: Airstrip Icon: afldicnh - Description: Provides a dropzone for vehicle reinforcements + Description: Provides a dropzone\nfor vehicle reinforcements ProvidesCustomPrerequisite: Prerequisite: vehicleproduction Buildable: @@ -274,7 +275,7 @@ WEAP: Tooltip: Name: Weapons Factory Icon: weapicnh - Description: Assembly point for vehicle reinforcements + Description: Assembly point for\nvehicle reinforcements ProvidesCustomPrerequisite: Prerequisite: vehicleproduction Buildable: @@ -403,7 +404,7 @@ HPAD: Tooltip: Name: Helipad Icon:hpadicnh - Description: Produces and reloads helicopters + Description: Produces, rearms and\nrepairs helicopters Buildable: BuildPaletteOrder: 50 Prerequisites: barracks @@ -482,7 +483,7 @@ TMPL: Tooltip: Name: Temple of Nod Icon: tmplicnh - Description: Place of worship and secret missile silo.\nRequires power to operate. + Description: Place of worship and secret missile silo.\n Requires power to operate. Buildable: BuildPaletteOrder: 100 Prerequisites: hq @@ -516,7 +517,7 @@ OBLI: Tooltip: Name: Obelisk of Light Icon:obliicnh - Description: Advanced base defense. Requires power\nto operate.\n Strong vs Tanks, Infantry\n Weak vs Aircraft + Description: Advanced base defense.\n Requires power to operate.\n Strong vs Tanks, Infantry\n Weak vs Aircraft Buildable: Queue: Defense BuildPaletteOrder: 60 @@ -692,7 +693,7 @@ GTWR: Tooltip: Name: Guard Tower Icon: gtwricnh - Description: Basic defensive structure.\n Strong vs Infantry, Light Vehicles\n Weak vs Tanks, Aircraft + Description: Basic defensive structure.\n Strong vs Infantry\n Weak vs Tanks, Aircraft Buildable: Queue: Defense BuildPaletteOrder: 40