committed by
Chris Forbes
parent
0d59a4dcd7
commit
9115fc4397
@@ -32,8 +32,10 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
var powerLabel = widget.Get<LabelWidget>("POWER");
|
var powerLabel = widget.Get<LabelWidget>("POWER");
|
||||||
var timeLabel = widget.Get<LabelWidget>("TIME");
|
var timeLabel = widget.Get<LabelWidget>("TIME");
|
||||||
var costLabel = widget.Get<LabelWidget>("COST");
|
var costLabel = widget.Get<LabelWidget>("COST");
|
||||||
|
var descLabel = widget.Get<LabelWidget>("DESC");
|
||||||
|
|
||||||
var font = Game.Renderer.Fonts[nameLabel.Font];
|
var font = Game.Renderer.Fonts[nameLabel.Font];
|
||||||
|
var descFont = Game.Renderer.Fonts[descLabel.Font];
|
||||||
var requiresFont = Game.Renderer.Fonts[requiresLabel.Font];
|
var requiresFont = Game.Renderer.Fonts[requiresLabel.Font];
|
||||||
string lastActor = null;
|
string lastActor = null;
|
||||||
|
|
||||||
@@ -70,12 +72,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost
|
costLabel.GetColor = () => pr.DisplayCash + pr.DisplayOre >= cost
|
||||||
? Color.White : Color.Red;
|
? 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);
|
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;
|
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.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;
|
lastActor = actor;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ Background@WORLD_TOOLTIP:
|
|||||||
Y:19
|
Y:19
|
||||||
Height:23
|
Height:23
|
||||||
Font:Bold
|
Font:Bold
|
||||||
|
|
||||||
Background@PRODUCTION_TOOLTIP:
|
Background@PRODUCTION_TOOLTIP:
|
||||||
Logic:ProductionTooltipLogic
|
Logic:ProductionTooltipLogic
|
||||||
Background:panel-black
|
Background:panel-black
|
||||||
@@ -56,6 +57,12 @@ Background@PRODUCTION_TOOLTIP:
|
|||||||
Y:19
|
Y:19
|
||||||
Height:23
|
Height:23
|
||||||
Font:TinyBold
|
Font:TinyBold
|
||||||
|
Label@DESC:
|
||||||
|
X:5
|
||||||
|
Y:39
|
||||||
|
Height:23
|
||||||
|
Font:TinyBold
|
||||||
|
VAlign:Top
|
||||||
Label@COST:
|
Label@COST:
|
||||||
Height:23
|
Height:23
|
||||||
Font:Bold
|
Font:Bold
|
||||||
|
|||||||
@@ -52,12 +52,13 @@ NUKE:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Power Plant
|
Name: Power Plant
|
||||||
Icon: nukeicnh
|
Icon: nukeicnh
|
||||||
Description: Provides power for other structures
|
Description: Generates power
|
||||||
ProvidesCustomPrerequisite:
|
ProvidesCustomPrerequisite:
|
||||||
Prerequisite: anypower
|
Prerequisite: anypower
|
||||||
Buildable:
|
Buildable:
|
||||||
BuildPaletteOrder: 10
|
BuildPaletteOrder: 10
|
||||||
Owner: gdi,nod
|
Owner: gdi,nod
|
||||||
|
Prerequisites: fact
|
||||||
Building:
|
Building:
|
||||||
Power: 100
|
Power: 100
|
||||||
Footprint: x_ xx
|
Footprint: x_ xx
|
||||||
@@ -75,7 +76,7 @@ PROC:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Tiberium Refinery
|
Name: Tiberium Refinery
|
||||||
Icon: procicnh
|
Icon: procicnh
|
||||||
Description: Processes raw Tiberium into useable resources
|
Description: Processes raw Tiberium\ninto useable resources
|
||||||
Buildable:
|
Buildable:
|
||||||
BuildPaletteOrder: 30
|
BuildPaletteOrder: 30
|
||||||
Prerequisites: anypower
|
Prerequisites: anypower
|
||||||
@@ -232,7 +233,7 @@ AFLD:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Airstrip
|
Name: Airstrip
|
||||||
Icon: afldicnh
|
Icon: afldicnh
|
||||||
Description: Provides a dropzone for vehicle reinforcements
|
Description: Provides a dropzone\nfor vehicle reinforcements
|
||||||
ProvidesCustomPrerequisite:
|
ProvidesCustomPrerequisite:
|
||||||
Prerequisite: vehicleproduction
|
Prerequisite: vehicleproduction
|
||||||
Buildable:
|
Buildable:
|
||||||
@@ -274,7 +275,7 @@ WEAP:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Weapons Factory
|
Name: Weapons Factory
|
||||||
Icon: weapicnh
|
Icon: weapicnh
|
||||||
Description: Assembly point for vehicle reinforcements
|
Description: Assembly point for\nvehicle reinforcements
|
||||||
ProvidesCustomPrerequisite:
|
ProvidesCustomPrerequisite:
|
||||||
Prerequisite: vehicleproduction
|
Prerequisite: vehicleproduction
|
||||||
Buildable:
|
Buildable:
|
||||||
@@ -403,7 +404,7 @@ HPAD:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Helipad
|
Name: Helipad
|
||||||
Icon:hpadicnh
|
Icon:hpadicnh
|
||||||
Description: Produces and reloads helicopters
|
Description: Produces, rearms and\nrepairs helicopters
|
||||||
Buildable:
|
Buildable:
|
||||||
BuildPaletteOrder: 50
|
BuildPaletteOrder: 50
|
||||||
Prerequisites: barracks
|
Prerequisites: barracks
|
||||||
@@ -482,7 +483,7 @@ TMPL:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Temple of Nod
|
Name: Temple of Nod
|
||||||
Icon: tmplicnh
|
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:
|
Buildable:
|
||||||
BuildPaletteOrder: 100
|
BuildPaletteOrder: 100
|
||||||
Prerequisites: hq
|
Prerequisites: hq
|
||||||
@@ -516,7 +517,7 @@ OBLI:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Obelisk of Light
|
Name: Obelisk of Light
|
||||||
Icon:obliicnh
|
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:
|
Buildable:
|
||||||
Queue: Defense
|
Queue: Defense
|
||||||
BuildPaletteOrder: 60
|
BuildPaletteOrder: 60
|
||||||
@@ -692,7 +693,7 @@ GTWR:
|
|||||||
Tooltip:
|
Tooltip:
|
||||||
Name: Guard Tower
|
Name: Guard Tower
|
||||||
Icon: gtwricnh
|
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:
|
Buildable:
|
||||||
Queue: Defense
|
Queue: Defense
|
||||||
BuildPaletteOrder: 40
|
BuildPaletteOrder: 40
|
||||||
|
|||||||
Reference in New Issue
Block a user