#540 move 'allow cheats' to lobby from prelobby

This commit is contained in:
Chris Forbes
2011-02-13 17:28:40 +13:00
parent 447b34ab38
commit 0f0facedd1
9 changed files with 40 additions and 20 deletions

View File

@@ -226,6 +226,19 @@ namespace OpenRA.Mods.RA.Server
server.SyncLobbyInfo();
return true;
}},
{ "allowcheats",
s =>
{
if (conn.PlayerIndex != 0)
{
server.SendChatTo( conn, "Only the host can set that option" );
return true;
}
bool.TryParse(s, out server.lobbyInfo.GlobalSettings.AllowCheats);
server.SyncLobbyInfo();
return true;
}},
{ "kick",
s =>
{

View File

@@ -43,8 +43,6 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
cs.GetWidget<TextFieldWidget>("EXTERNAL_PORT").Text = settings.Server.ExternalPort.ToString();
cs.GetWidget<CheckboxWidget>("CHECKBOX_ONLINE").Bind(settings.Server, "AdvertiseOnline");
cs.GetWidget<CheckboxWidget>("CHECKBOX_ONLINE").OnChange += _ => settings.Save();
cs.GetWidget<CheckboxWidget>("CHECKBOX_CHEATS").Bind(settings.Server, "AllowCheats");
cs.GetWidget<CheckboxWidget>("CHECKBOX_CHEATS").OnChange += _ => settings.Save();
}
}
}

View File

@@ -52,7 +52,8 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
var lobby = Game.OpenWindow(orderManager.world, "SERVER_LOBBY");
lobby.GetWidget<ChatDisplayWidget>("CHAT_DISPLAY").ClearChat();
lobby.GetWidget("CHANGEMAP_BUTTON").Visible = true;
lobby.GetWidget("LOCKTEAMS_CHECKBOX").Visible = true;
lobby.GetWidget("LOCKTEAMS_CHECKBOX").Visible = true;
lobby.GetWidget("ALLOWCHEATS_CHECKBOX").Visible = true;
lobby.GetWidget("DISCONNECT_BUTTON").Visible = true;
break;
}

View File

@@ -112,6 +112,15 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
if (Game.IsHost)
orderManager.IssueOrder(Order.Command(
"lockteams {0}".F(!orderManager.LobbyInfo.GlobalSettings.LockTeams)));
};
var allowCheats = lobby.GetWidget<CheckboxWidget>("ALLOWCHEATS_CHECKBOX");
allowCheats.IsChecked = () => orderManager.LobbyInfo.GlobalSettings.AllowCheats;
allowCheats.OnChange += _ =>
{
if (Game.IsHost)
orderManager.IssueOrder(Order.Command(
"allowcheats {0}".F(!orderManager.LobbyInfo.GlobalSettings.AllowCheats)));
};
var startGameButton = lobby.GetWidget("START_GAME_BUTTON");