sequence highlight works in viewer

This commit is contained in:
Chris Forbes
2009-10-28 21:26:35 +13:00
parent 92d28a6354
commit 5d1ae1cb2a
4 changed files with 30 additions and 1 deletions

View File

@@ -47,7 +47,7 @@
this.ClientSize = new System.Drawing.Size(708, 543); this.ClientSize = new System.Drawing.Size(708, 543);
this.Controls.Add(this.surface1); this.Controls.Add(this.surface1);
this.Name = "Form1"; this.Name = "Form1";
this.Text = "Form1"; this.Text = "OpenRA Sequence Viewer";
this.ResumeLayout(false); this.ResumeLayout(false);
} }

View File

@@ -15,6 +15,7 @@ namespace SequenceEditor
public Form1() public Form1()
{ {
InitializeComponent(); InitializeComponent();
Text += " - " + Program.UnitName;
} }
} }
} }

View File

@@ -75,7 +75,14 @@ namespace SequenceEditor
public Sequence(XmlElement e) public Sequence(XmlElement e)
{ {
start = int.Parse(e.GetAttribute("start"));
shp = e.GetAttribute("src");
if (shp == "") shp = Program.UnitName;
var a = e.GetAttribute("length");
length = (a == "*")
? Program.Shps[shp].Length - start
: ((a == "") ? 1 : int.Parse(a));
} }
} }
} }

View File

@@ -57,6 +57,27 @@ namespace SequenceEditor
y += u; y += u;
x = 0; x = 0;
} }
var brushes = new[] { Brushes.Green, Brushes.Red, Brushes.Blue, Brushes.Magenta, Brushes.DarkOrange, Brushes.Navy };
var seqid = 0;
foreach (var seq in Program.Sequences)
{
var firstFrame = seq.Value.start;
var r = items[seq.Value.shp][firstFrame];
for (var i = 0; i < seq.Value.length; i++)
{
var q = items[seq.Value.shp][i + firstFrame];
e.Graphics.FillRectangle(brushes[seqid], q.Left, q.Top, q.Width, 2);
}
var z = e.Graphics.MeasureString(seq.Key, Font);
e.Graphics.FillRectangle(brushes[seqid], r.Left, r.Top, z.Width, z.Height);
e.Graphics.DrawString(seq.Key, Font, Brushes.White, r.Left, r.Top);
seqid = ++seqid % brushes.Length;
}
} }
} }
} }