Implement new spawn tooltips in RA and d2k.
This commit is contained in:
@@ -113,7 +113,6 @@
|
|||||||
<Compile Include="WithFire.cs" />
|
<Compile Include="WithFire.cs" />
|
||||||
<Compile Include="WithRoof.cs" />
|
<Compile Include="WithRoof.cs" />
|
||||||
<Compile Include="Widgets\ResourceBarWidget.cs" />
|
<Compile Include="Widgets\ResourceBarWidget.cs" />
|
||||||
<Compile Include="Widgets\Logic\SpawnSelectorTooltipLogic.cs" />
|
|
||||||
<Compile Include="Widgets\Logic\ProductionTabsLogic.cs" />
|
<Compile Include="Widgets\Logic\ProductionTabsLogic.cs" />
|
||||||
<Compile Include="Widgets\ProductionTypeButtonWidget.cs" />
|
<Compile Include="Widgets\ProductionTypeButtonWidget.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -430,6 +430,7 @@
|
|||||||
<Compile Include="BridgeHut.cs" />
|
<Compile Include="BridgeHut.cs" />
|
||||||
<Compile Include="Lint\CheckSequences.cs" />
|
<Compile Include="Lint\CheckSequences.cs" />
|
||||||
<Compile Include="ServerTraits\PlayerPinger.cs" />
|
<Compile Include="ServerTraits\PlayerPinger.cs" />
|
||||||
|
<Compile Include="Widgets\Logic\SpawnSelectorTooltipLogic.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ using System.Linq;
|
|||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
using OpenRA.Network;
|
using OpenRA.Network;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Cnc.Widgets.Logic
|
namespace OpenRA.Mods.RA.Widgets.Logic
|
||||||
{
|
{
|
||||||
public class SpawnSelectorTooltipLogic
|
public class SpawnSelectorTooltipLogic
|
||||||
{
|
{
|
||||||
@@ -25,9 +25,14 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
var label = widget.Get<LabelWidget>("LABEL");
|
var label = widget.Get<LabelWidget>("LABEL");
|
||||||
var flag = widget.Get<ImageWidget>("FLAG");
|
var flag = widget.Get<ImageWidget>("FLAG");
|
||||||
var team = widget.Get<LabelWidget>("TEAM");
|
var team = widget.Get<LabelWidget>("TEAM");
|
||||||
|
var singleHeight = widget.Get("SINGLE_HEIGHT").Bounds.Height;
|
||||||
|
var doubleHeight = widget.Get("DOUBLE_HEIGHT").Bounds.Height;
|
||||||
var ownerFont = Game.Renderer.Fonts[label.Font];
|
var ownerFont = Game.Renderer.Fonts[label.Font];
|
||||||
var teamFont = Game.Renderer.Fonts[team.Font];
|
var teamFont = Game.Renderer.Fonts[team.Font];
|
||||||
|
|
||||||
|
// Width specified in YAML is used as the margin between flag / label and label / border
|
||||||
|
var labelMargin = widget.Bounds.Width;
|
||||||
|
|
||||||
var cachedWidth = 0;
|
var cachedWidth = 0;
|
||||||
var labelText = "";
|
var labelText = "";
|
||||||
string playerCountry = null;
|
string playerCountry = null;
|
||||||
@@ -43,18 +48,18 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
labelText = "Available spawn";
|
labelText = "Available spawn";
|
||||||
playerCountry = null;
|
playerCountry = null;
|
||||||
playerTeam = 0;
|
playerTeam = 0;
|
||||||
widget.Bounds.Height = 25;
|
widget.Bounds.Height = singleHeight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
labelText = client.Name;
|
labelText = client.Name;
|
||||||
playerCountry = client.Country;
|
playerCountry = client.Country;
|
||||||
playerTeam = client.Team;
|
playerTeam = client.Team;
|
||||||
widget.Bounds.Height = playerTeam > 0 ? 40 : 25;
|
widget.Bounds.Height = playerTeam > 0 ? doubleHeight : singleHeight;
|
||||||
teamWidth = teamFont.Measure(team.GetText()).X;
|
teamWidth = teamFont.Measure(team.GetText()).X;
|
||||||
}
|
}
|
||||||
|
|
||||||
label.Bounds.X = playerCountry != null ? flag.Bounds.Right + 5 : 5;
|
label.Bounds.X = playerCountry != null ? flag.Bounds.Right + labelMargin : labelMargin;
|
||||||
|
|
||||||
var textWidth = ownerFont.Measure(labelText).X;
|
var textWidth = ownerFont.Measure(labelText).X;
|
||||||
if (textWidth != cachedWidth)
|
if (textWidth != cachedWidth)
|
||||||
@@ -63,7 +68,7 @@ namespace OpenRA.Mods.Cnc.Widgets.Logic
|
|||||||
widget.Bounds.Width = 2*label.Bounds.X + textWidth;
|
widget.Bounds.Width = 2*label.Bounds.X + textWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.Bounds.Width = Math.Max(teamWidth + 10, label.Bounds.Right + 5);
|
widget.Bounds.Width = Math.Max(teamWidth + 2*labelMargin, label.Bounds.Right + labelMargin);
|
||||||
team.Bounds.Width = widget.Bounds.Width;
|
team.Bounds.Width = widget.Bounds.Width;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -480,7 +480,6 @@ Container@SERVER_LOBBY:
|
|||||||
Height:25
|
Height:25
|
||||||
Align:Right
|
Align:Right
|
||||||
Text:Chat:
|
Text:Chat:
|
||||||
TooltipContainer@TOOLTIP_CONTAINER:
|
|
||||||
Button@DISCONNECT_BUTTON:
|
Button@DISCONNECT_BUTTON:
|
||||||
X:0
|
X:0
|
||||||
Y:499
|
Y:499
|
||||||
@@ -505,3 +504,4 @@ Container@SERVER_LOBBY:
|
|||||||
Width:140
|
Width:140
|
||||||
Height:35
|
Height:35
|
||||||
Text:Start Game
|
Text:Start Game
|
||||||
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
@@ -103,8 +103,12 @@ Background@SUPPORT_POWER_TOOLTIP:
|
|||||||
Background@SPAWN_TOOLTIP:
|
Background@SPAWN_TOOLTIP:
|
||||||
Logic:SpawnSelectorTooltipLogic
|
Logic:SpawnSelectorTooltipLogic
|
||||||
Background:panel-black
|
Background:panel-black
|
||||||
Width:141
|
Width:5
|
||||||
Children:
|
Children:
|
||||||
|
Container@SINGLE_HEIGHT:
|
||||||
|
Height:26
|
||||||
|
Container@DOUBLE_HEIGHT:
|
||||||
|
Height:40
|
||||||
Label@LABEL:
|
Label@LABEL:
|
||||||
X:5
|
X:5
|
||||||
Height:23
|
Height:23
|
||||||
@@ -118,4 +122,4 @@ Background@SPAWN_TOOLTIP:
|
|||||||
Y:21
|
Y:21
|
||||||
Height:15
|
Height:15
|
||||||
Font:TinyBold
|
Font:TinyBold
|
||||||
Align:center
|
Align:center
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Background@SERVER_LOBBY:
|
|||||||
Y:4
|
Y:4
|
||||||
Width:244
|
Width:244
|
||||||
Height:244
|
Height:244
|
||||||
|
TooltipContainer:TOOLTIP_CONTAINER
|
||||||
ScrollPanel@PLAYERS:
|
ScrollPanel@PLAYERS:
|
||||||
X:20
|
X:20
|
||||||
Y:67
|
Y:67
|
||||||
@@ -493,4 +494,5 @@ Background@SERVER_LOBBY:
|
|||||||
Width:120
|
Width:120
|
||||||
Height:25
|
Height:25
|
||||||
Text:Start Game
|
Text:Start Game
|
||||||
Font:Bold
|
Font:Bold
|
||||||
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
23
mods/d2k/chrome/tooltips.yaml
Normal file
23
mods/d2k/chrome/tooltips.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Background@SPAWN_TOOLTIP:
|
||||||
|
Logic:SpawnSelectorTooltipLogic
|
||||||
|
Background:dialog3
|
||||||
|
Width:7
|
||||||
|
Children:
|
||||||
|
Container@SINGLE_HEIGHT:
|
||||||
|
Height:31
|
||||||
|
Container@DOUBLE_HEIGHT:
|
||||||
|
Height:47
|
||||||
|
Label@LABEL:
|
||||||
|
Y:3
|
||||||
|
Height:23
|
||||||
|
Font:Bold
|
||||||
|
Image@FLAG:
|
||||||
|
X:5
|
||||||
|
Y:5
|
||||||
|
Width:23
|
||||||
|
Height:23
|
||||||
|
Label@TEAM:
|
||||||
|
Y:28
|
||||||
|
Height:15
|
||||||
|
Font:TinyBold
|
||||||
|
Align:center
|
||||||
@@ -60,6 +60,7 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/dropdowns.yaml
|
mods/ra/chrome/dropdowns.yaml
|
||||||
mods/ra/chrome/modchooser.yaml
|
mods/ra/chrome/modchooser.yaml
|
||||||
mods/ra/chrome/cheats.yaml
|
mods/ra/chrome/cheats.yaml
|
||||||
|
mods/d2k/chrome/tooltips.yaml
|
||||||
|
|
||||||
Weapons:
|
Weapons:
|
||||||
mods/d2k/weapons/defaults.yaml
|
mods/d2k/weapons/defaults.yaml
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ Background@SERVER_LOBBY:
|
|||||||
Y:4
|
Y:4
|
||||||
Width:244
|
Width:244
|
||||||
Height:244
|
Height:244
|
||||||
|
TooltipContainer:TOOLTIP_CONTAINER
|
||||||
ScrollPanel@PLAYERS:
|
ScrollPanel@PLAYERS:
|
||||||
X:20
|
X:20
|
||||||
Y:67
|
Y:67
|
||||||
@@ -499,4 +500,5 @@ Background@SERVER_LOBBY:
|
|||||||
Width:120
|
Width:120
|
||||||
Height:25
|
Height:25
|
||||||
Text:Start Game
|
Text:Start Game
|
||||||
Font:Bold
|
Font:Bold
|
||||||
|
TooltipContainer@TOOLTIP_CONTAINER:
|
||||||
23
mods/ra/chrome/tooltips.yaml
Normal file
23
mods/ra/chrome/tooltips.yaml
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
Background@SPAWN_TOOLTIP:
|
||||||
|
Logic:SpawnSelectorTooltipLogic
|
||||||
|
Background:dialog4
|
||||||
|
Width:7
|
||||||
|
Children:
|
||||||
|
Container@SINGLE_HEIGHT:
|
||||||
|
Height:29
|
||||||
|
Container@DOUBLE_HEIGHT:
|
||||||
|
Height:44
|
||||||
|
Label@LABEL:
|
||||||
|
Y:2
|
||||||
|
Height:23
|
||||||
|
Font:Bold
|
||||||
|
Image@FLAG:
|
||||||
|
X:7
|
||||||
|
Y:7
|
||||||
|
Width:32
|
||||||
|
Height:16
|
||||||
|
Label@TEAM:
|
||||||
|
Y:23
|
||||||
|
Height:15
|
||||||
|
Font:TinyBold
|
||||||
|
Align:center
|
||||||
@@ -70,6 +70,7 @@ ChromeLayout:
|
|||||||
mods/ra/chrome/modchooser.yaml
|
mods/ra/chrome/modchooser.yaml
|
||||||
mods/ra/chrome/cheats.yaml
|
mods/ra/chrome/cheats.yaml
|
||||||
mods/ra/chrome/objectives.yaml
|
mods/ra/chrome/objectives.yaml
|
||||||
|
mods/ra/chrome/tooltips.yaml
|
||||||
|
|
||||||
Weapons:
|
Weapons:
|
||||||
mods/ra/weapons.yaml
|
mods/ra/weapons.yaml
|
||||||
|
|||||||
Reference in New Issue
Block a user