@@ -21,7 +21,7 @@ namespace OpenRA
|
||||
|
||||
public static string FormatErrorMessage(Exception e)
|
||||
{
|
||||
var ex = e as System.Net.WebException;
|
||||
var ex = e as WebException;
|
||||
if (ex == null)
|
||||
return e.Message;
|
||||
|
||||
@@ -46,15 +46,15 @@ namespace OpenRA
|
||||
wc.DownloadProgressChanged += (_, a) => onProgress(a);
|
||||
wc.DownloadFileCompleted += (_, a) => onComplete(a, cancelled);
|
||||
|
||||
Game.OnQuit += () => Cancel();
|
||||
wc.DownloadFileCompleted += (_, a) => { Game.OnQuit -= () => Cancel(); };
|
||||
Game.OnQuit += Cancel;
|
||||
wc.DownloadFileCompleted += (_, a) => { Game.OnQuit -= Cancel; };
|
||||
|
||||
wc.DownloadFileAsync(new Uri(url), path);
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
Game.OnQuit -= () => Cancel();
|
||||
Game.OnQuit -= Cancel;
|
||||
wc.CancelAsync();
|
||||
cancelled = true;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Effects
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Effects
|
||||
{
|
||||
|
||||
@@ -9,10 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Effects
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace OpenRA
|
||||
// Load a widget with world, orderManager, worldRenderer args, without adding it to the widget tree
|
||||
public static Widget LoadWidget(World world, string id, Widget parent, WidgetArgs args)
|
||||
{
|
||||
return Game.modData.WidgetLoader.LoadWidget(new WidgetArgs(args)
|
||||
return modData.WidgetLoader.LoadWidget(new WidgetArgs(args)
|
||||
{
|
||||
{ "world", world },
|
||||
{ "orderManager", orderManager },
|
||||
@@ -135,23 +135,23 @@ namespace OpenRA
|
||||
// worldRenderer is null during the initial install/download screen
|
||||
if (worldRenderer != null)
|
||||
{
|
||||
Game.Renderer.BeginFrame(worldRenderer.Viewport.TopLeft.ToFloat2(), worldRenderer.Viewport.Zoom);
|
||||
Renderer.BeginFrame(worldRenderer.Viewport.TopLeft.ToFloat2(), worldRenderer.Viewport.Zoom);
|
||||
Sound.SetListenerPosition(worldRenderer.Position(worldRenderer.Viewport.CenterLocation));
|
||||
worldRenderer.Draw();
|
||||
}
|
||||
else
|
||||
Game.Renderer.BeginFrame(float2.Zero, 1f);
|
||||
Renderer.BeginFrame(float2.Zero, 1f);
|
||||
|
||||
using (new PerfSample("render_widgets"))
|
||||
{
|
||||
Ui.Draw();
|
||||
var cursorName = Ui.Root.GetCursorOuter(Viewport.LastMousePos) ?? "default";
|
||||
CursorProvider.DrawCursor(Game.Renderer, cursorName, Viewport.LastMousePos, (int)cursorFrame);
|
||||
CursorProvider.DrawCursor(Renderer, cursorName, Viewport.LastMousePos, (int)cursorFrame);
|
||||
}
|
||||
|
||||
using (new PerfSample("render_flip"))
|
||||
{
|
||||
Game.Renderer.EndFrame(new DefaultInputHandler(orderManager.world));
|
||||
Renderer.EndFrame(new DefaultInputHandler(orderManager.world));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -374,13 +374,13 @@ namespace OpenRA
|
||||
|
||||
JoinLocal();
|
||||
|
||||
if (Game.Settings.Server.Dedicated)
|
||||
if (Settings.Server.Dedicated)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Game.Settings.Server.Map = WidgetUtils.ChooseInitialMap(Game.Settings.Server.Map);
|
||||
Game.Settings.Save();
|
||||
Game.CreateServer(new ServerSettings(Game.Settings.Server));
|
||||
Settings.Server.Map = WidgetUtils.ChooseInitialMap(Settings.Server.Map);
|
||||
Settings.Save();
|
||||
CreateServer(new ServerSettings(Settings.Server));
|
||||
while (true)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
@@ -393,15 +393,14 @@ namespace OpenRA
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Game.Settings.Server.DedicatedLoop)
|
||||
if (Settings.Server.DedicatedLoop)
|
||||
{
|
||||
Console.WriteLine("Starting a new server instance...");
|
||||
continue;
|
||||
}
|
||||
else
|
||||
break;
|
||||
break;
|
||||
}
|
||||
System.Environment.Exit(0);
|
||||
Environment.Exit(0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -420,7 +419,7 @@ namespace OpenRA
|
||||
var shellmaps = modData.AvailableMaps
|
||||
.Where(m => m.Value.UseAsShellmap);
|
||||
|
||||
if (shellmaps.Count() == 0)
|
||||
if (!shellmaps.Any())
|
||||
throw new InvalidDataException("No valid shellmaps available");
|
||||
|
||||
return shellmaps.Random(CosmeticRandom).Key;
|
||||
@@ -482,7 +481,7 @@ namespace OpenRA
|
||||
public static void CreateServer(ServerSettings settings)
|
||||
{
|
||||
server = new Server.Server(new IPEndPoint(IPAddress.Any, settings.ListenPort),
|
||||
Game.Settings.Game.Mods, settings, modData);
|
||||
Settings.Game.Mods, settings, modData);
|
||||
}
|
||||
|
||||
public static int CreateLocalServer(string map)
|
||||
@@ -496,7 +495,7 @@ namespace OpenRA
|
||||
};
|
||||
|
||||
server = new Server.Server(new IPEndPoint(IPAddress.Loopback, 0),
|
||||
Game.Settings.Game.Mods, settings, modData);
|
||||
Settings.Game.Mods, settings, modData);
|
||||
|
||||
return server.Port;
|
||||
}
|
||||
@@ -510,7 +509,7 @@ namespace OpenRA
|
||||
{
|
||||
try
|
||||
{
|
||||
var mod = Game.CurrentMods.FirstOrDefault().Value.Id;
|
||||
var mod = CurrentMods.First().Value.Id;
|
||||
var dirPath = "{1}maps{0}{2}".F(Path.DirectorySeparatorChar, Platform.SupportDir, mod);
|
||||
if(!Directory.Exists(dirPath))
|
||||
Directory.CreateDirectory(dirPath);
|
||||
|
||||
@@ -10,12 +10,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.Server;
|
||||
|
||||
namespace OpenRA.GameRules
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -10,11 +10,8 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Xml;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Xml;
|
||||
using OpenRA.FileFormats;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
@@ -13,7 +13,6 @@ using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace OpenRA.Graphics
|
||||
|
||||
public static Sheet AllocateSheet()
|
||||
{
|
||||
return new Sheet(new Size(Renderer.SheetSize, Renderer.SheetSize));;
|
||||
return new Sheet(new Size(Renderer.SheetSize, Renderer.SheetSize));
|
||||
}
|
||||
|
||||
internal SheetBuilder(SheetType t)
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using OpenRA.FileFormats;
|
||||
using SharpFont;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
|
||||
@@ -11,11 +11,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -258,7 +258,7 @@ namespace OpenRA.Graphics
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
var vec = new float[] {bounds[ix[i]], bounds[iy[i]], bounds[iz[i]], 1};
|
||||
var tvec = Util.MatrixVectorMultiply(mtx, vec);
|
||||
var tvec = MatrixVectorMultiply(mtx, vec);
|
||||
|
||||
ret[0] = Math.Min(ret[0], tvec[0]/tvec[3]);
|
||||
ret[1] = Math.Min(ret[1], tvec[1]/tvec[3]);
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Support;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -9,11 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.FileFormats.Graphics;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Graphics
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
@@ -14,7 +14,6 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA
|
||||
@@ -163,7 +162,7 @@ namespace OpenRA
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Failed to load map: {0}", path);
|
||||
Console.WriteLine("Details: {0}", e.ToString());
|
||||
Console.WriteLine("Details: {0}", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Network
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
@@ -43,11 +42,11 @@ namespace OpenRA.Network
|
||||
break;
|
||||
|
||||
case "Client":
|
||||
session.Clients.Add(FieldLoader.Load<Session.Client>(y.Value));
|
||||
session.Clients.Add(FieldLoader.Load<Client>(y.Value));
|
||||
break;
|
||||
|
||||
case "Slot":
|
||||
var s = FieldLoader.Load<Session.Slot>(y.Value);
|
||||
var s = FieldLoader.Load<Slot>(y.Value);
|
||||
session.Slots.Add(s.PlayerReference, s);
|
||||
break;
|
||||
}
|
||||
@@ -144,7 +143,7 @@ namespace OpenRA.Network
|
||||
public Session(string[] mods)
|
||||
{
|
||||
this.GlobalSettings.Mods = mods.ToArray();
|
||||
this.GlobalSettings.GameUid = System.Guid.NewGuid().ToString();
|
||||
this.GlobalSettings.GameUid = Guid.NewGuid().ToString();
|
||||
}
|
||||
|
||||
public string Serialize()
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Network
|
||||
{
|
||||
this.orderManager = orderManager;
|
||||
for (var i = 0; i < NumSyncReports; i++)
|
||||
syncReports[i] = new SyncReport.Report();
|
||||
syncReports[i] = new Report();
|
||||
}
|
||||
|
||||
internal void UpdateSyncReport()
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
using System;
|
||||
|
||||
using Mono.Nat;
|
||||
using Mono.Nat.Pmp;
|
||||
using Mono.Nat.Upnp;
|
||||
|
||||
namespace OpenRA.Network
|
||||
{
|
||||
|
||||
@@ -9,9 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Orders
|
||||
{
|
||||
|
||||
@@ -12,8 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Sockets;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Threading;
|
||||
|
||||
namespace OpenRA.Server
|
||||
{
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Server
|
||||
{
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace OpenRA.Server
|
||||
|
||||
if (File.Exists("{0}motd_{1}.txt".F(Platform.SupportDir, LobbyInfo.GlobalSettings.Mods[0])))
|
||||
{
|
||||
var motd = System.IO.File.ReadAllText("{0}motd_{1}.txt".F(Platform.SupportDir, LobbyInfo.GlobalSettings.Mods[0]));
|
||||
var motd = File.ReadAllText("{0}motd_{1}.txt".F(Platform.SupportDir, LobbyInfo.GlobalSettings.Mods[0]));
|
||||
SendOrderTo(newConn, "Message", motd);
|
||||
}
|
||||
|
||||
|
||||
@@ -272,7 +272,7 @@ namespace OpenRA
|
||||
}
|
||||
|
||||
// Returns true if played successfully
|
||||
public static bool PlayPredefined(Player p, Actor voicedUnit, string type, string definition, string variant, bool attentuateVolume)
|
||||
public static bool PlayPredefined(Player p, Actor voicedUnit, string type, string definition, string variant, bool attenuateVolume)
|
||||
{
|
||||
if (definition == null) return false;
|
||||
|
||||
@@ -323,7 +323,7 @@ namespace OpenRA
|
||||
if (!String.IsNullOrEmpty(name) && (p == null || p == p.World.LocalPlayer))
|
||||
soundEngine.Play2D(sounds[name],
|
||||
false, true, WPos.Zero,
|
||||
InternalSoundVolume, attentuateVolume);
|
||||
InternalSoundVolume, attenuateVolume);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -604,8 +604,8 @@ namespace OpenRA
|
||||
int state;
|
||||
Al.alGetSourcei(b, Al.AL_SOURCE_STATE, out state);
|
||||
return ((state == Al.AL_PLAYING || state == Al.AL_PAUSED) &&
|
||||
((music != null) ? b != ((OpenAlSound)music).source : true) &&
|
||||
((video != null) ? b != ((OpenAlSound)video).source : true));
|
||||
((music == null) || b != ((OpenAlSound)music).source) &&
|
||||
((video == null) || b != ((OpenAlSound)video).source));
|
||||
}).ToList();
|
||||
foreach (var s in sounds)
|
||||
{
|
||||
|
||||
@@ -21,11 +21,11 @@ namespace OpenRA
|
||||
|
||||
public Arguments(params string[] src)
|
||||
{
|
||||
Regex regex = new Regex("([^=]+)=(.*)");
|
||||
foreach (string s in src)
|
||||
var regex = new Regex("([^=]+)=(.*)");
|
||||
foreach (var s in src)
|
||||
{
|
||||
Match m = regex.Match(s);
|
||||
if (m == null || !m.Success)
|
||||
if (!m.Success)
|
||||
continue;
|
||||
|
||||
args[m.Groups[1].Value] = m.Groups[2].Value;
|
||||
|
||||
@@ -8,10 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -8,10 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class DebugPauseStateInfo : ITraitInfo
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Effects;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
public class DeveloperModeInfo : ITraitInfo
|
||||
|
||||
@@ -8,13 +8,10 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.GameRules;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
@@ -65,7 +64,7 @@ namespace OpenRA.Traits
|
||||
return;
|
||||
|
||||
var pipSources = self.TraitsImplementing<IPips>();
|
||||
if (pipSources.Count() == 0)
|
||||
if (!pipSources.Any())
|
||||
return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
|
||||
@@ -32,14 +32,14 @@ namespace OpenRA.Traits
|
||||
public static Target FromOrder(Order o)
|
||||
{
|
||||
return o.TargetActor != null
|
||||
? Target.FromActor(o.TargetActor)
|
||||
: Target.FromCell(o.TargetLocation);
|
||||
? FromActor(o.TargetActor)
|
||||
: FromCell(o.TargetLocation);
|
||||
}
|
||||
|
||||
public static Target FromActor(Actor a)
|
||||
{
|
||||
if (a == null)
|
||||
return Target.Invalid;
|
||||
return Invalid;
|
||||
|
||||
return new Target
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Support;
|
||||
|
||||
@@ -135,7 +134,7 @@ namespace OpenRA.Traits
|
||||
public static IEnumerable<CPos> AdjacentCells(Target target)
|
||||
{
|
||||
var cells = target.Positions.Select(p => p.ToCPos()).Distinct();
|
||||
return Util.ExpandFootprint(cells, true);
|
||||
return ExpandFootprint(cells, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Traits
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Widgets
|
||||
WidgetUtils.DrawPanel(Background, RenderBounds);
|
||||
}
|
||||
|
||||
public BackgroundWidget() : base() { }
|
||||
public BackgroundWidget() { }
|
||||
|
||||
bool moving;
|
||||
int2? prevMouseLocation;
|
||||
|
||||
@@ -9,10 +9,8 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -48,7 +46,6 @@ namespace OpenRA.Widgets
|
||||
public Action<KeyInput> OnKeyPress = _ => {};
|
||||
|
||||
public ButtonWidget()
|
||||
: base()
|
||||
{
|
||||
GetText = () => { return Text; };
|
||||
OnMouseUp = _ => OnClick();
|
||||
@@ -188,7 +185,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public virtual void DrawBackground(Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted)
|
||||
{
|
||||
ButtonWidget.DrawBackground("button", rect, disabled, pressed, hover, highlighted);
|
||||
DrawBackground("button", rect, disabled, pressed, hover, highlighted);
|
||||
}
|
||||
|
||||
public static void DrawBackground(string baseName, Rectangle rect, bool disabled, bool pressed, bool hover, bool highlighted)
|
||||
|
||||
@@ -26,9 +26,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
internal List<ChatLine> recentLines = new List<ChatLine>();
|
||||
|
||||
public ChatDisplayWidget()
|
||||
: base() { }
|
||||
|
||||
public override Rectangle EventBounds { get { return Rectangle.Empty; } }
|
||||
|
||||
public override void Draw()
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using System.Reflection;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -25,7 +24,6 @@ namespace OpenRA.Widgets
|
||||
public bool HasPressedState = ChromeMetrics.Get<bool>("CheckboxPressedState");
|
||||
|
||||
public CheckboxWidget()
|
||||
: base()
|
||||
{
|
||||
GetCheckType = () => CheckType;
|
||||
}
|
||||
|
||||
@@ -8,13 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Network;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
@@ -27,7 +21,7 @@ namespace OpenRA.Widgets
|
||||
OrderManager orderManager;
|
||||
int clientIndex;
|
||||
|
||||
public ClientTooltipRegionWidget() : base()
|
||||
public ClientTooltipRegionWidget()
|
||||
{
|
||||
tooltipContainer = Lazy.New(() => Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace OpenRA.Widgets
|
||||
public Func<Color> GetColor;
|
||||
|
||||
public ColorBlockWidget()
|
||||
: base()
|
||||
{
|
||||
GetColor = () => Color.White;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenRA.Widgets
|
||||
Widget panel;
|
||||
MaskWidget fullscreenMask;
|
||||
|
||||
public DropDownButtonWidget() : base() { }
|
||||
public DropDownButtonWidget() { }
|
||||
|
||||
protected DropDownButtonWidget(DropDownButtonWidget widget) : base(widget) { }
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace OpenRA.Widgets
|
||||
public class MaskWidget : Widget
|
||||
{
|
||||
public event Action<MouseInput> OnMouseDown = _ => {};
|
||||
public MaskWidget() : base() { }
|
||||
public MaskWidget() { }
|
||||
public MaskWidget(MaskWidget other)
|
||||
: base(other)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -31,7 +29,7 @@ namespace OpenRA.Widgets
|
||||
public Color DisabledColor = Color.Gray;
|
||||
public string Font = "Regular";
|
||||
|
||||
public HotkeyEntryWidget() : base() {}
|
||||
public HotkeyEntryWidget() {}
|
||||
protected HotkeyEntryWidget(HotkeyEntryWidget widget)
|
||||
: base(widget)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,6 @@ namespace OpenRA.Widgets
|
||||
public Func<string> GetImageCollection;
|
||||
|
||||
public ImageWidget()
|
||||
: base()
|
||||
{
|
||||
GetImageName = () => ImageName;
|
||||
GetImageCollection = () => ImageCollection;
|
||||
|
||||
@@ -33,7 +33,6 @@ namespace OpenRA.Widgets
|
||||
public Func<Color> GetContrastColor;
|
||||
|
||||
public LabelWidget()
|
||||
: base()
|
||||
{
|
||||
GetText = () => Text;
|
||||
GetColor = () => Color;
|
||||
|
||||
@@ -12,7 +12,6 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -41,7 +40,6 @@ namespace OpenRA.Widgets
|
||||
public string AxisFont;
|
||||
|
||||
public LineGraphWidget()
|
||||
: base()
|
||||
{
|
||||
GetValueFormat = () => ValueFormat;
|
||||
GetXAxisValueFormat = () => XAxisValueFormat;
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace OpenRA.Widgets
|
||||
Lazy<TooltipContainerWidget> tooltipContainer;
|
||||
public int TooltipSpawnIndex = -1;
|
||||
|
||||
public MapPreviewWidget() : base()
|
||||
public MapPreviewWidget()
|
||||
{
|
||||
tooltipContainer = Lazy.New(() => Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public class PasswordFieldWidget : TextFieldWidget
|
||||
{
|
||||
public PasswordFieldWidget() : base() { }
|
||||
public PasswordFieldWidget() { }
|
||||
protected PasswordFieldWidget(PasswordFieldWidget widget) : base(widget) { }
|
||||
|
||||
protected override string GetApparentText() { return new string('*', Text.Length); }
|
||||
|
||||
@@ -16,8 +16,6 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public class PerfGraphWidget : Widget
|
||||
{
|
||||
public PerfGraphWidget() : base() { }
|
||||
|
||||
public override void Draw()
|
||||
{
|
||||
var rect = RenderBounds;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
@@ -22,7 +21,7 @@ namespace OpenRA.Widgets
|
||||
float offset = 0f;
|
||||
float tickStep = 0.04f;
|
||||
|
||||
public ProgressBarWidget() : base() {}
|
||||
public ProgressBarWidget() {}
|
||||
protected ProgressBarWidget(ProgressBarWidget widget)
|
||||
: base(widget)
|
||||
{
|
||||
|
||||
@@ -18,7 +18,6 @@ namespace OpenRA.Widgets
|
||||
public string BaseName = "scrollitem";
|
||||
|
||||
public ScrollItemWidget()
|
||||
: base()
|
||||
{
|
||||
IsVisible = () => false;
|
||||
VisualHeight = 0;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Widgets
|
||||
protected Rectangle scrollbarRect;
|
||||
protected Rectangle thumbRect;
|
||||
|
||||
public ScrollPanelWidget() : base() { Layout = new ListLayout(this); }
|
||||
public ScrollPanelWidget() { Layout = new ListLayout(this); }
|
||||
|
||||
public override void RemoveChildren()
|
||||
{
|
||||
|
||||
@@ -28,7 +28,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ShpImageWidget(WorldRenderer worldRenderer)
|
||||
: base()
|
||||
{
|
||||
GetImage = () => { return Image; };
|
||||
GetFrame = () => { return Frame; };
|
||||
|
||||
@@ -29,7 +29,6 @@ namespace OpenRA.Widgets
|
||||
protected bool isMoving = false;
|
||||
|
||||
public SliderWidget()
|
||||
: base()
|
||||
{
|
||||
GetValue = () => Value;
|
||||
}
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -40,7 +38,7 @@ namespace OpenRA.Widgets
|
||||
public Color DisabledColor = Color.Gray;
|
||||
public string Font = "Regular";
|
||||
|
||||
public TextFieldWidget() : base() {}
|
||||
public TextFieldWidget() {}
|
||||
protected TextFieldWidget(TextFieldWidget widget)
|
||||
: base(widget)
|
||||
{
|
||||
|
||||
@@ -8,12 +8,8 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Widgets;
|
||||
using System;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
[ObjectCreator.UseCtor]
|
||||
public ViewportControllerWidget(World world, WorldRenderer worldRenderer)
|
||||
: base()
|
||||
{
|
||||
this.world = world;
|
||||
this.worldRenderer = worldRenderer;
|
||||
|
||||
@@ -446,7 +446,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public class ContainerWidget : Widget
|
||||
{
|
||||
public ContainerWidget() : base() { IgnoreMouseOver = true; }
|
||||
public ContainerWidget() { IgnoreMouseOver = true; }
|
||||
public ContainerWidget(ContainerWidget other)
|
||||
: base(other) { IgnoreMouseOver = true; }
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace OpenRA.Widgets
|
||||
|
||||
public class WidgetArgs : Dictionary<string, object>
|
||||
{
|
||||
public WidgetArgs() : base() { }
|
||||
public WidgetArgs() { }
|
||||
public WidgetArgs(Dictionary<string, object> args) : base(args) { }
|
||||
public void Add(string key, Action val) { base.Add(key, val); }
|
||||
}
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
var useClassicMouseStyle = Game.Settings.Game.UseClassicMouseStyle;
|
||||
|
||||
var hasBox = (SelectionBox != null) ? true : false;
|
||||
var multiClick = (mi.MultiTapCount >= 2) ? true : false;
|
||||
var hasBox = SelectionBox != null;
|
||||
var multiClick = mi.MultiTapCount >= 2;
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ namespace OpenRA.Widgets
|
||||
dragStart = dragEnd = xy;
|
||||
|
||||
// place buildings
|
||||
if (!useClassicMouseStyle || (useClassicMouseStyle && !World.Selection.Actors.Any()))
|
||||
if (!useClassicMouseStyle || !World.Selection.Actors.Any())
|
||||
ApplyOrders(World, xy, mi);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace OpenRA
|
||||
public static string GetTerrainType(this World world, CPos cell)
|
||||
{
|
||||
var custom = world.Map.CustomTerrain[cell.X, cell.Y];
|
||||
return custom != null ? custom : world.TileSet.GetTerrainType(world.Map.MapTiles.Value[cell.X, cell.Y]);
|
||||
return custom ?? world.TileSet.GetTerrainType(world.Map.MapTiles.Value[cell.X, cell.Y]);
|
||||
}
|
||||
|
||||
public static TerrainTypeInfo GetTerrainInfo(this World world, CPos cell)
|
||||
|
||||
Reference in New Issue
Block a user