added Name to Sequence

This commit is contained in:
Chris Forbes
2009-11-03 19:03:42 +13:00
parent 0618fb6987
commit cda22ba7be
4 changed files with 8 additions and 10 deletions

View File

@@ -13,7 +13,6 @@ namespace OpenRa.Game.Graphics
public Animation( string name )
{
this.name = name.ToLowerInvariant();
// Play( "idle" );
}
public Sprite Image

View File

@@ -7,6 +7,7 @@ namespace OpenRa.Game.Graphics
{
readonly int start, length;
public readonly string Name;
public int Start { get { return start; } }
public int End { get { return start + length; } }
public int Length { get { return length; } }
@@ -14,6 +15,7 @@ namespace OpenRa.Game.Graphics
public Sequence(string unit, XmlElement e)
{
string srcOverride = e.GetAttribute("src");
Name = e.GetAttribute("name");
Range<int> src = UnitSheetBuilder.GetUnit(
string.IsNullOrEmpty(srcOverride) ? unit : srcOverride);

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Xml;
using System.Linq;
using OpenRa.FileFormats;
namespace OpenRa.Game.Graphics
@@ -38,10 +39,10 @@ namespace OpenRa.Game.Graphics
static void LoadSequencesForUnit(XmlElement eUnit)
{
string unitName = eUnit.GetAttribute("name");
Dictionary<string, Sequence> sequences = new Dictionary<string, Sequence>();
foreach (XmlElement eSequence in eUnit.SelectNodes("./sequence"))
sequences.Add(eSequence.GetAttribute("name"), new Sequence(unitName, eSequence));
var sequences = eUnit.SelectNodes("./sequence").OfType<XmlElement>()
.Select(e => new Sequence(unitName, e))
.ToDictionary(s => s.Name);
units.Add(unitName, sequences);
}

View File

@@ -22,10 +22,6 @@ namespace OpenRa.Game.Traits.Activities
return;
}
/* nothing to do here, either:
* - return to base, if full, or
* - seek out new ore, schedule a move there, and then this activity */
if (harv.IsFull)
PlanReturnToBase(self, mobile);
else