From 9c7759d131bb9d4a2f1ab2126be3555834925871 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 28 Nov 2010 14:13:38 +1300 Subject: [PATCH] More polish. --- .../Widgets/Delegates/LobbyDelegate.cs | 22 +++-- mods/ra/chrome/gamelobby.yaml | 91 +++++++++++-------- 2 files changed, 67 insertions(+), 46 deletions(-) diff --git a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs index 6a6deaa56b..4599e33f16 100755 --- a/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs +++ b/OpenRA.Mods.RA/Widgets/Delegates/LobbyDelegate.cs @@ -335,17 +335,16 @@ namespace OpenRA.Widgets.Delegates { template = EmptySlotTemplateHost.Clone(); var name = template.GetWidget("NAME"); - var btn = template.GetWidget("JOIN"); - btn.GetText = () => "Spectate in this slot"; name.GetText = () => s.Closed ? "Closed" : "Open"; name.OnMouseDown = _ => ShowSlotDropDown(s, name, false); - + var btn = template.GetWidget("JOIN"); + btn.GetText = () => "Spectate in this slot"; } else { template = EmptySlotTemplateHost.Clone(); var name = template.GetWidget("NAME"); - name.GetText = () => s.Closed ? "Closed" : (s.Bot == null) ? "Open" : "Bot: " + s.Bot; + name.GetText = () => s.Closed ? "Closed" : (s.Bot == null) ? "Open" : s.Bot; name.OnMouseDown = _ => ShowSlotDropDown(s, name, Map.Players[ s.MapPlayer ].AllowBots); } } @@ -353,7 +352,7 @@ namespace OpenRA.Widgets.Delegates { template = EmptySlotTemplate.Clone(); var name = template.GetWidget("NAME"); - name.GetText = () => s.Closed ? "Closed" : (s.Bot == null) ? "Open" : "Bot: " + s.Bot; + name.GetText = () => s.Closed ? "Closed" : (s.Bot == null) ? "Open" : s.Bot; if (slot.Spectator) { @@ -368,6 +367,10 @@ namespace OpenRA.Widgets.Delegates join.OnMouseUp = _ => { orderManager.IssueOrder(Order.Command("slot " + s.Index)); return true; }; join.IsVisible = () => !s.Closed && s.Bot == null; } + + var bot = template.GetWidget("BOT"); + if (bot != null) + bot.IsVisible = () => s.Bot != null; } else if (c.Index == orderManager.LocalClient.Index && c.State != Session.ClientState.Ready) { @@ -413,7 +416,9 @@ namespace OpenRA.Widgets.Delegates var status = template.GetWidget("STATUS"); status.Checked = () => c.State == Session.ClientState.Ready; status.OnMouseDown = CycleReady; - + + var spectator = template.GetWidget("SPECTATOR"); + Session.Slot slot1 = slot; color.IsVisible = () => !slot1.Spectator; colorBlock.IsVisible = () => !slot1.Spectator; @@ -421,6 +426,7 @@ namespace OpenRA.Widgets.Delegates factionname.IsVisible = () => !slot1.Spectator; factionflag.IsVisible = () => !slot1.Spectator; team.IsVisible = () => !slot1.Spectator; + spectator.IsVisible = () => slot1.Spectator || slot1.Bot != null; } else { @@ -443,7 +449,8 @@ namespace OpenRA.Widgets.Delegates status.Checked = () => c.State == Session.ClientState.Ready; if (c.Index == orderManager.LocalClient.Index) status.OnMouseDown = CycleReady; - + var spectator = template.GetWidget("SPECTATOR"); + Session.Slot slot1 = slot; color.IsVisible = () => !slot1.Spectator; //colorBlock.IsVisible = () => !slot1.Spectator; @@ -451,6 +458,7 @@ namespace OpenRA.Widgets.Delegates factionname.IsVisible = () => !slot1.Spectator; factionflag.IsVisible = () => !slot1.Spectator; team.IsVisible = () => !slot1.Spectator; + spectator.IsVisible = () => slot1.Spectator || slot1.Bot != null; } template.Id = "SLOT_{0}".F(s.Index); diff --git a/mods/ra/chrome/gamelobby.yaml b/mods/ra/chrome/gamelobby.yaml index 81c907ea1d..28d29536e9 100644 --- a/mods/ra/chrome/gamelobby.yaml +++ b/mods/ra/chrome/gamelobby.yaml @@ -105,32 +105,41 @@ Background@SERVER_LOBBY: Y:2 Width:20 Height:20 + Label@SPECTATOR: + Id:SPECTATOR + Text:Spectator + Width:278 + Height:25 + X:160 + Y:0 + Align:Center + Bold:True Container@TEMPLATE_REMOTE: Id:TEMPLATE_REMOTE X:0 Y:0 - Width:400 + Width:475 Height:30 Visible:false Children: Label@NAME: Id:NAME Text:Name - Width:150 + Width:145 Height:25 - X:0 - Y:0 + X:5 + Y:0-1 ColorBlock@COLOR: Id:COLOR - X:164 - Y:7 - Width:55 + X:165 + Y:6 + Width:45 Height:13 Label@FACTION: Id:FACTION - Width:110 + Width:130 Height:25 - X:244 + X:250 Y:0 Children: Image@FACTIONFLAG: @@ -149,62 +158,57 @@ Background@SERVER_LOBBY: Label@TEAM: Id:TEAM Text:Team - Width:70 + Width:23 Height:25 - X:351 - Y:0 Align:Center - Bold: false + X:390 + Y:0 Checkbox@STATUS: Id:STATUS - X:450 + X:448 Y:2 Width:20 Height:20 - Container@TEMPLATE_EMPTY_SPECTATOR: - Id:TEMPLATE_EMPTY_SPECTATOR - X:0 - Y:0 - Width:400 - Height:30 - Visible:false - Children: - Button@NAME: - Id:NAME - Text:Name - Width:150 - Height:25 - X:0 - Y:0 - Button@JOIN: - Id:JOIN - Text:Spectate this match - Width:PARENT_RIGHT - 90 + Label@SPECTATOR: + Id:SPECTATOR + Text:Spectator + Width:278 Height:25 X:160 Y:0 + Align:Center + Bold:True Container@TEMPLATE_EMPTY: Id:TEMPLATE_EMPTY X:0 Y:0 - Width:400 + Width:475 Height:30 Visible:false Children: Label@NAME: Id:NAME Text:Name - Width:150 + Width:145 Height:25 - X:0 - Y:0 + X:5 + Y:0-1 Button@JOIN: Id:JOIN Text:Play in this slot - Width:PARENT_RIGHT - 90 + Width:278 Height:25 X:160 Y:0 + Label@BOT: + Id:BOT + Text:Bot + Width:278 + Height:25 + X:160 + Y:0 + Align:Center + Bold:True Container@TEMPLATE_EMPTY_HOST: Id:TEMPLATE_EMPTY_HOST X:0 @@ -223,10 +227,19 @@ Background@SERVER_LOBBY: Button@JOIN: Id:JOIN Text:Play in this slot - Width:PARENT_RIGHT - 90 + Width:278 Height:25 X:160 Y:0 + Label@BOT: + Id:BOT + Text:Bot + Width:278 + Height:25 + X:160 + Y:0 + Align:Center + Bold:True Container@LABEL_CONTAINER: X:25 Y:40