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[]
|
public readonly string[]
|
||||||
Mods, Folders, Packages, Rules, ServerTraits,
|
Mods, Folders, Packages, Rules, ServerTraits,
|
||||||
Sequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
Sequences, Cursors, Chrome, Assemblies, ChromeLayout,
|
||||||
Weapons, Voices, Music, Movies, TileSets;
|
Weapons, Voices, Music, Movies, TileSets, ChromeMetrics;
|
||||||
public readonly string LoadScreen;
|
public readonly string LoadScreen;
|
||||||
public readonly int TileSize = 24;
|
public readonly int TileSize = 24;
|
||||||
|
|
||||||
@@ -46,6 +46,7 @@ namespace OpenRA.FileFormats
|
|||||||
Music = YamlList(yaml, "Music");
|
Music = YamlList(yaml, "Music");
|
||||||
Movies = YamlList(yaml, "Movies");
|
Movies = YamlList(yaml, "Movies");
|
||||||
TileSets = YamlList(yaml, "TileSets");
|
TileSets = YamlList(yaml, "TileSets");
|
||||||
|
ChromeMetrics = YamlList(yaml, "ChromeMetrics");
|
||||||
|
|
||||||
LoadScreen = yaml.First( x => x.Key == "LoadScreen" ).Value.Value;
|
LoadScreen = yaml.First( x => x.Key == "LoadScreen" ).Value.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Linq;
|
|||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Traits;
|
using OpenRA.Traits;
|
||||||
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA
|
namespace OpenRA
|
||||||
{
|
{
|
||||||
@@ -44,22 +45,23 @@ namespace OpenRA
|
|||||||
{
|
{
|
||||||
AvailableMaps = FindMaps( Manifest.Mods );
|
AvailableMaps = FindMaps( Manifest.Mods );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadInitialAssets()
|
public void LoadInitialAssets()
|
||||||
{
|
{
|
||||||
// all this manipulation of static crap here is nasty and breaks
|
// 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();
|
FileSystem.UnmountAll();
|
||||||
foreach (var dir in Manifest.Folders)
|
foreach (var dir in Manifest.Folders)
|
||||||
FileSystem.Mount(dir);
|
FileSystem.Mount(dir);
|
||||||
|
|
||||||
ReloadMaps();
|
ReloadMaps();
|
||||||
Palette = new HardwarePalette();
|
Palette = new HardwarePalette();
|
||||||
ChromeProvider.Initialize( Manifest.Chrome );
|
ChromeMetrics.Initialize(Manifest.ChromeMetrics);
|
||||||
SheetBuilder = new SheetBuilder( TextureChannel.Red );
|
ChromeProvider.Initialize(Manifest.Chrome);
|
||||||
CursorSheetBuilder = new CursorSheetBuilder( this );
|
SheetBuilder = new SheetBuilder(TextureChannel.Red);
|
||||||
|
CursorSheetBuilder = new CursorSheetBuilder(this);
|
||||||
CursorProvider.Initialize(Manifest.Cursors);
|
CursorProvider.Initialize(Manifest.Cursors);
|
||||||
Palette.Update(new IPaletteModifier[]{});
|
Palette.Update(new IPaletteModifier[] { });
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map PrepareMap(string uid)
|
public Map PrepareMap(string uid)
|
||||||
|
|||||||
@@ -204,6 +204,7 @@
|
|||||||
<Compile Include="Traits\Target.cs" />
|
<Compile Include="Traits\Target.cs" />
|
||||||
<Compile Include="Traits\ValidateOrder.cs" />
|
<Compile Include="Traits\ValidateOrder.cs" />
|
||||||
<Compile Include="TraitDictionary.cs" />
|
<Compile Include="TraitDictionary.cs" />
|
||||||
|
<Compile Include="Widgets\ChromeMetrics.cs" />
|
||||||
<Compile Include="Widgets\PasswordFieldWidget.cs" />
|
<Compile Include="Widgets\PasswordFieldWidget.cs" />
|
||||||
<Compile Include="Widgets\ScrollingTextWidget.cs" />
|
<Compile Include="Widgets\ScrollingTextWidget.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -9,9 +9,9 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace OpenRA.Widgets
|
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
|
#endregion
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace OpenRA
|
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
|
PlayerCommands
|
||||||
LobbyCommands
|
LobbyCommands
|
||||||
MasterServerPinger
|
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
|
PlayerCommands
|
||||||
LobbyCommands
|
LobbyCommands
|
||||||
MasterServerPinger
|
MasterServerPinger
|
||||||
|
|
||||||
|
ChromeMetrics:
|
||||||
|
mods/ra/metrics.yaml
|
||||||
Reference in New Issue
Block a user