Lobby is made up of a few more widgets

This commit is contained in:
alzeih
2010-04-23 19:58:56 +12:00
parent 6249bbd897
commit 38c608b5f6
4 changed files with 92 additions and 31 deletions

View File

@@ -229,24 +229,7 @@ namespace OpenRA
var w = 800;
var h = 600;
var r = new Rectangle( (Game.viewport.Width - w) / 2, (Game.viewport.Height - h) / 2, w, h );
if (Game.IsHost)
{
AddUiButton(new int2(r.Right - 100, r.Top + 300), "Change Map",
_ =>
{
currentMap = Game.AvailableMaps[ Game.LobbyInfo.GlobalSettings.Map ];
rootWidget.OpenWindow( "MAP_CHOOSER" );
});
}
var f = renderer.BoldFont;
f.DrawText("Name", new int2(r.Left + 40, r.Top + 50), Color.White);
f.DrawText("Color", new int2(r.Left + 140, r.Top + 50), Color.White);
f.DrawText("Faction", new int2(r.Left + 220, r.Top + 50), Color.White);
f.DrawText("Status", new int2(r.Left + 290, r.Top + 50), Color.White);
f.DrawText("Spawn", new int2(r.Left + 390, r.Top + 50), Color.White);
f.DrawText("Team", new int2(r.Left + 470, r.Top + 50), Color.White);
rgbaRenderer.Flush();
@@ -265,21 +248,21 @@ namespace OpenRA
DrawDialogBackground(paletteRect, "dialog3");
AddButton(paletteRect, CyclePalette);
var raceRect = new Rectangle(r.Left + 210, y - 2, 65, 22);
DrawDialogBackground(raceRect, "dialog3");
AddButton(raceRect, CycleRace);
var factionRect = new Rectangle(r.Left + 210, y - 2, 90, 22);
DrawDialogBackground(factionRect, "dialog3");
AddButton(factionRect, CycleRace);
var readyRect = new Rectangle(r.Left + 280, y - 2, 95, 22);
DrawDialogBackground(readyRect, "dialog3");
AddButton(readyRect, CycleReady);
var spawnPointRect = new Rectangle(r.Left + 380, y - 2, 70, 22);
var spawnPointRect = new Rectangle(r.Left + 305, y - 2, 70, 22);
DrawDialogBackground(spawnPointRect, "dialog3");
AddButton(spawnPointRect, CycleSpawnPoint);
var teamRect = new Rectangle(r.Left + 460, y - 2, 70, 22);
var teamRect = new Rectangle(r.Left + 385, y - 2, 70, 22);
DrawDialogBackground(teamRect, "dialog3");
AddButton(teamRect, CycleTeam);
var readyRect = new Rectangle(r.Left + 465, y - 2, 50, 22);
DrawDialogBackground(readyRect, "dialog3");
AddButton(readyRect, CycleReady);
}
shpRenderer.Flush();
@@ -293,12 +276,13 @@ namespace OpenRA
Player.PlayerColors(Game.world)[client.PaletteIndex % Player.PlayerColors(Game.world).Count()].c);
lineRenderer.Flush();
f.DrawText(client.Country, new int2(r.Left + 220, y), Color.White);
f.DrawText(client.State.ToString(), new int2(r.Left + 290, y), Color.White);
f.DrawText((client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 410, y), Color.White);
f.DrawText((client.Team == 0)? "-" : client.Team.ToString(), new int2(r.Left + 490, y), Color.White);
f.DrawText((client.SpawnPoint == 0) ? "-" : client.SpawnPoint.ToString(), new int2(r.Left + 315 + 20, y), Color.White);
f.DrawText((client.Team == 0)? "-" : client.Team.ToString(), new int2(r.Left + 395 + 20, y), Color.White);
f.DrawText(client.State.ToString(), new int2(r.Left + 475, y), Color.White);
y += 30;
rgbaRenderer.Flush();
}
var typingBox = new Rectangle(r.Left + 20, r.Bottom - 47, r.Width - 40, 27);
@@ -311,6 +295,8 @@ namespace OpenRA
// block clicks `through` the dialog
AddButton(r, _ => { });
}
void AddButton(RectangleF r, Action<bool> b) { buttons.Add(Pair.New(r, b)); }

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -308,6 +308,7 @@
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
<Compile Include="Widgets\BuildPaletteWidget.cs" />
<Compile Include="Traits\World\BridgeLayer.cs" />
<Compile Include="Widgets\Delegates\LobbyDelegate.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -0,0 +1,20 @@
using System;
namespace OpenRA.Widgets.Delegates
{
public class LobbyDelegate : IWidgetDelegate
{
public LobbyDelegate ()
{
var r = Chrome.rootWidget;
var lobby = r.GetWidget("SERVER_LOBBY");
var mapButton = lobby.GetWidget("CHANGEMAP_BUTTON");
mapButton.OnMouseUp = mi => {
r.OpenWindow("MAP_CHOOSER");
return true;
};
mapButton.IsVisible = () => {return (mapButton.Visible && Game.IsHost);};
}
}
}

View File

@@ -262,6 +262,7 @@ Container:
Text:Abort
Background@SERVER_LOBBY:
Id:SERVER_LOBBY
Delegate:LobbyDelegate
X:(WINDOW_RIGHT - WIDTH)/2
Y:(WINDOW_BOTTOM - HEIGHT)/2
Width:800
@@ -287,6 +288,56 @@ Container:
Y:4
Width:244
Height:244
Button@CHANGEMAP_BUTTON:
Id:CHANGEMAP_BUTTON
Visible:true
X:PARENT_RIGHT-140
Y:300
Width:120
Height:25
Text:Change Map
Label@LABEL_LOBBY_NAME:
Id:LABEL_LOBBY_NAME
X:40
Y:50
Width:250
Height:25
Text:Name
Label@LABEL_LOBBY_COLOR:
Id:LABEL_LOBBY_COLOR
X:140
Y:50
Width:250
Height:25
Text:Color
Label@LABEL_LOBBY_FACTION
Id:LABEL_LOBBY_FACTION
X:220
Y:50
Width:250
Height:25
Text:Faction
Label@LABEL_LOBBY_SPAWN
Id:LABEL_LOBBY_SPAWN
X:315
Y:50
Width:250
Height:25
Text:Spawn
Label@LABEL_LOBBY_TEAM
Id:LABEL_LOBBY_TEAM
X:395
Y:50
Width:250
Height:25
Text:Team
Label@LABEL_LOBBY_STATUS
Id:LABEL_LOBBY_STATUS
X:475
Y:50
Width:250
Height:25
Text:Status
Background@MAP_CHOOSER:
Id:MAP_CHOOSER
X:(WINDOW_RIGHT - WIDTH)/2
@@ -463,3 +514,6 @@ Container:
Width:25
Height:25
Text:[]