More polish.

This commit is contained in:
Paul Chote
2010-11-28 14:13:38 +13:00
parent 4bb70f11e9
commit 9c7759d131
2 changed files with 67 additions and 46 deletions

View File

@@ -335,17 +335,16 @@ namespace OpenRA.Widgets.Delegates
{
template = EmptySlotTemplateHost.Clone();
var name = template.GetWidget<ButtonWidget>("NAME");
var btn = template.GetWidget<ButtonWidget>("JOIN");
btn.GetText = () => "Spectate in this slot";
name.GetText = () => s.Closed ? "Closed" : "Open";
name.OnMouseDown = _ => ShowSlotDropDown(s, name, false);
var btn = template.GetWidget<ButtonWidget>("JOIN");
btn.GetText = () => "Spectate in this slot";
}
else
{
template = EmptySlotTemplateHost.Clone();
var name = template.GetWidget<ButtonWidget>("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<LabelWidget>("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<LabelWidget>("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<CheckboxWidget>("STATUS");
status.Checked = () => c.State == Session.ClientState.Ready;
status.OnMouseDown = CycleReady;
var spectator = template.GetWidget<LabelWidget>("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<LabelWidget>("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);

View File

@@ -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