diff --git a/OpenRa.Game/Animation.cs b/OpenRa.Game/Animation.cs index b414f7829a..ee2a505b5d 100644 --- a/OpenRa.Game/Animation.cs +++ b/OpenRa.Game/Animation.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Text; using System.Windows.Forms; -using IjwFramework.Delegates; namespace OpenRa.Game { @@ -23,40 +22,37 @@ namespace OpenRa.Game public void Play( string sequenceName ) { - PlayThen( sequenceName, delegate { } ); + PlayThen(sequenceName, () => { }); } public void PlayRepeating( string sequenceName ) { - PlayThen( sequenceName, delegate { PlayRepeating( sequenceName ); } ); + PlayThen( sequenceName, () => PlayRepeating( sequenceName ) ); } - public void PlayThen( string sequenceName, MethodInvoker after ) + public void PlayThen( string sequenceName, Action after ) { tickAlways = false; currentSequence = SequenceProvider.GetSequence( name, sequenceName ); frame = 0; - tickFunc = delegate + tickFunc = _ => { ++frame; if( frame >= currentSequence.Length ) { frame = currentSequence.Length - 1; - tickFunc = delegate { }; + tickFunc = t => { }; after(); } }; } - public void PlayFetchIndex( string sequenceName, Provider func ) + public void PlayFetchIndex( string sequenceName, Func func ) { tickAlways = true; currentSequence = SequenceProvider.GetSequence( name, sequenceName ); frame = func(); - tickFunc = delegate - { - frame = func(); - }; + tickFunc = t => frame = func(); } int timeUntilNextFrame; diff --git a/OpenRa.Game/Building.cs b/OpenRa.Game/Building.cs index 7dbf501924..de524c6f96 100644 --- a/OpenRa.Game/Building.cs +++ b/OpenRa.Game/Building.cs @@ -11,7 +11,7 @@ namespace OpenRa.Game { this.owner = owner; - animation.PlayThen( "make", delegate { animation.PlayRepeating( "idle" ); } ); + animation.PlayThen( "make", () => animation.PlayRepeating( "idle" ) ); owner.TechTree.Build( name, true ); } diff --git a/OpenRa.Game/ConstructionYard.cs b/OpenRa.Game/ConstructionYard.cs index c6e6e9c45f..dd1e5f4078 100644 --- a/OpenRa.Game/ConstructionYard.cs +++ b/OpenRa.Game/ConstructionYard.cs @@ -10,7 +10,7 @@ namespace OpenRa.Game public ConstructionYard( int2 location, Player owner, Game game ) : base( "fact", location, owner, game ) { - animation.PlayThen( "make", delegate { animation.PlayRepeating( "build" ); } ); + animation.PlayThen("make", () => animation.PlayRepeating("build")); } } } diff --git a/OpenRa.Game/Game.cs b/OpenRa.Game/Game.cs index 83f6d25db8..2926879fbd 100644 --- a/OpenRa.Game/Game.cs +++ b/OpenRa.Game/Game.cs @@ -4,7 +4,6 @@ using System.Text; using OpenRa.FileFormats; using System.Drawing; -using IjwFramework.Delegates; namespace OpenRa.Game { @@ -23,12 +22,12 @@ namespace OpenRa.Game public readonly Dictionary players = new Dictionary(); // temporary, until we remove all the subclasses of Building - public Dictionary> buildingCreation = new Dictionary>(); + public Dictionary> buildingCreation = new Dictionary>(); public Game(string mapName, Renderer renderer, int2 clientSize) { - for( int i = 0 ; i < 8 ; i++ ) - players.Add( i, new Player( i, string.Format( "Multi{0}", i ), OpenRa.TechTree.Race.Soviet ) ); + for (int i = 0; i < 8; i++) + players.Add(i, new Player(i, string.Format("Multi{0}", i), OpenRa.TechTree.Race.Soviet)); map = new Map(new IniFile(FileSystem.Open(mapName))); FileSystem.Mount(new Package(map.Theater + ".mix")); @@ -46,29 +45,17 @@ namespace OpenRa.Game network = new Network(); - buildingCreation.Add( "fact", - delegate( int2 location, Player owner ) - { - return new ConstructionYard( location, owner, this ); - } ); - buildingCreation.Add( "proc", - delegate( int2 location, Player owner ) - { - return new Refinery( location, owner, this ); - } ); + buildingCreation.Add("fact", (location, owner) => new ConstructionYard(location, owner, this)); + buildingCreation.Add("proc", (location, owner) => new Refinery(location, owner, this)); string[] buildings = { "powr", "apwr", "weap", "barr", "atek", "stek", "dome" }; foreach (string s in buildings) AddBuilding(s); } - void AddBuilding( string name ) + void AddBuilding(string name) { - buildingCreation.Add( name, - delegate( int2 location, Player owner ) - { - return new Building( name, location, owner, this ); - } ); + buildingCreation.Add(name, (location, owner) => new Building(name, location, owner, this)); } public void Tick() @@ -77,9 +64,6 @@ namespace OpenRa.Game Queue stuffFromOtherPlayers = network.Tick(); // todo: actually use the orders! } - public void Issue(IOrder order) - { - order.Apply( this ); - } + public void Issue(IOrder order) { order.Apply(this); } } } diff --git a/OpenRa.Game/Network/Network.cs b/OpenRa.Game/Network/Network.cs index bcf6fc5629..083a1d0b6f 100644 --- a/OpenRa.Game/Network/Network.cs +++ b/OpenRa.Game/Network/Network.cs @@ -26,7 +26,7 @@ namespace OpenRa.Game { client.EnableBroadcast = true; - Thread receiveThread = new Thread(delegate() + Thread receiveThread = new Thread( () => { for (; ; ) { diff --git a/OpenRa.Game/OpenRa.Game.csproj b/OpenRa.Game/OpenRa.Game.csproj index 0080dcc292..14368f039b 100644 --- a/OpenRa.Game/OpenRa.Game.csproj +++ b/OpenRa.Game/OpenRa.Game.csproj @@ -29,6 +29,7 @@ false false true + v3.5 true @@ -60,6 +61,9 @@ ..\..\IjwFramework\IjwFramework\bin\Debug\IjwFramework.dll + + 3.5 + @@ -143,6 +147,9 @@ false + + +