add ChromeMetrics for values we dont want to duplicate everywhere
This commit is contained in:
@@ -20,7 +20,7 @@ namespace OpenRA.FileFormats
|
||||
public readonly string[]
|
||||
Mods, Folders, Packages, Rules, ServerTraits,
|
||||
Sequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
||||
Weapons, Voices, Music, Movies, TileSets;
|
||||
Weapons, Voices, Music, Movies, TileSets, ChromeMetrics;
|
||||
public readonly string LoadScreen;
|
||||
public readonly int TileSize = 24;
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace OpenRA.FileFormats
|
||||
Music = YamlList(yaml, "Music");
|
||||
Movies = YamlList(yaml, "Movies");
|
||||
TileSets = YamlList(yaml, "TileSets");
|
||||
ChromeMetrics = YamlList(yaml, "ChromeMetrics");
|
||||
|
||||
LoadScreen = yaml.First( x => x.Key == "LoadScreen" ).Value.Value;
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
@@ -44,22 +45,23 @@ namespace OpenRA
|
||||
{
|
||||
AvailableMaps = FindMaps( Manifest.Mods );
|
||||
}
|
||||
|
||||
|
||||
public void LoadInitialAssets()
|
||||
{
|
||||
// all this manipulation of static crap here is nasty and breaks
|
||||
// horribly when you use ModData in unexpected ways.
|
||||
// horribly when you use ModData in unexpected ways.
|
||||
FileSystem.UnmountAll();
|
||||
foreach (var dir in Manifest.Folders)
|
||||
FileSystem.Mount(dir);
|
||||
|
||||
|
||||
ReloadMaps();
|
||||
Palette = new HardwarePalette();
|
||||
ChromeProvider.Initialize( Manifest.Chrome );
|
||||
SheetBuilder = new SheetBuilder( TextureChannel.Red );
|
||||
CursorSheetBuilder = new CursorSheetBuilder( this );
|
||||
ChromeMetrics.Initialize(Manifest.ChromeMetrics);
|
||||
ChromeProvider.Initialize(Manifest.Chrome);
|
||||
SheetBuilder = new SheetBuilder(TextureChannel.Red);
|
||||
CursorSheetBuilder = new CursorSheetBuilder(this);
|
||||
CursorProvider.Initialize(Manifest.Cursors);
|
||||
Palette.Update(new IPaletteModifier[]{});
|
||||
Palette.Update(new IPaletteModifier[] { });
|
||||
}
|
||||
|
||||
public Map PrepareMap(string uid)
|
||||
|
||||
@@ -204,6 +204,7 @@
|
||||
<Compile Include="Traits\Target.cs" />
|
||||
<Compile Include="Traits\ValidateOrder.cs" />
|
||||
<Compile Include="TraitDictionary.cs" />
|
||||
<Compile Include="Widgets\ChromeMetrics.cs" />
|
||||
<Compile Include="Widgets\PasswordFieldWidget.cs" />
|
||||
<Compile Include="Widgets\ScrollingTextWidget.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
|
||||
43
OpenRA.Game/Widgets/ChromeMetrics.cs
Normal file
43
OpenRA.Game/Widgets/ChromeMetrics.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
static class ChromeMetrics
|
||||
{
|
||||
static Dictionary<string, string> data = new Dictionary<string, string>();
|
||||
|
||||
public static void Initialize(string[] yaml)
|
||||
{
|
||||
data = new Dictionary<string, string>();
|
||||
var metrics = yaml.Select(y => MiniYaml.FromFile(y))
|
||||
.Aggregate(MiniYaml.MergeLiberal);
|
||||
|
||||
foreach (var m in metrics)
|
||||
foreach (var n in m.Value.Nodes)
|
||||
data[n.Key] = n.Value.Value;
|
||||
}
|
||||
|
||||
public static string GetString(string key)
|
||||
{
|
||||
return data[key];
|
||||
}
|
||||
|
||||
public static int GetInt(string key)
|
||||
{
|
||||
return int.Parse(data[key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Widgets;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
|
||||
4
mods/cnc/metrics.yaml
Normal file
4
mods/cnc/metrics.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
# General dumping-ground for UI element sizes, etc.
|
||||
|
||||
Metrics:
|
||||
ButtonDepth: 1
|
||||
@@ -92,3 +92,6 @@ ServerTraits:
|
||||
PlayerCommands
|
||||
LobbyCommands
|
||||
MasterServerPinger
|
||||
|
||||
ChromeMetrics:
|
||||
mods/cnc/metrics.yaml
|
||||
4
mods/ra/metrics.yaml
Normal file
4
mods/ra/metrics.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
# General dumping-ground for UI element sizes, etc.
|
||||
|
||||
Metrics:
|
||||
ButtonDepth: 1
|
||||
@@ -86,3 +86,6 @@ ServerTraits:
|
||||
PlayerCommands
|
||||
LobbyCommands
|
||||
MasterServerPinger
|
||||
|
||||
ChromeMetrics:
|
||||
mods/ra/metrics.yaml
|
||||
Reference in New Issue
Block a user