Use Tuple syntax
This commit is contained in:
@@ -337,19 +337,19 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
{
|
||||
var client = p.World.LobbyInfo.ClientWithIndex(p.ClientIndex);
|
||||
var nameFont = Game.Renderer.Fonts[label.Font];
|
||||
var name = new CachedTransform<Tuple<string, WinState, Session.ClientState>, string>(c =>
|
||||
var name = new CachedTransform<(string Name, WinState WinState, Session.ClientState ClientState), string>(c =>
|
||||
{
|
||||
var suffix = c.Item2 == WinState.Undefined ? "" : " (" + c.Item2 + ")";
|
||||
if (c.Item3 == Session.ClientState.Disconnected)
|
||||
var suffix = c.WinState == WinState.Undefined ? "" : " (" + c.Item2 + ")";
|
||||
if (c.ClientState == Session.ClientState.Disconnected)
|
||||
suffix = " (Gone)";
|
||||
|
||||
return TruncateText(c.Item1, label.Bounds.Width - nameFont.Measure(suffix).X, nameFont) + suffix;
|
||||
return TruncateText(c.Name, label.Bounds.Width - nameFont.Measure(suffix).X, nameFont) + suffix;
|
||||
});
|
||||
|
||||
label.GetText = () =>
|
||||
{
|
||||
var clientState = client != null ? client.State : Session.ClientState.Ready;
|
||||
return name.Update(Tuple.Create(p.PlayerName, p.WinState, clientState));
|
||||
return name.Update((p.PlayerName, p.WinState, clientState));
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user