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 System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits;
using OpenRA.Widgets; using OpenRA.Widgets;
namespace OpenRA namespace OpenRA

View File

@@ -398,6 +398,19 @@ namespace OpenRA.Server
SyncLobbyInfo(); SyncLobbyInfo();
return true; 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(); var cmdName = cmd.Split(' ').First();

View File

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

View File

@@ -16,12 +16,12 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>. * along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
*/ */
#endregion #endregion
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Drawing;
using System.Drawing; using System.Linq;
using OpenRA.FileFormats; using OpenRA.FileFormats;
namespace OpenRA.Widgets.Delegates namespace OpenRA.Widgets.Delegates
@@ -54,7 +54,19 @@ namespace OpenRA.Widgets.Delegates
disconnectButton.OnMouseUp = mi => { disconnectButton.OnMouseUp = mi => {
Game.Disconnect(); Game.Disconnect();
return true; 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; Game.LobbyInfoChanged += UpdatePlayerList;
} }

View File

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