Use Tuple syntax

This commit is contained in:
teinarss
2020-08-02 13:41:03 +02:00
committed by Paul Chote
parent 8a74f6ea18
commit 19b02875c7
90 changed files with 738 additions and 826 deletions

View File

@@ -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));
};
}
}