Nicer tooltips
This commit is contained in:
@@ -75,7 +75,7 @@ namespace OpenRA
|
|||||||
PlayerName = client.Name;
|
PlayerName = client.Name;
|
||||||
InternalName = "Multi{0}".F(client.Index);
|
InternalName = "Multi{0}".F(client.Index);
|
||||||
Country = world.GetCountries()
|
Country = world.GetCountries()
|
||||||
.FirstOrDefault(c => client != null && client.Country == c.Name)
|
.FirstOrDefault(c => client != null && client.Country == c.Race)
|
||||||
?? world.GetCountries().Random(world.SharedRandom);
|
?? world.GetCountries().Random(world.SharedRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ namespace OpenRA.Widgets.Delegates
|
|||||||
|
|
||||||
bool CycleRace(MouseInput mi)
|
bool CycleRace(MouseInput mi)
|
||||||
{
|
{
|
||||||
var countries = new[] { "Random" }.Concat(Game.world.GetCountries().Select(c => c.Name));
|
var countries = new[] { "Random" }.Concat(Game.world.GetCountries().Select(c => c.Race));
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Right)
|
if (mi.Button == MouseButton.Right)
|
||||||
countries = countries.Reverse();
|
countries = countries.Reverse();
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ using System;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Graphics;
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
namespace OpenRA.Widgets
|
||||||
{
|
{
|
||||||
@@ -47,15 +48,17 @@ namespace OpenRA.Widgets
|
|||||||
var text = actor.Info.Traits.Contains<ValuedInfo>()
|
var text = actor.Info.Traits.Contains<ValuedInfo>()
|
||||||
? actor.Info.Traits.Get<ValuedInfo>().Description
|
? actor.Info.Traits.Get<ValuedInfo>().Description
|
||||||
: actor.Info.Name;
|
: actor.Info.Name;
|
||||||
var text2 = (actor.Owner == world.LocalPlayer)
|
var text2 = (actor.Owner.NonCombatant)
|
||||||
? "" : (actor.Owner.NonCombatant ? "{0}" : "{0} ({1})").F(actor.Owner.PlayerName, world.LocalPlayer.Stances[actor.Owner]);
|
? "" : "{0}".F(actor.Owner.PlayerName);
|
||||||
|
var text3 = (actor.Owner == world.LocalPlayer || actor.Owner.NonCombatant)
|
||||||
|
? "" : " ({0})".F(world.LocalPlayer.Stances[actor.Owner]);
|
||||||
var renderer = Game.chrome.renderer;
|
var renderer = Game.chrome.renderer;
|
||||||
|
|
||||||
var sz = renderer.BoldFont.Measure(text);
|
var sz = renderer.BoldFont.Measure(text);
|
||||||
var sz2 = renderer.RegularFont.Measure(text2);
|
var sz2 = renderer.RegularFont.Measure(text2);
|
||||||
|
var sz3 = renderer.RegularFont.Measure(text3);
|
||||||
sz.X = Math.Max(sz.X, sz2.X);
|
|
||||||
|
sz.X = Math.Max(sz.X, sz2.X + sz3.X + 35);
|
||||||
|
|
||||||
if (text2 != "") sz.Y += sz2.Y + 2;
|
if (text2 != "") sz.Y += sz2.Y + 2;
|
||||||
|
|
||||||
@@ -68,9 +71,18 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
renderer.BoldFont.DrawText(text,
|
renderer.BoldFont.DrawText(text,
|
||||||
new float2(Game.chrome.lastMousePos.X + 30, Game.chrome.lastMousePos.Y + 30), Color.White);
|
new float2(Game.chrome.lastMousePos.X + 30, Game.chrome.lastMousePos.Y + 30), Color.White);
|
||||||
renderer.RegularFont.DrawText(text2,
|
|
||||||
new float2(Game.chrome.lastMousePos.X + 30, Game.chrome.lastMousePos.Y + 50), Color.White);
|
if (text2 != "")
|
||||||
|
{
|
||||||
|
renderer.RegularFont.DrawText(text2,
|
||||||
|
new float2(Game.chrome.lastMousePos.X + 65, Game.chrome.lastMousePos.Y + 50), actor.Owner.Color);
|
||||||
|
|
||||||
|
renderer.RegularFont.DrawText(text3,
|
||||||
|
new float2(Game.chrome.lastMousePos.X + 65 + sz2.X, Game.chrome.lastMousePos.Y + 50), Color.White);
|
||||||
|
|
||||||
|
WidgetUtils.DrawRGBA(ChromeProvider.GetImage(Game.chrome.renderer, "flags", actor.Owner.Country.Race), new float2(Game.chrome.lastMousePos.X + 30, Game.chrome.lastMousePos.Y + 50));
|
||||||
|
}
|
||||||
|
|
||||||
renderer.RgbaSpriteRenderer.Flush();
|
renderer.RgbaSpriteRenderer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -197,15 +197,15 @@
|
|||||||
<image name="disabled" x="68" y="56" width="34" height="28" />
|
<image name="disabled" x="68" y="56" width="34" height="28" />
|
||||||
</collection>
|
</collection>
|
||||||
<collection name="flags" src="buttons.png">
|
<collection name="flags" src="buttons.png">
|
||||||
<image name="GDI" x="30" y="84" width="30" height="15" />
|
<image name="gdi" x="30" y="84" width="30" height="15" />
|
||||||
<image name="Nod" x="0" y="84" width="30" height="15" />
|
<image name="nod" x="0" y="84" width="30" height="15" />
|
||||||
<image name="Random" x="60" y="84" width="30" height="15" />
|
<image name="Random" x="60" y="84" width="30" height="15" />
|
||||||
</collection>
|
</collection>
|
||||||
<collection name="music" src="musicplayer.png">
|
<collection name="music" src="musicplayer.png">
|
||||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||||
<image name="stop" x="28" y="0" width="25" height="25" />
|
<image name="stop" x="28" y="0" width="25" height="25" />
|
||||||
<image name="play" x="56" y="0" width="25" height="25" />
|
<image name="play" x="56" y="0" width="25" height="25" />
|
||||||
<image name="next" x="84" y="0" width="25" height="25" />
|
<image name="next" x="84" y="0" width="25" height="25" />
|
||||||
<image name="prev" x="112" y="0" width="25" height="25" />
|
<image name="prev" x="112" y="0" width="25" height="25" />
|
||||||
</collection>
|
</collection>
|
||||||
</chrome>
|
</chrome>
|
||||||
|
|||||||
@@ -188,17 +188,17 @@
|
|||||||
<image name="normal" x="0" y="56" width="34" height="28" />
|
<image name="normal" x="0" y="56" width="34" height="28" />
|
||||||
<image name="pressed" x="34" y="56" width="34" height="28" />
|
<image name="pressed" x="34" y="56" width="34" height="28" />
|
||||||
<image name="disabled" x="68" y="56" width="34" height="28" />
|
<image name="disabled" x="68" y="56" width="34" height="28" />
|
||||||
</collection>
|
</collection>
|
||||||
<collection name="flags" src="buttons.png">
|
<collection name="flags" src="buttons.png">
|
||||||
<image name="Allies" x="30" y="84" width="30" height="15" />
|
<image name="allies" x="30" y="84" width="30" height="15" />
|
||||||
<image name="Soviet" x="0" y="84" width="30" height="15" />
|
<image name="soviet" x="0" y="84" width="30" height="15" />
|
||||||
<image name="Random" x="60" y="84" width="30" height="15" />
|
<image name="Random" x="60" y="84" width="30" height="15" />
|
||||||
</collection>
|
</collection>
|
||||||
<collection name="music" src="musicplayer.png">
|
<collection name="music" src="musicplayer.png">
|
||||||
<image name="pause" x="0" y="0" width="25" height="25" />
|
<image name="pause" x="0" y="0" width="25" height="25" />
|
||||||
<image name="stop" x="28" y="0" width="25" height="25" />
|
<image name="stop" x="28" y="0" width="25" height="25" />
|
||||||
<image name="play" x="56" y="0" width="25" height="25" />
|
<image name="play" x="56" y="0" width="25" height="25" />
|
||||||
<image name="next" x="84" y="0" width="25" height="25" />
|
<image name="next" x="84" y="0" width="25" height="25" />
|
||||||
<image name="prev" x="112" y="0" width="25" height="25" />
|
<image name="prev" x="112" y="0" width="25" height="25" />
|
||||||
</collection>
|
</collection>
|
||||||
</chrome>
|
</chrome>
|
||||||
|
|||||||
Reference in New Issue
Block a user