start of clicking on spawn points, compile fail still

This commit is contained in:
alzeih
2010-06-13 15:46:09 +12:00
committed by Chris Forbes
parent 6774486027
commit d2da37f026

View File

@@ -22,6 +22,30 @@ namespace OpenRA.Widgets
{
lastMap = (other as MapPreviewWidget).lastMap;
}
public override bool HandleInput(MouseInput mi)
{
var points = Game.chrome.currentMap.Waypoints
.Select((sp, i) => Pair.New(sp, Game.LobbyInfo.Clients.FirstOrDefault(
c => c.SpawnPoint == i + 1)))
.ToList();
var container = new Rectangle(DrawPosition().X, DrawPosition().Y, Parent.Bounds.Width, Parent.Bounds.Height );
foreach(var p in points)
{
var pos = Game.chrome.currentMap.ConvertToPreview(p.First.Value, container);
//todo: check within bounds
if (mi.Location.Equals(pos) && p.Second == null)
{
Game.LobbyInfo.Clients[Game.LocalClient.Index].SpawnPoint =
Game.chrome.currentMap.Waypoints.Keys.ToList().IndexOf(p.First.Value) + 1;
return true;
}
}
return false;
}
public override Widget Clone() { return new MapPreviewWidget(this); }