diff --git a/NHSE.WinForms/NHSE.WinForms.csproj b/NHSE.WinForms/NHSE.WinForms.csproj index a8134a2..6746482 100644 --- a/NHSE.WinForms/NHSE.WinForms.csproj +++ b/NHSE.WinForms/NHSE.WinForms.csproj @@ -43,6 +43,9 @@ Form + + Form + Form diff --git a/NHSE.WinForms/Subforms/Map/BulkSpawn.Designer.cs b/NHSE.WinForms/Subforms/Map/BulkSpawn.Designer.cs new file mode 100644 index 0000000..97e94f8 --- /dev/null +++ b/NHSE.WinForms/Subforms/Map/BulkSpawn.Designer.cs @@ -0,0 +1,251 @@ +namespace NHSE.WinForms +{ + partial class BulkSpawn + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.B_Apply = new System.Windows.Forms.Button(); + this.NUD_SpawnX = new System.Windows.Forms.NumericUpDown(); + this.NUD_SpawnY = new System.Windows.Forms.NumericUpDown(); + this.L_X = new System.Windows.Forms.Label(); + this.L_Y = new System.Windows.Forms.Label(); + this.CB_SpawnType = new System.Windows.Forms.ComboBox(); + this.L_SpawnCount = new System.Windows.Forms.Label(); + this.NUD_SpawnCount = new System.Windows.Forms.NumericUpDown(); + this.L_DIYStart = new System.Windows.Forms.Label(); + this.NUD_DIYStart = new System.Windows.Forms.NumericUpDown(); + this.L_DIYStop = new System.Windows.Forms.Label(); + this.NUD_DIYStop = new System.Windows.Forms.NumericUpDown(); + this.CB_SpawnArrange = new System.Windows.Forms.ComboBox(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnX)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnY)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnCount)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_DIYStart)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_DIYStop)).BeginInit(); + this.SuspendLayout(); + // + // B_Apply + // + this.B_Apply.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.B_Apply.Location = new System.Drawing.Point(12, 200); + this.B_Apply.Name = "B_Apply"; + this.B_Apply.Size = new System.Drawing.Size(112, 23); + this.B_Apply.TabIndex = 6; + this.B_Apply.Text = "Spawn"; + this.B_Apply.UseVisualStyleBackColor = true; + this.B_Apply.Click += new System.EventHandler(this.B_Apply_Click); + // + // NUD_SpawnX + // + this.NUD_SpawnX.Location = new System.Drawing.Point(61, 63); + this.NUD_SpawnX.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.NUD_SpawnX.Name = "NUD_SpawnX"; + this.NUD_SpawnX.Size = new System.Drawing.Size(45, 20); + this.NUD_SpawnX.TabIndex = 12; + // + // NUD_SpawnY + // + this.NUD_SpawnY.Location = new System.Drawing.Point(61, 89); + this.NUD_SpawnY.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.NUD_SpawnY.Name = "NUD_SpawnY"; + this.NUD_SpawnY.Size = new System.Drawing.Size(45, 20); + this.NUD_SpawnY.TabIndex = 13; + // + // L_X + // + this.L_X.Location = new System.Drawing.Point(14, 63); + this.L_X.Name = "L_X"; + this.L_X.Size = new System.Drawing.Size(41, 20); + this.L_X.TabIndex = 14; + this.L_X.Text = "X:"; + this.L_X.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // L_Y + // + this.L_Y.Location = new System.Drawing.Point(14, 89); + this.L_Y.Name = "L_Y"; + this.L_Y.Size = new System.Drawing.Size(41, 20); + this.L_Y.TabIndex = 15; + this.L_Y.Text = "Y:"; + this.L_Y.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // CB_SpawnType + // + this.CB_SpawnType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_SpawnType.FormattingEnabled = true; + this.CB_SpawnType.Location = new System.Drawing.Point(15, 9); + this.CB_SpawnType.Name = "CB_SpawnType"; + this.CB_SpawnType.Size = new System.Drawing.Size(108, 21); + this.CB_SpawnType.TabIndex = 16; + this.CB_SpawnType.SelectedIndexChanged += new System.EventHandler(this.CB_SpawnType_SelectedIndexChanged); + // + // L_SpawnCount + // + this.L_SpawnCount.Location = new System.Drawing.Point(14, 115); + this.L_SpawnCount.Name = "L_SpawnCount"; + this.L_SpawnCount.Size = new System.Drawing.Size(51, 20); + this.L_SpawnCount.TabIndex = 18; + this.L_SpawnCount.Text = "Count:"; + this.L_SpawnCount.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_SpawnCount + // + this.NUD_SpawnCount.Location = new System.Drawing.Point(71, 117); + this.NUD_SpawnCount.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.NUD_SpawnCount.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.NUD_SpawnCount.Name = "NUD_SpawnCount"; + this.NUD_SpawnCount.Size = new System.Drawing.Size(45, 20); + this.NUD_SpawnCount.TabIndex = 17; + this.NUD_SpawnCount.Value = new decimal(new int[] { + 10, + 0, + 0, + 0}); + // + // L_DIYStart + // + this.L_DIYStart.Location = new System.Drawing.Point(14, 141); + this.L_DIYStart.Name = "L_DIYStart"; + this.L_DIYStart.Size = new System.Drawing.Size(51, 20); + this.L_DIYStart.TabIndex = 20; + this.L_DIYStart.Text = "Start:"; + this.L_DIYStart.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_DIYStart + // + this.NUD_DIYStart.Location = new System.Drawing.Point(71, 143); + this.NUD_DIYStart.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.NUD_DIYStart.Name = "NUD_DIYStart"; + this.NUD_DIYStart.Size = new System.Drawing.Size(45, 20); + this.NUD_DIYStart.TabIndex = 19; + // + // L_DIYStop + // + this.L_DIYStop.Location = new System.Drawing.Point(14, 167); + this.L_DIYStop.Name = "L_DIYStop"; + this.L_DIYStop.Size = new System.Drawing.Size(51, 20); + this.L_DIYStop.TabIndex = 22; + this.L_DIYStop.Text = "Stop:"; + this.L_DIYStop.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + // + // NUD_DIYStop + // + this.NUD_DIYStop.Location = new System.Drawing.Point(71, 169); + this.NUD_DIYStop.Maximum = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + this.NUD_DIYStop.Name = "NUD_DIYStop"; + this.NUD_DIYStop.Size = new System.Drawing.Size(45, 20); + this.NUD_DIYStop.TabIndex = 21; + this.NUD_DIYStop.Value = new decimal(new int[] { + 9999, + 0, + 0, + 0}); + // + // CB_SpawnArrange + // + this.CB_SpawnArrange.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.CB_SpawnArrange.FormattingEnabled = true; + this.CB_SpawnArrange.Location = new System.Drawing.Point(16, 36); + this.CB_SpawnArrange.Name = "CB_SpawnArrange"; + this.CB_SpawnArrange.Size = new System.Drawing.Size(108, 21); + this.CB_SpawnArrange.TabIndex = 23; + // + // BulkSpawn + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(136, 235); + this.Controls.Add(this.CB_SpawnArrange); + this.Controls.Add(this.L_DIYStop); + this.Controls.Add(this.NUD_DIYStop); + this.Controls.Add(this.L_DIYStart); + this.Controls.Add(this.NUD_DIYStart); + this.Controls.Add(this.L_SpawnCount); + this.Controls.Add(this.NUD_SpawnCount); + this.Controls.Add(this.CB_SpawnType); + this.Controls.Add(this.L_Y); + this.Controls.Add(this.L_X); + this.Controls.Add(this.NUD_SpawnY); + this.Controls.Add(this.NUD_SpawnX); + this.Controls.Add(this.B_Apply); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Icon = global::NHSE.WinForms.Properties.Resources.icon; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "BulkSpawn"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Bulk Spawn"; + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnY)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_SpawnCount)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_DIYStart)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_DIYStop)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + private System.Windows.Forms.Button B_Apply; + private System.Windows.Forms.NumericUpDown NUD_SpawnX; + private System.Windows.Forms.NumericUpDown NUD_SpawnY; + private System.Windows.Forms.Label L_X; + private System.Windows.Forms.Label L_Y; + private System.Windows.Forms.ComboBox CB_SpawnType; + private System.Windows.Forms.Label L_SpawnCount; + private System.Windows.Forms.NumericUpDown NUD_SpawnCount; + private System.Windows.Forms.Label L_DIYStart; + private System.Windows.Forms.NumericUpDown NUD_DIYStart; + private System.Windows.Forms.Label L_DIYStop; + private System.Windows.Forms.NumericUpDown NUD_DIYStop; + private System.Windows.Forms.ComboBox CB_SpawnArrange; + } +} \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Map/BulkSpawn.cs b/NHSE.WinForms/Subforms/Map/BulkSpawn.cs new file mode 100644 index 0000000..a578904 --- /dev/null +++ b/NHSE.WinForms/Subforms/Map/BulkSpawn.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; +using NHSE.Core; + +namespace NHSE.WinForms +{ + public partial class BulkSpawn : Form + { + private readonly IItemLayerEditor Editor; + + public BulkSpawn(IItemLayerEditor editor, int x = 0, int y = 0) + { + InitializeComponent(); + this.TranslateInterface(GameInfo.CurrentLanguage); + + Editor = editor; + + CB_SpawnType.Items.AddRange(Enum.GetNames(typeof(SpawnType))); + CB_SpawnArrange.Items.AddRange(Enum.GetNames(typeof(SpawnArrangement))); + + CB_SpawnType.SelectedIndex = 0; + CB_SpawnArrange.SelectedIndex = 0; + NUD_SpawnX.Value = x; + NUD_SpawnY.Value = y; + } + + private void B_Apply_Click(object sender, EventArgs e) + { + var type = (SpawnType)CB_SpawnType.SelectedIndex; + var arrange = (SpawnArrangement)CB_SpawnArrange.SelectedIndex; + var x = (int)NUD_SpawnX.Value; + var y = (int)NUD_SpawnY.Value; + var count = (int)NUD_SpawnCount.Value; + + IEnumerable items; + int sizeX; + int sizeY; + if (type == SpawnType.SequentialDIY) + { + var min = (ushort)NUD_DIYStart.Value; + var max = (ushort)NUD_DIYStop.Value; + var diy = RecipeList.Recipes + .Where(z => min <= z.Key && z.Key <= max) + .Select(z => z.Key) + .Select(z => new Item(Item.DIYRecipe) {FreeParam = z}); + + items = Enumerable.Repeat(diy, count).SelectMany(z => z); + sizeX = sizeY = 2; + } + else + { + var item = Editor.ItemProvider.SetItem(new Item()); + items = Enumerable.Repeat(item, count); + var size = ItemInfo.GetItemSize(item); + sizeX = size.GetWidth(); + sizeY = size.GetHeight(); + } + + if (sizeX % 2 == 1) + sizeX++; + if (sizeY % 2 == 1) + sizeY++; + + var ctr = SpawnItems(Editor.SpawnLayer, items.ToArray(), x, y, arrange, sizeX, sizeY, true); + if (ctr == 0) + { + WinFormsUtil.Alert(MessageStrings.MsgFieldItemModifyNone); + return; + } + Editor.ReloadItems(); + WinFormsUtil.Alert(string.Format(MessageStrings.MsgFieldItemModifyCount, count)); + } + + private static int SpawnItems(ItemLayer layer, IReadOnlyList items, int x, int y, SpawnArrangement arrange, int sizeX, int sizeY, bool noOverwrite) + { + int x0 = x; + var newline = arrange == SpawnArrangement.Square ? (int)Math.Sqrt(items.Count * sizeX * sizeY) : items.Count; + + int ctr = 0; + for (var i = 0; i < items.Count; i++) + { + var item = items[i]; + var permission = layer.IsOccupied(item, x, y); + switch (permission) + { + case PlacedItemPermission.OutOfBounds when y >= layer.MaxHeight: + return ctr; + case PlacedItemPermission.OutOfBounds: + case PlacedItemPermission.Collision when noOverwrite: + i--; + break; + + default: + var exist = layer.GetTile(x, y); + layer.DeleteExtensionTiles(exist, x, y); + + // Set new placed data + layer.SetExtensionTiles(item, x, y); + exist.CopyFrom(item); + ctr++; + break; + } + + x += sizeX; + if (x - x0 >= newline) + { + y += sizeY; + x = x0; + } + } + + return ctr; + } + + private void CB_SpawnType_SelectedIndexChanged(object sender, EventArgs e) + { + var index = (SpawnType)CB_SpawnType.SelectedIndex; + L_DIYStart.Visible = L_DIYStop.Visible = NUD_DIYStart.Visible = NUD_DIYStop.Visible = index == SpawnType.SequentialDIY; + NUD_SpawnCount.Value = index switch + { + SpawnType.SequentialDIY => 1, + _ => 8, + }; + } + + private enum SpawnType + { + ItemFromEditor, + SequentialDIY, + } + + private enum SpawnArrangement + { + Square, + Horizontal, + } + } +} diff --git a/NHSE.WinForms/Subforms/Map/BulkSpawn.resx b/NHSE.WinForms/Subforms/Map/BulkSpawn.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NHSE.WinForms/Subforms/Map/BulkSpawn.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs b/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs index 654462b..7023ee5 100644 --- a/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs +++ b/NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs @@ -143,6 +143,7 @@ private void InitializeComponent() this.L_TileMode = new System.Windows.Forms.Label(); this.CHK_RedirectExtensionLoad = new System.Windows.Forms.CheckBox(); this.CHK_FieldItemSnap = new System.Windows.Forms.CheckBox(); + this.Menu_Spawn = new System.Windows.Forms.ToolStripMenuItem(); this.CM_Click.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit(); this.CM_Picture.SuspendLayout(); @@ -466,90 +467,91 @@ private void InitializeComponent() this.B_FillHoles, this.B_RemoveAll, this.toolStripSeparator1, - this.B_WaterFlowers}); + this.B_WaterFlowers, + this.Menu_Spawn}); this.CM_Remove.Name = "CM_Picture"; this.CM_Remove.ShowImageMargin = false; - this.CM_Remove.Size = new System.Drawing.Size(124, 252); + this.CM_Remove.Size = new System.Drawing.Size(156, 296); // // B_RemoveAllWeeds // this.B_RemoveAllWeeds.Name = "B_RemoveAllWeeds"; - this.B_RemoveAllWeeds.Size = new System.Drawing.Size(123, 22); + this.B_RemoveAllWeeds.Size = new System.Drawing.Size(155, 22); this.B_RemoveAllWeeds.Text = "Weeds"; this.B_RemoveAllWeeds.Click += new System.EventHandler(this.B_RemoveAllWeeds_Click); // // B_RemovePlants // this.B_RemovePlants.Name = "B_RemovePlants"; - this.B_RemovePlants.Size = new System.Drawing.Size(123, 22); + this.B_RemovePlants.Size = new System.Drawing.Size(155, 22); this.B_RemovePlants.Text = "Plants"; this.B_RemovePlants.Click += new System.EventHandler(this.B_RemovePlants_Click); // // B_RemoveObjects // this.B_RemoveObjects.Name = "B_RemoveObjects"; - this.B_RemoveObjects.Size = new System.Drawing.Size(123, 22); + this.B_RemoveObjects.Size = new System.Drawing.Size(155, 22); this.B_RemoveObjects.Text = "Objects"; this.B_RemoveObjects.Click += new System.EventHandler(this.B_RemoveObjects_Click); // // B_RemovePlacedItems // this.B_RemovePlacedItems.Name = "B_RemovePlacedItems"; - this.B_RemovePlacedItems.Size = new System.Drawing.Size(123, 22); + this.B_RemovePlacedItems.Size = new System.Drawing.Size(155, 22); this.B_RemovePlacedItems.Text = "Placed Items"; this.B_RemovePlacedItems.Click += new System.EventHandler(this.B_RemovePlacedItems_Click); // // B_RemoveFences // this.B_RemoveFences.Name = "B_RemoveFences"; - this.B_RemoveFences.Size = new System.Drawing.Size(123, 22); + this.B_RemoveFences.Size = new System.Drawing.Size(155, 22); this.B_RemoveFences.Text = "Fences"; this.B_RemoveFences.Click += new System.EventHandler(this.B_RemoveFences_Click); // // B_RemoveBranches // this.B_RemoveBranches.Name = "B_RemoveBranches"; - this.B_RemoveBranches.Size = new System.Drawing.Size(123, 22); + this.B_RemoveBranches.Size = new System.Drawing.Size(155, 22); this.B_RemoveBranches.Text = "Branches"; this.B_RemoveBranches.Click += new System.EventHandler(this.B_RemoveBranches_Click); // // B_RemoveShells // this.B_RemoveShells.Name = "B_RemoveShells"; - this.B_RemoveShells.Size = new System.Drawing.Size(123, 22); + this.B_RemoveShells.Size = new System.Drawing.Size(155, 22); this.B_RemoveShells.Text = "Shells"; this.B_RemoveShells.Click += new System.EventHandler(this.B_RemoveShells_Click); // // B_RemoveFlowers // this.B_RemoveFlowers.Name = "B_RemoveFlowers"; - this.B_RemoveFlowers.Size = new System.Drawing.Size(123, 22); + this.B_RemoveFlowers.Size = new System.Drawing.Size(155, 22); this.B_RemoveFlowers.Text = "Flowers"; this.B_RemoveFlowers.Click += new System.EventHandler(this.B_RemoveFlowers_Click); // // B_FillHoles // this.B_FillHoles.Name = "B_FillHoles"; - this.B_FillHoles.Size = new System.Drawing.Size(123, 22); + this.B_FillHoles.Size = new System.Drawing.Size(155, 22); this.B_FillHoles.Text = "Holes"; this.B_FillHoles.Click += new System.EventHandler(this.B_FillHoles_Click); // // B_RemoveAll // this.B_RemoveAll.Name = "B_RemoveAll"; - this.B_RemoveAll.Size = new System.Drawing.Size(123, 22); + this.B_RemoveAll.Size = new System.Drawing.Size(155, 22); this.B_RemoveAll.Text = "All"; this.B_RemoveAll.Click += new System.EventHandler(this.B_RemoveAll_Click); // // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(120, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(152, 6); // // B_WaterFlowers // this.B_WaterFlowers.Name = "B_WaterFlowers"; - this.B_WaterFlowers.Size = new System.Drawing.Size(123, 22); + this.B_WaterFlowers.Size = new System.Drawing.Size(155, 22); this.B_WaterFlowers.Text = "Water Flowers"; this.B_WaterFlowers.Click += new System.EventHandler(this.B_WaterFlowers_Click); // @@ -1327,6 +1329,13 @@ private void InitializeComponent() this.CHK_FieldItemSnap.Text = "Snap Field Items to Grid on Set"; this.CHK_FieldItemSnap.UseVisualStyleBackColor = true; // + // Menu_Spawn + // + this.Menu_Spawn.Name = "Menu_Spawn"; + this.Menu_Spawn.Size = new System.Drawing.Size(155, 22); + this.Menu_Spawn.Text = "Spawn..."; + this.Menu_Spawn.Click += new System.EventHandler(this.Menu_Spawn_Click); + // // FieldItemEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1514,5 +1523,6 @@ private void InitializeComponent() private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem B_WaterFlowers; private System.Windows.Forms.CheckBox CHK_FieldItemSnap; + private System.Windows.Forms.ToolStripMenuItem Menu_Spawn; } } \ No newline at end of file diff --git a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs index 49c0148..f8d6d45 100644 --- a/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs +++ b/NHSE.WinForms/Subforms/Map/FieldItemEditor.cs @@ -8,7 +8,7 @@ namespace NHSE.WinForms { - public sealed partial class FieldItemEditor : Form + public sealed partial class FieldItemEditor : Form, IItemLayerEditor { private readonly MainSave SAV; @@ -24,6 +24,9 @@ public sealed partial class FieldItemEditor : Form private int DragY = -1; private bool Dragging; + public ItemEditor ItemProvider => ItemEdit; + public ItemLayer SpawnLayer => Map.CurrentLayer; + public FieldItemEditor(MainSave sav) { InitializeComponent(); @@ -117,7 +120,7 @@ private void ReloadAcreBackground() private void ReloadMapItemGrid() => PB_Map.Image = View.GetMapWithReticle(GetItemTransparency()); private void ReloadAcreItemGrid() => PB_Acre.Image = View.GetLayerAcre(GetItemTransparency()); - private void ReloadItems() + public void ReloadItems() { ReloadAcreItemGrid(); ReloadMapItemGrid(); @@ -885,5 +888,14 @@ private void B_ClearPlacedDesigns_Click(object sender, EventArgs e) MapManager.ClearDesignTiles(SAV); System.Media.SystemSounds.Asterisk.Play(); } + + private void Menu_Spawn_Click(object sender, EventArgs e) => new BulkSpawn(this, View.X, View.Y).ShowDialog(); + } + + public interface IItemLayerEditor + { + void ReloadItems(); + ItemEditor ItemProvider { get; } + ItemLayer SpawnLayer { get; } } }