make it work

This commit is contained in:
Chris Forbes
2010-07-10 15:54:09 +12:00
parent 2169f32a79
commit a372ba2080
5 changed files with 33 additions and 9 deletions

View File

@@ -24,7 +24,6 @@ using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Widgets;
namespace OpenRA

View File

@@ -398,6 +398,19 @@ namespace OpenRA.Server
SyncLobbyInfo();
return true;
}},
{ "lockteams",
s =>
{
if (conn.PlayerIndex != 0)
{
SendChatTo( conn, "Only the host can set that option" );
return true;
}
bool.TryParse(s, out lobbyInfo.GlobalSettings.LockTeams);
SyncLobbyInfo();
return true;
}},
};
var cmdName = cmd.Split(' ').First();

View File

@@ -18,8 +18,8 @@
*/
#endregion
using System.Drawing;
using System;
using System.Drawing;
namespace OpenRA.Widgets
{

View File

@@ -16,12 +16,12 @@
* You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
#endregion
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using OpenRA.FileFormats;
namespace OpenRA.Widgets.Delegates
@@ -54,7 +54,19 @@ namespace OpenRA.Widgets.Delegates
disconnectButton.OnMouseUp = mi => {
Game.Disconnect();
return true;
};
var lockTeamsCheckbox = lobby.GetWidget("LOCKTEAMS_CHECKBOX") as CheckboxWidget;
lockTeamsCheckbox.IsVisible = () => true;
lockTeamsCheckbox.Checked = () => Game.LobbyInfo.GlobalSettings.LockTeams;
lockTeamsCheckbox.OnMouseDown = mi =>
{
if (Game.IsHost)
Game.IssueOrder(Order.Chat(
"/lockteams {0}".F(!Game.LobbyInfo.GlobalSettings.LockTeams)));
return true;
};
Game.LobbyInfoChanged += UpdatePlayerList;
}

View File

@@ -496,7 +496,7 @@ Container:
Visible: true
X: PARENT_RIGHT-300
Y: PARENT_BOTTOM-38
Width: 100
Width: 80
Height: 20
Text: Lock Teams
Button@DISCONNECT_BUTTON: