mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-24 23:27:14 -05:00
Add layer switcher
This commit is contained in:
parent
91f8881808
commit
8673ead6aa
40
NHSE.WinForms/Subforms/FieldItemEditor.Designer.cs
generated
40
NHSE.WinForms/Subforms/FieldItemEditor.Designer.cs
generated
|
|
@ -52,9 +52,12 @@ private void InitializeComponent()
|
|||
this.Menu_SavePNG = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CHK_SnapToAcre = new System.Windows.Forms.CheckBox();
|
||||
this.L_Coordinates = new System.Windows.Forms.Label();
|
||||
this.NUD_Layer = new System.Windows.Forms.NumericUpDown();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.CM_Click.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
|
||||
this.CM_Picture.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Layer)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// B_Cancel
|
||||
|
|
@ -275,11 +278,45 @@ private void InitializeComponent()
|
|||
this.L_Coordinates.Text = "(000,000) = (0x00,0x00)";
|
||||
this.L_Coordinates.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||
//
|
||||
// NUD_Layer
|
||||
//
|
||||
this.NUD_Layer.Location = new System.Drawing.Point(978, 625);
|
||||
this.NUD_Layer.Maximum = new decimal(new int[] {
|
||||
2,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Layer.Minimum = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Layer.Name = "NUD_Layer";
|
||||
this.NUD_Layer.Size = new System.Drawing.Size(49, 20);
|
||||
this.NUD_Layer.TabIndex = 26;
|
||||
this.NUD_Layer.Value = new decimal(new int[] {
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Layer.ValueChanged += new System.EventHandler(this.NUD_Layer_ValueChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(919, 626);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(53, 19);
|
||||
this.label1.TabIndex = 27;
|
||||
this.label1.Text = "Layer:";
|
||||
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// FieldItemEditor
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(1061, 822);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.NUD_Layer);
|
||||
this.Controls.Add(this.L_Coordinates);
|
||||
this.Controls.Add(this.CHK_SnapToAcre);
|
||||
this.Controls.Add(this.PB_Map);
|
||||
|
|
@ -307,6 +344,7 @@ private void InitializeComponent()
|
|||
this.CM_Click.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).EndInit();
|
||||
this.CM_Picture.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Layer)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
@ -337,5 +375,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNG;
|
||||
private System.Windows.Forms.CheckBox CHK_SnapToAcre;
|
||||
private System.Windows.Forms.Label L_Coordinates;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Layer;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
|
|
@ -50,14 +50,16 @@ private void ChangeViewToAcre(int acre)
|
|||
UpdateArrowVisibility(acre);
|
||||
}
|
||||
|
||||
private FieldItemLayer Layer => NUD_Layer.Value == 1 ? Items.Layer1 : Items.Layer2;
|
||||
|
||||
private void ReloadMap()
|
||||
{
|
||||
PB_Map.Image = SpriteUtil.FieldItems.GetBitmapLayer(Items.Layer1, X, Y);
|
||||
PB_Map.Image = SpriteUtil.FieldItems.GetBitmapLayer(Layer, X, Y);
|
||||
}
|
||||
|
||||
private void LoadGrid(int topX, int topY)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
for (int x = 0; x < GridWidth; x++)
|
||||
{
|
||||
for (int y = 0; y < GridHeight; y++)
|
||||
|
|
@ -185,7 +187,7 @@ private void GetTile(object sender, out FieldItem tile, out Button obj)
|
|||
if (index < 0)
|
||||
throw new ArgumentException(nameof(Button));
|
||||
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
var x = X + (index % GridWidth);
|
||||
var y = Y + (index / GridWidth);
|
||||
tile = layer.GetTile(x, y);
|
||||
|
|
@ -204,11 +206,11 @@ private static void RefreshTile(Control button, FieldItem tile)
|
|||
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}.nhl",
|
||||
FileName = $"{CB_Acre.Text}-{NUD_Layer.Value}.nhl",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
|
@ -221,7 +223,7 @@ private void B_DumpAcre_Click(object sender, EventArgs e)
|
|||
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
|
|
@ -237,11 +239,11 @@ private void B_DumpAllAcres_Click(object sender, EventArgs e)
|
|||
|
||||
private void B_ImportAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}.nhl",
|
||||
FileName = $"{CB_Acre.Text}-{NUD_Layer.Value}.nhl",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
|
@ -264,7 +266,7 @@ private void B_ImportAcre_Click(object sender, EventArgs e)
|
|||
|
||||
private void B_ImportAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Layer;
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
|
|
@ -377,5 +379,7 @@ private void PB_Map_MouseMove(object sender, MouseEventArgs e)
|
|||
L_Coordinates.Text = $"({x:000},{y:000}) = (0x{x:X2},0x{y:X2})";
|
||||
}
|
||||
}
|
||||
|
||||
private void NUD_Layer_ValueChanged(object sender, EventArgs e) => LoadGrid(X, Y);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user