Quick hack for theater-specific artwork. Should probably be done better; editor support required.

This commit is contained in:
Paul Chote
2010-06-28 00:23:58 +12:00
parent 560c3ce5af
commit 15a72e893b
4 changed files with 179 additions and 14 deletions

View File

@@ -31,12 +31,14 @@ namespace OpenRA.Graphics
{
static Dictionary<string, Dictionary<string, Sequence>> units;
static Dictionary<string, CursorSequence> cursors;
static string currentTheater;
public static void Initialize(params string[] sequenceFiles)
public static void Initialize(string[] sequenceFiles, string theater)
{
units = new Dictionary<string, Dictionary<string, Sequence>>();
cursors = new Dictionary<string, CursorSequence>();
currentTheater = theater;
foreach (var f in sequenceFiles)
LoadSequenceSource(f);
}
@@ -76,16 +78,23 @@ namespace OpenRA.Graphics
public static Sequence GetSequence(string unitName, string sequenceName)
{
try { return units[unitName][sequenceName]; }
try { return units[unitName+"@"+currentTheater][sequenceName]; }
catch (KeyNotFoundException)
{
throw new InvalidOperationException(
"Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName));
try { return units[unitName][sequenceName]; }
catch (KeyNotFoundException)
{
throw new InvalidOperationException(
"Unit `{0}` does not have a sequence `{1}`".F(unitName, sequenceName));
}
}
}
public static bool HasSequence(string unit, string seq)
{
if (units.ContainsKey(unit+"@"+currentTheater))
return units[unit+"@"+currentTheater].ContainsKey(seq);
return units[unit].ContainsKey(seq);
}