add dropdown in editor for choosing owner of new actors

This commit is contained in:
Chris Forbes
2011-10-31 18:41:38 +13:00
parent 7bc7fbc006
commit a060d99780
5 changed files with 217 additions and 151 deletions

View File

@@ -22,10 +22,8 @@ namespace OpenRA.Editor
public void Preview(Surface surface, SGraphics g) public void Preview(Surface surface, SGraphics g)
{ {
/* todo: include the player surface.DrawActor(g, surface.GetBrushLocation(), Actor,
* in the brush so we can color new buildings too */ surface.GetPaletteForPlayer(surface.NewActorOwner));
surface.DrawActor(g, surface.GetBrushLocation(), Actor, null);
} }
public void Apply(Surface surface) public void Apply(Surface surface)
@@ -33,7 +31,7 @@ namespace OpenRA.Editor
if (surface.Map.Actors.Value.Any(a => a.Value.Location() == surface.GetBrushLocation())) if (surface.Map.Actors.Value.Any(a => a.Value.Location() == surface.GetBrushLocation()))
return; return;
var owner = "Neutral"; var owner = surface.NewActorOwner;
var id = NextActorName(surface); var id = NextActorName(surface);
surface.Map.Actors.Value[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant()) surface.Map.Actors.Value[id] = new ActorReference(Actor.Info.Name.ToLowerInvariant())
{ {

View File

@@ -47,7 +47,9 @@ namespace OpenRA.Editor
this.tabPage1 = new System.Windows.Forms.TabPage(); this.tabPage1 = new System.Windows.Forms.TabPage();
this.tilePalette = new System.Windows.Forms.FlowLayoutPanel(); this.tilePalette = new System.Windows.Forms.FlowLayoutPanel();
this.tabPage2 = new System.Windows.Forms.TabPage(); this.tabPage2 = new System.Windows.Forms.TabPage();
this.panel1 = new System.Windows.Forms.Panel();
this.actorPalette = new System.Windows.Forms.FlowLayoutPanel(); this.actorPalette = new System.Windows.Forms.FlowLayoutPanel();
this.actorOwnerChooser = new System.Windows.Forms.ComboBox();
this.tabPage3 = new System.Windows.Forms.TabPage(); this.tabPage3 = new System.Windows.Forms.TabPage();
this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel(); this.resourcePalette = new System.Windows.Forms.FlowLayoutPanel();
this.surface1 = new OpenRA.Editor.Surface(); this.surface1 = new OpenRA.Editor.Surface();
@@ -74,13 +76,13 @@ namespace OpenRA.Editor
this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.resizeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showActorNamesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showActorNamesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.showGridToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.fixOpenAreasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setupDefaultPlayersMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox(); this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel(); this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelFiller = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabelMousePosition = new System.Windows.Forms.ToolStripStatusLabel();
this.fixOpenAreasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.setupDefaultPlayersMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout(); this.splitContainer1.SuspendLayout();
@@ -91,6 +93,7 @@ namespace OpenRA.Editor
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout(); this.tabPage1.SuspendLayout();
this.tabPage2.SuspendLayout(); this.tabPage2.SuspendLayout();
this.panel1.SuspendLayout();
this.tabPage3.SuspendLayout(); this.tabPage3.SuspendLayout();
this.splitContainer3.Panel1.SuspendLayout(); this.splitContainer3.Panel1.SuspendLayout();
this.splitContainer3.Panel2.SuspendLayout(); this.splitContainer3.Panel2.SuspendLayout();
@@ -98,44 +101,44 @@ namespace OpenRA.Editor
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// splitContainer1 // splitContainer1
// //
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.Location = new System.Drawing.Point(0, 0); this.splitContainer1.Location = new System.Drawing.Point(0, 0);
this.splitContainer1.Name = "splitContainer1"; this.splitContainer1.Name = "splitContainer1";
// //
// splitContainer1.Panel1 // splitContainer1.Panel1
// //
this.splitContainer1.Panel1.Controls.Add(this.splitContainer2); this.splitContainer1.Panel1.Controls.Add(this.splitContainer2);
// //
// splitContainer1.Panel2 // splitContainer1.Panel2
// //
this.splitContainer1.Panel2.Controls.Add(this.surface1); this.splitContainer1.Panel2.Controls.Add(this.surface1);
this.splitContainer1.Size = new System.Drawing.Size(985, 744); this.splitContainer1.Size = new System.Drawing.Size(985, 744);
this.splitContainer1.SplitterDistance = 198; this.splitContainer1.SplitterDistance = 198;
this.splitContainer1.TabIndex = 0; this.splitContainer1.TabIndex = 0;
// //
// splitContainer2 // splitContainer2
// //
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.Location = new System.Drawing.Point(0, 0); this.splitContainer2.Location = new System.Drawing.Point(0, 0);
this.splitContainer2.Name = "splitContainer2"; this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal; this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
// //
// splitContainer2.Panel1 // splitContainer2.Panel1
// //
this.splitContainer2.Panel1.Controls.Add(this.pmMiniMap); this.splitContainer2.Panel1.Controls.Add(this.pmMiniMap);
// //
// splitContainer2.Panel2 // splitContainer2.Panel2
// //
this.splitContainer2.Panel2.Controls.Add(this.tabControl1); this.splitContainer2.Panel2.Controls.Add(this.tabControl1);
this.splitContainer2.Size = new System.Drawing.Size(198, 744); this.splitContainer2.Size = new System.Drawing.Size(198, 744);
this.splitContainer2.SplitterDistance = 164; this.splitContainer2.SplitterDistance = 164;
this.splitContainer2.TabIndex = 1; this.splitContainer2.TabIndex = 1;
// //
// pmMiniMap // pmMiniMap
// //
this.pmMiniMap.BackColor = System.Drawing.Color.Black; this.pmMiniMap.BackColor = System.Drawing.Color.Black;
this.pmMiniMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.pmMiniMap.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.pmMiniMap.Dock = System.Windows.Forms.DockStyle.Fill; this.pmMiniMap.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -145,9 +148,9 @@ namespace OpenRA.Editor
this.pmMiniMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pmMiniMap.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pmMiniMap.TabIndex = 1; this.pmMiniMap.TabIndex = 1;
this.pmMiniMap.TabStop = false; this.pmMiniMap.TabStop = false;
// //
// tabControl1 // tabControl1
// //
this.tabControl1.Controls.Add(this.tabPage1); this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2); this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Controls.Add(this.tabPage3); this.tabControl1.Controls.Add(this.tabPage3);
@@ -160,9 +163,9 @@ namespace OpenRA.Editor
this.tabControl1.SelectedIndex = 0; this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(198, 576); this.tabControl1.Size = new System.Drawing.Size(198, 576);
this.tabControl1.TabIndex = 0; this.tabControl1.TabIndex = 0;
// //
// tabPage1 // tabPage1
// //
this.tabPage1.Controls.Add(this.tilePalette); this.tabPage1.Controls.Add(this.tilePalette);
this.tabPage1.Location = new System.Drawing.Point(4, 20); this.tabPage1.Location = new System.Drawing.Point(4, 20);
this.tabPage1.Name = "tabPage1"; this.tabPage1.Name = "tabPage1";
@@ -171,9 +174,9 @@ namespace OpenRA.Editor
this.tabPage1.TabIndex = 0; this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Templates"; this.tabPage1.Text = "Templates";
this.tabPage1.UseVisualStyleBackColor = true; this.tabPage1.UseVisualStyleBackColor = true;
// //
// tilePalette // tilePalette
// //
this.tilePalette.AutoScroll = true; this.tilePalette.AutoScroll = true;
this.tilePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.tilePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.tilePalette.Dock = System.Windows.Forms.DockStyle.Fill; this.tilePalette.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -181,10 +184,11 @@ namespace OpenRA.Editor
this.tilePalette.Name = "tilePalette"; this.tilePalette.Name = "tilePalette";
this.tilePalette.Size = new System.Drawing.Size(184, 546); this.tilePalette.Size = new System.Drawing.Size(184, 546);
this.tilePalette.TabIndex = 1; this.tilePalette.TabIndex = 1;
// //
// tabPage2 // tabPage2
// //
this.tabPage2.Controls.Add(this.actorPalette); this.tabPage2.Controls.Add(this.panel1);
this.tabPage2.Controls.Add(this.actorOwnerChooser);
this.tabPage2.Location = new System.Drawing.Point(4, 20); this.tabPage2.Location = new System.Drawing.Point(4, 20);
this.tabPage2.Name = "tabPage2"; this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3); this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
@@ -192,19 +196,41 @@ namespace OpenRA.Editor
this.tabPage2.TabIndex = 1; this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Actors"; this.tabPage2.Text = "Actors";
this.tabPage2.UseVisualStyleBackColor = true; this.tabPage2.UseVisualStyleBackColor = true;
// //
// panel1
//
this.panel1.Controls.Add(this.actorPalette);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(3, 24);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(184, 525);
this.panel1.TabIndex = 4;
//
// actorPalette // actorPalette
// //
this.actorPalette.AutoScroll = true; this.actorPalette.AutoScroll = true;
this.actorPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.actorPalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.actorPalette.Dock = System.Windows.Forms.DockStyle.Fill; this.actorPalette.Dock = System.Windows.Forms.DockStyle.Fill;
this.actorPalette.Location = new System.Drawing.Point(3, 3); this.actorPalette.Location = new System.Drawing.Point(0, 0);
this.actorPalette.Name = "actorPalette"; this.actorPalette.Name = "actorPalette";
this.actorPalette.Size = new System.Drawing.Size(184, 546); this.actorPalette.Size = new System.Drawing.Size(184, 525);
this.actorPalette.TabIndex = 2; this.actorPalette.TabIndex = 3;
// //
// actorOwnerChooser
//
this.actorOwnerChooser.Dock = System.Windows.Forms.DockStyle.Top;
this.actorOwnerChooser.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.actorOwnerChooser.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.actorOwnerChooser.FormattingEnabled = true;
this.actorOwnerChooser.Location = new System.Drawing.Point(3, 3);
this.actorOwnerChooser.Name = "actorOwnerChooser";
this.actorOwnerChooser.Size = new System.Drawing.Size(184, 21);
this.actorOwnerChooser.TabIndex = 3;
this.actorOwnerChooser.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.onDrawPlayerItem);
this.actorOwnerChooser.SelectionChangeCommitted += new System.EventHandler(this.onSelectOwner);
//
// tabPage3 // tabPage3
// //
this.tabPage3.Controls.Add(this.resourcePalette); this.tabPage3.Controls.Add(this.resourcePalette);
this.tabPage3.Location = new System.Drawing.Point(4, 20); this.tabPage3.Location = new System.Drawing.Point(4, 20);
this.tabPage3.Name = "tabPage3"; this.tabPage3.Name = "tabPage3";
@@ -212,9 +238,9 @@ namespace OpenRA.Editor
this.tabPage3.TabIndex = 2; this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "Resources"; this.tabPage3.Text = "Resources";
this.tabPage3.UseVisualStyleBackColor = true; this.tabPage3.UseVisualStyleBackColor = true;
// //
// resourcePalette // resourcePalette
// //
this.resourcePalette.AutoScroll = true; this.resourcePalette.AutoScroll = true;
this.resourcePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; this.resourcePalette.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.resourcePalette.Dock = System.Windows.Forms.DockStyle.Fill; this.resourcePalette.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -222,9 +248,9 @@ namespace OpenRA.Editor
this.resourcePalette.Name = "resourcePalette"; this.resourcePalette.Name = "resourcePalette";
this.resourcePalette.Size = new System.Drawing.Size(190, 552); this.resourcePalette.Size = new System.Drawing.Size(190, 552);
this.resourcePalette.TabIndex = 3; this.resourcePalette.TabIndex = 3;
// //
// surface1 // surface1
// //
this.surface1.BackColor = System.Drawing.Color.Black; this.surface1.BackColor = System.Drawing.Color.Black;
this.surface1.Dock = System.Windows.Forms.DockStyle.Fill; this.surface1.Dock = System.Windows.Forms.DockStyle.Fill;
this.surface1.Location = new System.Drawing.Point(0, 0); this.surface1.Location = new System.Drawing.Point(0, 0);
@@ -232,264 +258,264 @@ namespace OpenRA.Editor
this.surface1.Size = new System.Drawing.Size(783, 744); this.surface1.Size = new System.Drawing.Size(783, 744);
this.surface1.TabIndex = 5; this.surface1.TabIndex = 5;
this.surface1.Text = "surface1"; this.surface1.Text = "surface1";
// //
// tt // tt
// //
this.tt.ShowAlways = true; this.tt.ShowAlways = true;
// //
// saveFileDialog // saveFileDialog
// //
this.saveFileDialog.DefaultExt = "*.png"; this.saveFileDialog.DefaultExt = "*.png";
this.saveFileDialog.Filter = "PNG Image (*.png)|"; this.saveFileDialog.Filter = "PNG Image (*.png)|";
this.saveFileDialog.Title = "Export minimap to PNG"; this.saveFileDialog.Title = "Export minimap to PNG";
// //
// splitContainer3 // splitContainer3
// //
this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill; this.splitContainer3.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1; this.splitContainer3.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer3.IsSplitterFixed = true; this.splitContainer3.IsSplitterFixed = true;
this.splitContainer3.Location = new System.Drawing.Point(0, 0); this.splitContainer3.Location = new System.Drawing.Point(0, 0);
this.splitContainer3.Name = "splitContainer3"; this.splitContainer3.Name = "splitContainer3";
this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal; this.splitContainer3.Orientation = System.Windows.Forms.Orientation.Horizontal;
// //
// splitContainer3.Panel1 // splitContainer3.Panel1
// //
this.splitContainer3.Panel1.Controls.Add(this.menuStrip1); this.splitContainer3.Panel1.Controls.Add(this.menuStrip1);
// //
// splitContainer3.Panel2 // splitContainer3.Panel2
// //
this.splitContainer3.Panel2.Controls.Add(this.splitContainer1); this.splitContainer3.Panel2.Controls.Add(this.splitContainer1);
this.splitContainer3.Size = new System.Drawing.Size(985, 773); this.splitContainer3.Size = new System.Drawing.Size(985, 773);
this.splitContainer3.SplitterDistance = 25; this.splitContainer3.SplitterDistance = 25;
this.splitContainer3.TabIndex = 6; this.splitContainer3.TabIndex = 6;
// //
// menuStrip1 // menuStrip1
// //
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fileToolStripMenuItem, this.fileToolStripMenuItem,
this.mapToolStripMenuItem, this.mapToolStripMenuItem,
this.toolStripComboBox1, this.toolStripComboBox1,
this.toolStripLabel1}); this.toolStripLabel1});
this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(985, 27); this.menuStrip1.Size = new System.Drawing.Size(985, 27);
this.menuStrip1.TabIndex = 1; this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1"; this.menuStrip1.Text = "menuStrip1";
// //
// fileToolStripMenuItem // fileToolStripMenuItem
// //
this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newToolStripMenuItem, this.newToolStripMenuItem,
this.toolStripSeparator1, this.toolStripSeparator1,
this.openToolStripMenuItem, this.openToolStripMenuItem,
this.saveToolStripMenuItem, this.saveToolStripMenuItem,
this.saveAsToolStripMenuItem, this.saveAsToolStripMenuItem,
this.toolStripSeparator2, this.toolStripSeparator2,
this.toolStripMenuItem1, this.toolStripMenuItem1,
this.mnuExport, this.mnuExport,
this.toolStripSeparator3, this.toolStripSeparator3,
this.exitToolStripMenuItem}); this.exitToolStripMenuItem});
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 23); this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 23);
this.fileToolStripMenuItem.Text = "&File"; this.fileToolStripMenuItem.Text = "&File";
// //
// newToolStripMenuItem // newToolStripMenuItem
// //
this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image"))); this.newToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("newToolStripMenuItem.Image")));
this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Fuchsia; this.newToolStripMenuItem.ImageTransparentColor = System.Drawing.Color.Fuchsia;
this.newToolStripMenuItem.Name = "newToolStripMenuItem"; this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.newToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.newToolStripMenuItem.Text = "&New..."; this.newToolStripMenuItem.Text = "&New...";
this.newToolStripMenuItem.Click += new System.EventHandler(this.NewClicked); this.newToolStripMenuItem.Click += new System.EventHandler(this.NewClicked);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6);
// //
// openToolStripMenuItem // openToolStripMenuItem
// //
this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image"))); this.openToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("openToolStripMenuItem.Image")));
this.openToolStripMenuItem.Name = "openToolStripMenuItem"; this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.openToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.openToolStripMenuItem.Text = "&Open..."; this.openToolStripMenuItem.Text = "&Open...";
this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenClicked); this.openToolStripMenuItem.Click += new System.EventHandler(this.OpenClicked);
// //
// saveToolStripMenuItem // saveToolStripMenuItem
// //
this.saveToolStripMenuItem.Enabled = false; this.saveToolStripMenuItem.Enabled = false;
this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image"))); this.saveToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("saveToolStripMenuItem.Image")));
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.saveToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.saveToolStripMenuItem.Text = "&Save"; this.saveToolStripMenuItem.Text = "&Save";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveClicked); this.saveToolStripMenuItem.Click += new System.EventHandler(this.SaveClicked);
// //
// saveAsToolStripMenuItem // saveAsToolStripMenuItem
// //
this.saveAsToolStripMenuItem.Enabled = false; this.saveAsToolStripMenuItem.Enabled = false;
this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem"; this.saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.saveAsToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.saveAsToolStripMenuItem.Text = "Save &As..."; this.saveAsToolStripMenuItem.Text = "Save &As...";
this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsClicked); this.saveAsToolStripMenuItem.Click += new System.EventHandler(this.SaveAsClicked);
// //
// toolStripSeparator2 // toolStripSeparator2
// //
this.toolStripSeparator2.Name = "toolStripSeparator2"; this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6); this.toolStripSeparator2.Size = new System.Drawing.Size(120, 6);
// //
// toolStripMenuItem1 // toolStripMenuItem1
// //
this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.cCRedAlertMapToolStripMenuItem, this.cCRedAlertMapToolStripMenuItem,
this.bitmapToolStripMenuItem}); this.bitmapToolStripMenuItem});
this.toolStripMenuItem1.Name = "toolStripMenuItem1"; this.toolStripMenuItem1.Name = "toolStripMenuItem1";
this.toolStripMenuItem1.Size = new System.Drawing.Size(123, 22); this.toolStripMenuItem1.Size = new System.Drawing.Size(123, 22);
this.toolStripMenuItem1.Text = "&Import"; this.toolStripMenuItem1.Text = "&Import";
// //
// cCRedAlertMapToolStripMenuItem // cCRedAlertMapToolStripMenuItem
// //
this.cCRedAlertMapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cCRedAlertMapToolStripMenuItem.Image"))); this.cCRedAlertMapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("cCRedAlertMapToolStripMenuItem.Image")));
this.cCRedAlertMapToolStripMenuItem.Name = "cCRedAlertMapToolStripMenuItem"; this.cCRedAlertMapToolStripMenuItem.Name = "cCRedAlertMapToolStripMenuItem";
this.cCRedAlertMapToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.cCRedAlertMapToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.cCRedAlertMapToolStripMenuItem.Text = "&C&&C / Red Alert Map..."; this.cCRedAlertMapToolStripMenuItem.Text = "&C&&C / Red Alert Map...";
this.cCRedAlertMapToolStripMenuItem.Click += new System.EventHandler(this.ImportLegacyMapClicked); this.cCRedAlertMapToolStripMenuItem.Click += new System.EventHandler(this.ImportLegacyMapClicked);
// //
// bitmapToolStripMenuItem // bitmapToolStripMenuItem
// //
this.bitmapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bitmapToolStripMenuItem.Image"))); this.bitmapToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("bitmapToolStripMenuItem.Image")));
this.bitmapToolStripMenuItem.Name = "bitmapToolStripMenuItem"; this.bitmapToolStripMenuItem.Name = "bitmapToolStripMenuItem";
this.bitmapToolStripMenuItem.Size = new System.Drawing.Size(195, 22); this.bitmapToolStripMenuItem.Size = new System.Drawing.Size(195, 22);
this.bitmapToolStripMenuItem.Text = "&Bitmap..."; this.bitmapToolStripMenuItem.Text = "&Bitmap...";
this.bitmapToolStripMenuItem.Visible = false; this.bitmapToolStripMenuItem.Visible = false;
// //
// mnuExport // mnuExport
// //
this.mnuExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mnuExport.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.mnuMinimapToPNG}); this.mnuMinimapToPNG});
this.mnuExport.Name = "mnuExport"; this.mnuExport.Name = "mnuExport";
this.mnuExport.Size = new System.Drawing.Size(123, 22); this.mnuExport.Size = new System.Drawing.Size(123, 22);
this.mnuExport.Text = "&Export"; this.mnuExport.Text = "&Export";
// //
// mnuMinimapToPNG // mnuMinimapToPNG
// //
this.mnuMinimapToPNG.Enabled = false; this.mnuMinimapToPNG.Enabled = false;
this.mnuMinimapToPNG.Image = ((System.Drawing.Image)(resources.GetObject("mnuMinimapToPNG.Image"))); this.mnuMinimapToPNG.Image = ((System.Drawing.Image)(resources.GetObject("mnuMinimapToPNG.Image")));
this.mnuMinimapToPNG.Name = "mnuMinimapToPNG"; this.mnuMinimapToPNG.Name = "mnuMinimapToPNG";
this.mnuMinimapToPNG.Size = new System.Drawing.Size(163, 22); this.mnuMinimapToPNG.Size = new System.Drawing.Size(163, 22);
this.mnuMinimapToPNG.Text = "Minimap to PNG"; this.mnuMinimapToPNG.Text = "Minimap to PNG";
this.mnuMinimapToPNG.Click += new System.EventHandler(this.ExportMinimap); this.mnuMinimapToPNG.Click += new System.EventHandler(this.ExportMinimap);
// //
// toolStripSeparator3 // toolStripSeparator3
// //
this.toolStripSeparator3.Name = "toolStripSeparator3"; this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6); this.toolStripSeparator3.Size = new System.Drawing.Size(120, 6);
// //
// exitToolStripMenuItem // exitToolStripMenuItem
// //
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22); this.exitToolStripMenuItem.Size = new System.Drawing.Size(123, 22);
this.exitToolStripMenuItem.Text = "E&xit"; this.exitToolStripMenuItem.Text = "E&xit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.CloseClicked); this.exitToolStripMenuItem.Click += new System.EventHandler(this.CloseClicked);
// //
// mapToolStripMenuItem // mapToolStripMenuItem
// //
this.mapToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.mapToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.propertiesToolStripMenuItem, this.propertiesToolStripMenuItem,
this.resizeToolStripMenuItem, this.resizeToolStripMenuItem,
this.showActorNamesToolStripMenuItem, this.showActorNamesToolStripMenuItem,
this.showGridToolStripMenuItem, this.showGridToolStripMenuItem,
this.fixOpenAreasToolStripMenuItem, this.fixOpenAreasToolStripMenuItem,
this.setupDefaultPlayersMenuItem}); this.setupDefaultPlayersMenuItem});
this.mapToolStripMenuItem.Name = "mapToolStripMenuItem"; this.mapToolStripMenuItem.Name = "mapToolStripMenuItem";
this.mapToolStripMenuItem.Size = new System.Drawing.Size(43, 23); this.mapToolStripMenuItem.Size = new System.Drawing.Size(43, 23);
this.mapToolStripMenuItem.Text = "&Map"; this.mapToolStripMenuItem.Text = "&Map";
// //
// propertiesToolStripMenuItem // propertiesToolStripMenuItem
// //
this.propertiesToolStripMenuItem.Enabled = false; this.propertiesToolStripMenuItem.Enabled = false;
this.propertiesToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("propertiesToolStripMenuItem.Image"))); this.propertiesToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("propertiesToolStripMenuItem.Image")));
this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem"; this.propertiesToolStripMenuItem.Name = "propertiesToolStripMenuItem";
this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.propertiesToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.propertiesToolStripMenuItem.Text = "&Properties..."; this.propertiesToolStripMenuItem.Text = "&Properties...";
this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.PropertiesClicked); this.propertiesToolStripMenuItem.Click += new System.EventHandler(this.PropertiesClicked);
// //
// resizeToolStripMenuItem // resizeToolStripMenuItem
// //
this.resizeToolStripMenuItem.Enabled = false; this.resizeToolStripMenuItem.Enabled = false;
this.resizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("resizeToolStripMenuItem.Image"))); this.resizeToolStripMenuItem.Image = ((System.Drawing.Image)(resources.GetObject("resizeToolStripMenuItem.Image")));
this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem"; this.resizeToolStripMenuItem.Name = "resizeToolStripMenuItem";
this.resizeToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.resizeToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.resizeToolStripMenuItem.Text = "&Resize..."; this.resizeToolStripMenuItem.Text = "&Resize...";
this.resizeToolStripMenuItem.Click += new System.EventHandler(this.ResizeClicked); this.resizeToolStripMenuItem.Click += new System.EventHandler(this.ResizeClicked);
// //
// showActorNamesToolStripMenuItem // showActorNamesToolStripMenuItem
// //
this.showActorNamesToolStripMenuItem.Name = "showActorNamesToolStripMenuItem"; this.showActorNamesToolStripMenuItem.Name = "showActorNamesToolStripMenuItem";
this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.showActorNamesToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.showActorNamesToolStripMenuItem.Text = "Show Actor &Names"; this.showActorNamesToolStripMenuItem.Text = "Show Actor &Names";
this.showActorNamesToolStripMenuItem.Click += new System.EventHandler(this.ShowActorNamesClicked); this.showActorNamesToolStripMenuItem.Click += new System.EventHandler(this.ShowActorNamesClicked);
// //
// showGridToolStripMenuItem // showGridToolStripMenuItem
// //
this.showGridToolStripMenuItem.Name = "showGridToolStripMenuItem"; this.showGridToolStripMenuItem.Name = "showGridToolStripMenuItem";
this.showGridToolStripMenuItem.Size = new System.Drawing.Size(175, 22); this.showGridToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.showGridToolStripMenuItem.Text = "Show &Grid"; this.showGridToolStripMenuItem.Text = "Show &Grid";
this.showGridToolStripMenuItem.Click += new System.EventHandler(this.ShowGridClicked); this.showGridToolStripMenuItem.Click += new System.EventHandler(this.ShowGridClicked);
// //
// fixOpenAreasToolStripMenuItem
//
this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem";
this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(185, 22);
this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas";
this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas);
//
// setupDefaultPlayersMenuItem
//
this.setupDefaultPlayersMenuItem.Name = "setupDefaultPlayersMenuItem";
this.setupDefaultPlayersMenuItem.Size = new System.Drawing.Size(185, 22);
this.setupDefaultPlayersMenuItem.Text = "&Setup Default Players";
this.setupDefaultPlayersMenuItem.Click += new System.EventHandler(this.SetupDefaultPlayers);
//
// toolStripComboBox1 // toolStripComboBox1
// //
this.toolStripComboBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.toolStripComboBox1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.toolStripComboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.toolStripComboBox1.Name = "toolStripComboBox1"; this.toolStripComboBox1.Name = "toolStripComboBox1";
this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23); this.toolStripComboBox1.Size = new System.Drawing.Size(121, 23);
// //
// toolStripLabel1 // toolStripLabel1
// //
this.toolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right; this.toolStripLabel1.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.toolStripLabel1.Name = "toolStripLabel1"; this.toolStripLabel1.Name = "toolStripLabel1";
this.toolStripLabel1.Size = new System.Drawing.Size(71, 20); this.toolStripLabel1.Size = new System.Drawing.Size(71, 20);
this.toolStripLabel1.Text = "Active Mod:"; this.toolStripLabel1.Text = "Active Mod:";
// //
// statusStrip1 // statusStrip1
// //
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabelFiller, this.toolStripStatusLabelFiller,
this.toolStripStatusLabelMousePosition}); this.toolStripStatusLabelMousePosition});
this.statusStrip1.Location = new System.Drawing.Point(0, 751); this.statusStrip1.Location = new System.Drawing.Point(0, 751);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(985, 22); this.statusStrip1.Size = new System.Drawing.Size(985, 22);
this.statusStrip1.TabIndex = 7; this.statusStrip1.TabIndex = 7;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
// toolStripStatusLabelFiller // toolStripStatusLabelFiller
// //
this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller"; this.toolStripStatusLabelFiller.Name = "toolStripStatusLabelFiller";
this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17); this.toolStripStatusLabelFiller.Size = new System.Drawing.Size(948, 17);
this.toolStripStatusLabelFiller.Spring = true; this.toolStripStatusLabelFiller.Spring = true;
// //
// toolStripStatusLabelMousePosition // toolStripStatusLabelMousePosition
// //
this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition"; this.toolStripStatusLabelMousePosition.Name = "toolStripStatusLabelMousePosition";
this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.toolStripStatusLabelMousePosition.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17); this.toolStripStatusLabelMousePosition.Size = new System.Drawing.Size(22, 17);
this.toolStripStatusLabelMousePosition.Text = "0,0"; this.toolStripStatusLabelMousePosition.Text = "0,0";
// //
// fixOpenAreasToolStripMenuItem
//
this.fixOpenAreasToolStripMenuItem.Name = "fixOpenAreasToolStripMenuItem";
this.fixOpenAreasToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
this.fixOpenAreasToolStripMenuItem.Text = "&Fix Open Areas";
this.fixOpenAreasToolStripMenuItem.Click += new System.EventHandler(this.FixOpenAreas);
//
// setupDefaultPlayersMenuItem
//
this.setupDefaultPlayersMenuItem.Name = "setupDefaultPlayersMenuItem";
this.setupDefaultPlayersMenuItem.Size = new System.Drawing.Size(175, 22);
this.setupDefaultPlayersMenuItem.Text = "&Setup Default Players";
this.setupDefaultPlayersMenuItem.Click += new System.EventHandler(this.SetupDefaultPlayers);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(985, 773); this.ClientSize = new System.Drawing.Size(985, 773);
@@ -514,6 +540,7 @@ namespace OpenRA.Editor
this.tabControl1.ResumeLayout(false); this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false); this.tabPage1.ResumeLayout(false);
this.tabPage2.ResumeLayout(false); this.tabPage2.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.tabPage3.ResumeLayout(false); this.tabPage3.ResumeLayout(false);
this.splitContainer3.Panel1.ResumeLayout(false); this.splitContainer3.Panel1.ResumeLayout(false);
this.splitContainer3.Panel1.PerformLayout(); this.splitContainer3.Panel1.PerformLayout();
@@ -536,7 +563,6 @@ namespace OpenRA.Editor
private System.Windows.Forms.TabPage tabPage1; private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.FlowLayoutPanel tilePalette; private System.Windows.Forms.FlowLayoutPanel tilePalette;
private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.FlowLayoutPanel actorPalette;
private System.Windows.Forms.TabPage tabPage3; private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.FlowLayoutPanel resourcePalette; private System.Windows.Forms.FlowLayoutPanel resourcePalette;
private Surface surface1; private Surface surface1;
@@ -571,6 +597,9 @@ namespace OpenRA.Editor
private System.Windows.Forms.ToolStripMenuItem showGridToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem showGridToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem fixOpenAreasToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem fixOpenAreasToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem setupDefaultPlayersMenuItem; private System.Windows.Forms.ToolStripMenuItem setupDefaultPlayersMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.FlowLayoutPanel actorPalette;
private System.Windows.Forms.ComboBox actorOwnerChooser;
} }
} }

View File

@@ -16,6 +16,7 @@ using System.Windows.Forms;
using OpenRA.FileFormats; using OpenRA.FileFormats;
using OpenRA.Graphics; using OpenRA.Graphics;
using OpenRA.Traits; using OpenRA.Traits;
using System.Drawing;
namespace OpenRA.Editor namespace OpenRA.Editor
{ {
@@ -233,6 +234,11 @@ namespace OpenRA.Editor
saveToolStripMenuItem.Enabled = true; saveToolStripMenuItem.Enabled = true;
saveAsToolStripMenuItem.Enabled = true; saveAsToolStripMenuItem.Enabled = true;
mnuMinimapToPNG.Enabled = true; // todo: what is this VB naming bullshit doing here? mnuMinimapToPNG.Enabled = true; // todo: what is this VB naming bullshit doing here?
actorOwnerChooser.Items.Clear();
actorOwnerChooser.Items.AddRange(map.Players.Values.ToArray());
actorOwnerChooser.SelectedIndex = 0;
surface1.NewActorOwner = (actorOwnerChooser.SelectedItem as PlayerReference).Name;
} }
void ResizeClicked(object sender, EventArgs e) void ResizeClicked(object sender, EventArgs e)
@@ -456,5 +462,29 @@ namespace OpenRA.Editor
surface1.Chunks.Clear(); surface1.Chunks.Clear();
surface1.Invalidate(); surface1.Invalidate();
} }
void onDrawPlayerItem(object sender, DrawItemEventArgs e)
{
// color block
var player = e.Index >= 0 ? (PlayerReference)(sender as ComboBox).Items[e.Index] : null;
e.DrawBackground();
e.DrawFocusRectangle();
if (player == null)
return;
var color = player.ColorRamp.GetColor(0);
using( var brush = new SolidBrush(color) )
e.Graphics.FillRectangle( brush, e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Height + 6, e.Bounds.Height - 4 );
using( var foreBrush = new SolidBrush(e.ForeColor) )
e.Graphics.DrawString( player.Name, e.Font, foreBrush, e.Bounds.Left + e.Bounds.Height + 12, e.Bounds.Top );
}
void onSelectOwner(object sender, EventArgs e)
{
var player = actorOwnerChooser.SelectedItem as PlayerReference;
surface1.NewActorOwner = player.Name;
}
} }
} }

View File

@@ -38,6 +38,8 @@ namespace OpenRA.Editor
public bool ShowActorNames; public bool ShowActorNames;
public bool ShowGrid; public bool ShowGrid;
public string NewActorOwner;
public event Action AfterChange = () => { }; public event Action AfterChange = () => { };
public event Action<string> MousePositionChanged = _ => { }; public event Action<string> MousePositionChanged = _ => { };
@@ -302,7 +304,7 @@ namespace OpenRA.Editor
t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom); t.Bitmap.Width * Zoom, t.Bitmap.Height * Zoom);
} }
ColorPalette GetPaletteForPlayer(string name) ColorPalette GetPaletteForPlayerInner(string name)
{ {
var pr = Map.Players[name]; var pr = Map.Players[name];
var pcpi = Rules.Info["player"].Traits.Get<PlayerColorPaletteInfo>(); var pcpi = Rules.Info["player"].Traits.Get<PlayerColorPaletteInfo>();
@@ -312,16 +314,21 @@ namespace OpenRA.Editor
Cache<string, ColorPalette> PlayerPalettes; Cache<string, ColorPalette> PlayerPalettes;
ColorPalette GetPaletteForActor(ActorReference ar) public ColorPalette GetPaletteForPlayer(string player)
{ {
if (PlayerPalettes == null) if (PlayerPalettes == null)
PlayerPalettes = new Cache<string, ColorPalette>(GetPaletteForPlayer); PlayerPalettes = new Cache<string, ColorPalette>(GetPaletteForPlayerInner);
return PlayerPalettes[player];
}
ColorPalette GetPaletteForActor(ActorReference ar)
{
var ownerInit = ar.InitDict.GetOrDefault<OwnerInit>(); var ownerInit = ar.InitDict.GetOrDefault<OwnerInit>();
if (ownerInit == null) if (ownerInit == null)
return null; return null;
return PlayerPalettes[ownerInit.PlayerName]; return GetPaletteForPlayer(ownerInit.PlayerName);
} }
protected override void OnPaint(PaintEventArgs e) protected override void OnPaint(PaintEventArgs e)

View File

@@ -42,5 +42,7 @@ namespace OpenRA.FileFormats
public PlayerReference() {} public PlayerReference() {}
public PlayerReference(MiniYaml my) { FieldLoader.Load(this, my); } public PlayerReference(MiniYaml my) { FieldLoader.Load(this, my); }
public override string ToString() { return Name; }
} }
} }