Fix silly naming conventions

This commit is contained in:
Paul Chote
2010-08-23 22:17:05 +12:00
parent 79ced35010
commit 46d0ce89e9
8 changed files with 32 additions and 32 deletions

View File

@@ -34,7 +34,7 @@ namespace OpenRA
public static ModData modData;
public static World world;
public static Viewport viewport;
public static UserSettings Settings;
public static Settings Settings;
internal static OrderManager orderManager;
@@ -246,15 +246,15 @@ namespace OpenRA
public static Modifiers GetModifierKeys() { return modifiers; }
public static void HandleModifierKeys(Modifiers mods) { modifiers = mods; }
internal static void Initialize(Settings settings)
internal static void Initialize(Arguments args)
{
AppDomain.CurrentDomain.AssemblyResolve += FileSystem.ResolveAssembly;
var defaultSupport = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
+ Path.DirectorySeparatorChar + "OpenRA";
SupportDir = settings.GetValue("SupportDir", defaultSupport);
Settings = new UserSettings(settings);
SupportDir = args.GetValue("SupportDir", defaultSupport);
Settings = new Settings(args);
Log.LogPath = SupportDir + "Logs" + Path.DirectorySeparatorChar;
Log.AddChannel("perf", "perf.log");
@@ -266,7 +266,7 @@ namespace OpenRA
Renderer.SheetSize = Settings.SheetSize;
Renderer.Initialize( settings, Game.Settings.WindowMode );
Renderer.Initialize( Game.Settings.WindowMode );
Sound.Initialize();
PerfHistory.items["render"].hasNormalTick = false;

View File

@@ -17,7 +17,7 @@ using OpenRA.FileFormats.Graphics;
namespace OpenRA.GameRules
{
public class UserSettings
public class Settings
{
// Behaviour settings
public bool ViewportEdgeScroll = true;
@@ -33,7 +33,7 @@ namespace OpenRA.GameRules
public WindowMode WindowMode = WindowMode.PseudoFullscreen;
public int2 FullscreenSize = new int2(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height);
public int2 WindowedSize = new int2(1024,768);
public readonly static int2 MinResolution = new int2(800, 600);
public readonly int2 MinResolution = new int2(800, 600);
//Sound Settings
public float SoundVolume = 0.5f;
@@ -62,12 +62,12 @@ namespace OpenRA.GameRules
public bool AllowCheats = false;
string SettingsFile;
UserSettings defaults;
Settings defaults;
public UserSettings() {}
public UserSettings(Settings args)
public Settings() {}
public Settings(Arguments args)
{
defaults = new UserSettings();
defaults = new Settings();
SettingsFile = Game.SupportDir + "settings.yaml";
// Override settings loading to not crash

View File

@@ -121,13 +121,13 @@ namespace OpenRA.Graphics
public static Size Resolution { get { return device.WindowSize; } }
internal static void Initialize( Settings settings, OpenRA.FileFormats.Graphics.WindowMode windowMode )
internal static void Initialize( OpenRA.FileFormats.Graphics.WindowMode windowMode )
{
var resolution = GetResolution( settings, windowMode );
var resolution = GetResolution( windowMode );
device = CreateDevice( Assembly.LoadFile( Path.GetFullPath( "OpenRA.Gl.dll" ) ), resolution.Width, resolution.Height, windowMode, false );
}
static Size GetResolution(Settings settings, WindowMode windowmode)
static Size GetResolution(WindowMode windowmode)
{
var desktopResolution = Screen.PrimaryScreen.Bounds.Size;
var customSize = (windowmode == WindowMode.Windowed) ? Game.Settings.WindowedSize : Game.Settings.FullscreenSize;

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -100,7 +100,6 @@
<Compile Include="Exts.cs" />
<Compile Include="GameRules\ActorInfo.cs" />
<Compile Include="GameRules\TechTree.cs" />
<Compile Include="GameRules\UserSettings.cs" />
<Compile Include="GameRules\VoiceInfo.cs" />
<Compile Include="Effects\IEffect.cs" />
<Compile Include="Graphics\ChromeProvider.cs" />
@@ -152,7 +151,6 @@
<Compile Include="Support\Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Graphics\Renderer.cs" />
<Compile Include="Support\Settings.cs" />
<Compile Include="Graphics\Sprite.cs" />
<Compile Include="Graphics\SpriteRenderer.cs" />
<Compile Include="Graphics\SpriteSheetBuilder.cs" />
@@ -224,6 +222,8 @@
<Compile Include="Widgets\VqaPlayerWidget.cs" />
<Compile Include="Widgets\Delegates\VideoPlayerDelegate.cs" />
<Compile Include="Traits\MPStartLocations.cs" />
<Compile Include="GameRules\Settings.cs" />
<Compile Include="Support\Arguments.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenRA.FileFormats\OpenRA.FileFormats.csproj">

View File

@@ -48,7 +48,7 @@ namespace OpenRA.Server
static ModData ModData;
static Map Map;
public static void ServerMain(ModData modData, UserSettings settings, string map)
public static void ServerMain(ModData modData, Settings settings, string map)
{
Log.AddChannel("server", "server.log");
@@ -151,7 +151,7 @@ namespace OpenRA.Server
newConn.socket.Send(BitConverter.GetBytes(newConn.PlayerIndex));
conns.Add(newConn);
var defaults = new GameRules.UserSettings();
var defaults = new GameRules.Settings();
lobbyInfo.Clients.Add(
new Session.Client()
{

View File

@@ -13,11 +13,11 @@ using System.Text.RegularExpressions;
namespace OpenRA
{
public class Settings
public class Arguments
{
Dictionary<string, string> settings = new Dictionary<string, string>();
Dictionary<string, string> args = new Dictionary<string, string>();
public Settings(IEnumerable<string> src)
public Arguments(IEnumerable<string> src)
{
Regex regex = new Regex("([^=]+)=(.*)");
foreach (string s in src)
@@ -26,13 +26,13 @@ namespace OpenRA
if (m == null || !m.Success)
continue;
settings.Add(m.Groups[1].Value, m.Groups[2].Value);
args.Add(m.Groups[1].Value, m.Groups[2].Value);
}
}
public bool Contains(string key) { return settings.ContainsKey(key); }
public bool Contains(string key) { return args.ContainsKey(key); }
public string GetValue(string key, string defaultValue) { return Contains(key) ? settings[key] : defaultValue; }
public string GetValue(string key, string defaultValue) { return Contains(key) ? args[key] : defaultValue; }
public int GetValue(string key, int defaultValue)
{

View File

@@ -44,7 +44,7 @@ namespace OpenRA
static void Run( string[] args )
{
Game.Initialize( new Settings( args ) );
Game.Initialize( new Arguments(args) );
Game.Run();
}
}

View File

@@ -85,14 +85,14 @@ namespace OpenRA.Widgets.Delegates
};
var width = display.GetWidget<TextFieldWidget>("SCREEN_WIDTH");
Game.Settings.WindowedSize.X = (Game.Settings.WindowedSize.X < UserSettings.MinResolution.X)?
UserSettings.MinResolution.X : Game.Settings.WindowedSize.X;
Game.Settings.WindowedSize.X = (Game.Settings.WindowedSize.X < Game.Settings.MinResolution.X)?
Game.Settings.MinResolution.X : Game.Settings.WindowedSize.X;
width.Text = Game.Settings.WindowedSize.X.ToString();
width.OnLoseFocus = () =>
{
try {
var w = int.Parse(width.Text);
if (w > UserSettings.MinResolution.X && w <= Screen.PrimaryScreen.Bounds.Size.Width)
if (w > Game.Settings.MinResolution.X && w <= Screen.PrimaryScreen.Bounds.Size.Width)
Game.Settings.WindowedSize = new int2(w, Game.Settings.WindowedSize.Y);
else
width.Text = Game.Settings.WindowedSize.X.ToString();
@@ -104,14 +104,14 @@ namespace OpenRA.Widgets.Delegates
width.OnEnterKey = () => { width.LoseFocus(); return true; };
var height = display.GetWidget<TextFieldWidget>("SCREEN_HEIGHT");
Game.Settings.WindowedSize.Y = (Game.Settings.WindowedSize.Y < UserSettings.MinResolution.Y)?
UserSettings.MinResolution.Y : Game.Settings.WindowedSize.Y;
Game.Settings.WindowedSize.Y = (Game.Settings.WindowedSize.Y < Game.Settings.MinResolution.Y)?
Game.Settings.MinResolution.Y : Game.Settings.WindowedSize.Y;
height.Text = Game.Settings.WindowedSize.Y.ToString();
height.OnLoseFocus = () =>
{
try {
var h = int.Parse(height.Text);
if (h > UserSettings.MinResolution.Y && h <= Screen.PrimaryScreen.Bounds.Size.Height)
if (h > Game.Settings.MinResolution.Y && h <= Screen.PrimaryScreen.Bounds.Size.Height)
Game.Settings.WindowedSize = new int2(Game.Settings.WindowedSize.X, h);
else
height.Text = Game.Settings.WindowedSize.Y.ToString();