Lobby is made up of a few more widgets
This commit is contained in:
@@ -229,24 +229,7 @@ namespace OpenRA
|
|||||||
var w = 800;
|
var w = 800;
|
||||||
var h = 600;
|
var h = 600;
|
||||||
var r = new Rectangle( (Game.viewport.Width - w) / 2, (Game.viewport.Height - h) / 2, w, h );
|
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;
|
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();
|
rgbaRenderer.Flush();
|
||||||
|
|
||||||
@@ -265,21 +248,21 @@ namespace OpenRA
|
|||||||
DrawDialogBackground(paletteRect, "dialog3");
|
DrawDialogBackground(paletteRect, "dialog3");
|
||||||
AddButton(paletteRect, CyclePalette);
|
AddButton(paletteRect, CyclePalette);
|
||||||
|
|
||||||
var raceRect = new Rectangle(r.Left + 210, y - 2, 65, 22);
|
var factionRect = new Rectangle(r.Left + 210, y - 2, 90, 22);
|
||||||
DrawDialogBackground(raceRect, "dialog3");
|
DrawDialogBackground(factionRect, "dialog3");
|
||||||
AddButton(raceRect, CycleRace);
|
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");
|
DrawDialogBackground(spawnPointRect, "dialog3");
|
||||||
AddButton(spawnPointRect, CycleSpawnPoint);
|
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");
|
DrawDialogBackground(teamRect, "dialog3");
|
||||||
AddButton(teamRect, CycleTeam);
|
AddButton(teamRect, CycleTeam);
|
||||||
|
|
||||||
|
var readyRect = new Rectangle(r.Left + 465, y - 2, 50, 22);
|
||||||
|
DrawDialogBackground(readyRect, "dialog3");
|
||||||
|
AddButton(readyRect, CycleReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
shpRenderer.Flush();
|
shpRenderer.Flush();
|
||||||
@@ -293,12 +276,13 @@ namespace OpenRA
|
|||||||
Player.PlayerColors(Game.world)[client.PaletteIndex % Player.PlayerColors(Game.world).Count()].c);
|
Player.PlayerColors(Game.world)[client.PaletteIndex % Player.PlayerColors(Game.world).Count()].c);
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
f.DrawText(client.Country, new int2(r.Left + 220, y), Color.White);
|
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 + 315 + 20, 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 + 395 + 20, y), Color.White);
|
||||||
f.DrawText((client.Team == 0)? "-" : client.Team.ToString(), new int2(r.Left + 490, y), Color.White);
|
f.DrawText(client.State.ToString(), new int2(r.Left + 475, y), Color.White);
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
rgbaRenderer.Flush();
|
rgbaRenderer.Flush();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var typingBox = new Rectangle(r.Left + 20, r.Bottom - 47, r.Width - 40, 27);
|
var typingBox = new Rectangle(r.Left + 20, r.Bottom - 47, r.Width - 40, 27);
|
||||||
@@ -308,9 +292,11 @@ namespace OpenRA
|
|||||||
DrawDialogBackground(chatBox, "dialog3");
|
DrawDialogBackground(chatBox, "dialog3");
|
||||||
|
|
||||||
DrawChat(typingBox, chatBox);
|
DrawChat(typingBox, chatBox);
|
||||||
|
|
||||||
// block clicks `through` the dialog
|
// block clicks `through` the dialog
|
||||||
AddButton(r, _ => { });
|
AddButton(r, _ => { });
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddButton(RectangleF r, Action<bool> b) { buttons.Add(Pair.New(r, b)); }
|
void AddButton(RectangleF r, Action<bool> b) { buttons.Add(Pair.New(r, b)); }
|
||||||
|
|||||||
@@ -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">
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
@@ -308,6 +308,7 @@
|
|||||||
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
|
<Compile Include="Widgets\Delegates\PerfDebugDelegate.cs" />
|
||||||
<Compile Include="Widgets\BuildPaletteWidget.cs" />
|
<Compile Include="Widgets\BuildPaletteWidget.cs" />
|
||||||
<Compile Include="Traits\World\BridgeLayer.cs" />
|
<Compile Include="Traits\World\BridgeLayer.cs" />
|
||||||
|
<Compile Include="Widgets\Delegates\LobbyDelegate.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">
|
||||||
|
|||||||
20
OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs
Normal file
20
OpenRA.Game/Widgets/Delegates/LobbyDelegate.cs
Normal 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);};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -262,6 +262,7 @@ Container:
|
|||||||
Text:Abort
|
Text:Abort
|
||||||
Background@SERVER_LOBBY:
|
Background@SERVER_LOBBY:
|
||||||
Id:SERVER_LOBBY
|
Id:SERVER_LOBBY
|
||||||
|
Delegate:LobbyDelegate
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
Y:(WINDOW_BOTTOM - HEIGHT)/2
|
||||||
Width:800
|
Width:800
|
||||||
@@ -287,6 +288,56 @@ Container:
|
|||||||
Y:4
|
Y:4
|
||||||
Width:244
|
Width:244
|
||||||
Height: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:
|
Background@MAP_CHOOSER:
|
||||||
Id:MAP_CHOOSER
|
Id:MAP_CHOOSER
|
||||||
X:(WINDOW_RIGHT - WIDTH)/2
|
X:(WINDOW_RIGHT - WIDTH)/2
|
||||||
@@ -463,3 +514,6 @@ Container:
|
|||||||
Width:25
|
Width:25
|
||||||
Height:25
|
Height:25
|
||||||
Text:[]
|
Text:[]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user