mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-24 23:27:14 -05:00
Refactoring: Field Item Editor + buildings/terrain
Extracts logic from the building & terrain & field item editors for reuse / separation of concerns Have FieldItemEditor select between Items & Terrain so that you can change the popup menu mode (view set delete) Not sure how I want to show the terrain names...
This commit is contained in:
parent
1dbf1e9338
commit
4690cfe167
|
|
@ -179,8 +179,8 @@ public void SetAcreBytes(byte[] data)
|
|||
data.CopyTo(Data, Offsets.OutsideField);
|
||||
}
|
||||
|
||||
public TerrainTile[] GetTerrain() => TerrainTile.GetArray(Data.Slice(Offsets.LandMakingMap, MapGrid.MapTileCount16x16 * TerrainTile.SIZE));
|
||||
public void SetTerrain(IReadOnlyList<TerrainTile> array) => TerrainTile.SetArray(array).CopyTo(Data, Offsets.LandMakingMap);
|
||||
public TerrainTile[] GetTerrainTiles() => TerrainTile.GetArray(Data.Slice(Offsets.LandMakingMap, MapGrid.MapTileCount16x16 * TerrainTile.SIZE));
|
||||
public void SetTerrainTiles(IReadOnlyList<TerrainTile> array) => TerrainTile.SetArray(array).CopyTo(Data, Offsets.LandMakingMap);
|
||||
|
||||
public FieldItem[] GetFieldItems() => FieldItem.GetArray(Data.Slice(Offsets.FieldItem, MapGrid.MapTileCount32x32 * FieldItem.SIZE * 2));
|
||||
public void SetFieldItems(IReadOnlyList<FieldItem> array) => FieldItem.SetArray(array).CopyTo(Data, Offsets.FieldItem);
|
||||
|
|
|
|||
|
|
@ -92,16 +92,14 @@ public void GetBuildingCoordinate(ushort bx, ushort by, int scale, out int x, ou
|
|||
y = (int)(((by / 2f) - buildingShift) * scale);
|
||||
}
|
||||
|
||||
public bool GetBuildingRelativeCoordinate(int topX, int topY, int acreScale, ushort bx, ushort by, out int relX, out int relY)
|
||||
public void GetBuildingRelativeCoordinates(int topX, int topY, int acreScale, ushort bx, ushort by, out int relX, out int relY)
|
||||
{
|
||||
GetBuildingCoordinate(bx, by, acreScale, out var x, out var y);
|
||||
relX = x - (topX * acreScale);
|
||||
relY = y - (topY * acreScale);
|
||||
|
||||
return IsWithinGrid(acreScale, relX, relY);
|
||||
}
|
||||
|
||||
private bool IsWithinGrid(int acreScale, int relX, int relY)
|
||||
public bool IsWithinGrid(int acreScale, int relX, int relY)
|
||||
{
|
||||
if ((uint)relX >= GridWidth * acreScale)
|
||||
return false;
|
||||
|
|
|
|||
27
NHSE.Core/Structures/Misc/MapManager.cs
Normal file
27
NHSE.Core/Structures/Misc/MapManager.cs
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace NHSE.Core
|
||||
{
|
||||
public class MapManager
|
||||
{
|
||||
public readonly FieldItemManager Items;
|
||||
public readonly TerrainManager Terrain;
|
||||
public readonly IReadOnlyList<Building> Buildings;
|
||||
|
||||
public uint PlazaX { get; set; }
|
||||
public uint PlazaY { get; set; }
|
||||
|
||||
public int MapLayer { get; set; } // 0 or 1
|
||||
|
||||
public MapManager(MainSave sav)
|
||||
{
|
||||
Items = new FieldItemManager(sav.GetFieldItems());
|
||||
Terrain = new TerrainManager(sav.GetTerrainTiles());
|
||||
Buildings = sav.Buildings;
|
||||
PlazaX = sav.PlazaX;
|
||||
PlazaY = sav.PlazaY;
|
||||
}
|
||||
|
||||
public FieldItemLayer CurrentLayer => MapLayer == 0 ? Items.Layer1 : Items.Layer2;
|
||||
}
|
||||
}
|
||||
90
NHSE.Core/Structures/Misc/MapView.cs
Normal file
90
NHSE.Core/Structures/Misc/MapView.cs
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
using System;
|
||||
|
||||
namespace NHSE.Core
|
||||
{
|
||||
public class MapView
|
||||
{
|
||||
private const int ViewInterval = 2;
|
||||
protected readonly MapManager Map;
|
||||
|
||||
public int MapScale { get; set; } = 1;
|
||||
public int AcreScale { get; set; } = 16;
|
||||
|
||||
// Top Left Anchor Coordinates
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
|
||||
protected MapView(MapManager m) => Map = m;
|
||||
|
||||
public bool CanUp => Y != 0;
|
||||
public bool CanDown => Y < Map.CurrentLayer.MapHeight - Map.CurrentLayer.GridHeight;
|
||||
public bool CanLeft => X != 0;
|
||||
public bool CanRight => X < Map.CurrentLayer.MapWidth - Map.CurrentLayer.GridWidth;
|
||||
|
||||
public bool ArrowUp()
|
||||
{
|
||||
if (Y <= 0)
|
||||
return false;
|
||||
Y -= ViewInterval;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ArrowLeft()
|
||||
{
|
||||
if (X <= 0)
|
||||
return false;
|
||||
X -= ViewInterval;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ArrowRight()
|
||||
{
|
||||
if (X >= Map.CurrentLayer.MapWidth - 2)
|
||||
return false;
|
||||
X += ViewInterval;
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool ArrowDown()
|
||||
{
|
||||
if (Y >= Map.CurrentLayer.MapHeight - ViewInterval)
|
||||
return false;
|
||||
Y += ViewInterval;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetViewTo(in int x, in int y)
|
||||
{
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
|
||||
public void SetViewToAcre(in int acre)
|
||||
{
|
||||
var layer = Map.Items.Layer1;
|
||||
layer.GetViewAnchorCoordinates(acre, out var x, out var y);
|
||||
SetViewTo(x, y);
|
||||
}
|
||||
|
||||
public int RemoveFieldItems(Func<int, int, int, int, int> removal, bool wholeMap = false)
|
||||
{
|
||||
var layer = Map.CurrentLayer;
|
||||
return wholeMap
|
||||
? removal(0, 0, layer.MapWidth, layer.MapHeight)
|
||||
: removal(X, Y, layer.GridWidth, layer.GridHeight);
|
||||
}
|
||||
|
||||
public void GetCursorCoordinates(in int mX, in int mY, out int x, out int y)
|
||||
{
|
||||
x = mX / MapScale;
|
||||
y = mY / MapScale;
|
||||
}
|
||||
|
||||
public void GetViewAnchorCoordinates(int mX, int mY, out int x, out int y, bool centerReticle)
|
||||
{
|
||||
GetCursorCoordinates(mX, mY, out x, out y);
|
||||
var layer = Map.Items.Layer1;
|
||||
layer.GetViewAnchorCoordinates(ref x, ref y, centerReticle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ private static void DrawBuilding(Graphics gfx, Font? f, int scale, Brush pen, in
|
|||
}
|
||||
}
|
||||
|
||||
public static Image GetAcre(in int topX, in int topY, TerrainManager t, int acreScale)
|
||||
public static Bitmap GetAcre(in int topX, in int topY, TerrainManager t, int acreScale)
|
||||
{
|
||||
int[] data = new int[16 * 16];
|
||||
int index = 0;
|
||||
|
|
@ -128,21 +128,25 @@ public static Image GetAcre(in int topX, in int topY, TerrainManager t, int acre
|
|||
return ImageUtil.GetBitmap(final, fw, fh);
|
||||
}
|
||||
|
||||
public static Image GetAcre(in int topX, in int topY, TerrainManager t, int acreScale, IReadOnlyList<Building> buildings, ushort plazaX, ushort plazaY)
|
||||
public static Bitmap GetAcre(in int topX, in int topY, TerrainManager t, int acreScale, IReadOnlyList<Building> buildings, ushort plazaX, ushort plazaY, Font f, int index = -1)
|
||||
{
|
||||
var img = GetAcre(topX, topY, t, acreScale);
|
||||
using var gfx = Graphics.FromImage(img);
|
||||
|
||||
gfx.DrawAcrePlaza(t, topX, topY, plazaX, plazaY, acreScale);
|
||||
|
||||
foreach (var b in buildings)
|
||||
for (var i = 0; i < buildings.Count; i++)
|
||||
{
|
||||
if (!t.GetBuildingRelativeCoordinate(topX, topY, acreScale, b.X, b.Y, out var x, out var y))
|
||||
{
|
||||
// Draw the rectangle anyways. The graphics object will write the cropped rectangle correctly!
|
||||
}
|
||||
var b = buildings[i];
|
||||
t.GetBuildingRelativeCoordinates(topX, topY, acreScale, b.X, b.Y, out var x, out var y);
|
||||
|
||||
DrawBuilding(gfx, null, acreScale, Others, x, y, b, Text);
|
||||
var pen = index == i ? Selected : Others;
|
||||
DrawBuilding(gfx, null, acreScale, pen, x, y, b, Text);
|
||||
|
||||
if (!t.IsWithinGrid(acreScale, x, y))
|
||||
continue;
|
||||
var name = b.BuildingType.ToString();
|
||||
gfx.DrawString(name, f, Text, new PointF(x, y - (acreScale * 2)), BuildingTextFormat);
|
||||
}
|
||||
|
||||
return img;
|
||||
|
|
@ -150,10 +154,7 @@ public static Image GetAcre(in int topX, in int topY, TerrainManager t, int acre
|
|||
|
||||
private static void DrawAcrePlaza(this Graphics gfx, TerrainManager g, int topX, int topY, ushort px, ushort py, int scale)
|
||||
{
|
||||
if (!g.GetBuildingRelativeCoordinate(topX, topY, scale, px, py, out var x, out var y))
|
||||
{
|
||||
// Draw the rectangle anyways. The graphics object will write the cropped rectangle correctly!
|
||||
}
|
||||
g.GetBuildingRelativeCoordinates(topX, topY, scale, px, py, out var x, out var y);
|
||||
|
||||
var width = scale * PlazaWidth;
|
||||
var height = scale * PlazaHeight;
|
||||
|
|
|
|||
|
|
@ -40,6 +40,9 @@
|
|||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Subforms\Map\BuildingHelp.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Subforms\Map\LandFlagEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
@ -61,9 +64,7 @@
|
|||
<Compile Update="Subforms\PropertyEditor - Copy.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Subforms\Map\FieldItemEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Subforms\Map\FieldItemEditor.cs" />
|
||||
<Compile Update="Subforms\Map\TerrainEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHSE.Core;
|
||||
using NHSE.Sprites;
|
||||
|
|
@ -20,7 +19,7 @@ public BuildingEditor(IReadOnlyList<Building> buildings, MainSave sav)
|
|||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
SAV = sav;
|
||||
Buildings = buildings;
|
||||
Terrain = new TerrainManager(sav.GetTerrain());
|
||||
Terrain = new TerrainManager(sav.GetTerrainTiles());
|
||||
|
||||
NUD_PlazaX.Value = sav.PlazaX;
|
||||
NUD_PlazaY.Value = sav.PlazaY;
|
||||
|
|
@ -122,49 +121,15 @@ private void CB_StructureType_SelectedIndexChanged(object sender, EventArgs e)
|
|||
|
||||
private void NUD_PlazaCoordinate_ValueChanged(object sender, EventArgs e) => DrawMap(Index);
|
||||
|
||||
private void B_DumpAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Building List (*.nhb)|*.nhb|All files (*.*)|*.*",
|
||||
FileName = "buildings.nhb",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
byte[] data = Building.SetArray(Buildings);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
private void B_DumpAll_Click(object sender, EventArgs e) => MapDumpHelper.DumpBuildings(Buildings);
|
||||
|
||||
private void B_ImportAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Building List (*.nhb)|*.nhb|All files (*.*)|*.*",
|
||||
FileName = "buildings.nhb",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
if (!MapDumpHelper.ImportBuildings(Buildings))
|
||||
return;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
const int expect = Building.SIZE * MainSaveOffsets.BuildingCount; // 46
|
||||
const int oldSize = Building.SIZE * 40;
|
||||
if (fi.Length != expect && fi.Length != oldSize)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
var arr = Building.GetArray(data);
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
{
|
||||
Buildings[i].CopyFrom(arr[i]);
|
||||
for (int i = 0; i < Buildings.Count; i++)
|
||||
LB_Items.Items[i] = Buildings[i].ToString();
|
||||
}
|
||||
LB_Items.SelectedIndex = 0;
|
||||
DrawMap(0);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
|
|
|
|||
107
NHSE.WinForms/Subforms/Map/BuildingHelp.Designer.cs
generated
Normal file
107
NHSE.WinForms/Subforms/Map/BuildingHelp.Designer.cs
generated
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
namespace NHSE.WinForms
|
||||
{
|
||||
partial class BuildingHelp
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.L_StructureValues = new System.Windows.Forms.Label();
|
||||
this.CB_StructureValues = new System.Windows.Forms.ComboBox();
|
||||
this.L_StructureType = new System.Windows.Forms.Label();
|
||||
this.CB_StructureType = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// L_StructureValues
|
||||
//
|
||||
this.L_StructureValues.AutoSize = true;
|
||||
this.L_StructureValues.Location = new System.Drawing.Point(12, 55);
|
||||
this.L_StructureValues.Name = "L_StructureValues";
|
||||
this.L_StructureValues.Size = new System.Drawing.Size(42, 13);
|
||||
this.L_StructureValues.TabIndex = 22;
|
||||
this.L_StructureValues.Text = "Values:";
|
||||
this.L_StructureValues.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// CB_StructureValues
|
||||
//
|
||||
this.CB_StructureValues.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CB_StructureValues.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_StructureValues.DropDownWidth = 322;
|
||||
this.CB_StructureValues.FormattingEnabled = true;
|
||||
this.CB_StructureValues.Location = new System.Drawing.Point(15, 71);
|
||||
this.CB_StructureValues.Name = "CB_StructureValues";
|
||||
this.CB_StructureValues.Size = new System.Drawing.Size(221, 21);
|
||||
this.CB_StructureValues.TabIndex = 21;
|
||||
//
|
||||
// L_StructureType
|
||||
//
|
||||
this.L_StructureType.AutoSize = true;
|
||||
this.L_StructureType.Location = new System.Drawing.Point(12, 9);
|
||||
this.L_StructureType.Name = "L_StructureType";
|
||||
this.L_StructureType.Size = new System.Drawing.Size(80, 13);
|
||||
this.L_StructureType.TabIndex = 20;
|
||||
this.L_StructureType.Text = "Structure Type:";
|
||||
this.L_StructureType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// CB_StructureType
|
||||
//
|
||||
this.CB_StructureType.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CB_StructureType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_StructureType.FormattingEnabled = true;
|
||||
this.CB_StructureType.Location = new System.Drawing.Point(15, 26);
|
||||
this.CB_StructureType.Name = "CB_StructureType";
|
||||
this.CB_StructureType.Size = new System.Drawing.Size(221, 21);
|
||||
this.CB_StructureType.TabIndex = 0;
|
||||
this.CB_StructureType.SelectedIndexChanged += new System.EventHandler(this.CB_StructureType_SelectedIndexChanged);
|
||||
//
|
||||
// BuildingHelp
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(251, 107);
|
||||
this.Controls.Add(this.L_StructureValues);
|
||||
this.Controls.Add(this.CB_StructureValues);
|
||||
this.Controls.Add(this.CB_StructureType);
|
||||
this.Controls.Add(this.L_StructureType);
|
||||
this.Icon = global::NHSE.WinForms.Properties.Resources.icon;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "BuildingHelp";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "Building Help";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
private System.Windows.Forms.Label L_StructureValues;
|
||||
private System.Windows.Forms.ComboBox CB_StructureValues;
|
||||
private System.Windows.Forms.Label L_StructureType;
|
||||
private System.Windows.Forms.ComboBox CB_StructureType;
|
||||
}
|
||||
}
|
||||
32
NHSE.WinForms/Subforms/Map/BuildingHelp.cs
Normal file
32
NHSE.WinForms/Subforms/Map/BuildingHelp.cs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
using NHSE.Core;
|
||||
|
||||
namespace NHSE.WinForms
|
||||
{
|
||||
public partial class BuildingHelp : Form
|
||||
{
|
||||
private static readonly IReadOnlyDictionary<string, string[]> HelpDictionary = StructureUtil.GetStructureHelpList();
|
||||
|
||||
public BuildingHelp()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
|
||||
foreach (var entry in HelpDictionary)
|
||||
CB_StructureType.Items.Add(entry.Key);
|
||||
CB_StructureType.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void CB_StructureType_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
var name = CB_StructureType.Text;
|
||||
var values = HelpDictionary[name];
|
||||
CB_StructureValues.Items.Clear();
|
||||
foreach (var item in values)
|
||||
CB_StructureValues.Items.Add(item);
|
||||
CB_StructureValues.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
120
NHSE.WinForms/Subforms/Map/BuildingHelp.resx
Normal file
120
NHSE.WinForms/Subforms/Map/BuildingHelp.resx
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
799
NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs
generated
799
NHSE.WinForms/Subforms/Map/FieldItemEditor.Designer.cs
generated
|
|
@ -16,8 +16,7 @@ protected override void Dispose(bool disposing)
|
|||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
ScaleAcre.Dispose();
|
||||
MapReticle.Dispose();
|
||||
View.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
|
@ -36,10 +35,6 @@ private void InitializeComponent()
|
|||
this.PG_Tile = new System.Windows.Forms.PropertyGrid();
|
||||
this.CB_Acre = new System.Windows.Forms.ComboBox();
|
||||
this.L_Acre = new System.Windows.Forms.Label();
|
||||
this.B_DumpAcre = new System.Windows.Forms.Button();
|
||||
this.B_DumpAllAcres = new System.Windows.Forms.Button();
|
||||
this.B_ImportAllAcres = new System.Windows.Forms.Button();
|
||||
this.B_ImportAcre = new System.Windows.Forms.Button();
|
||||
this.CM_Click = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.Menu_View = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Menu_Set = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
|
@ -70,6 +65,57 @@ private void InitializeComponent()
|
|||
this.B_FillHoles = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_RemoveAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.GB_Remove = new System.Windows.Forms.Label();
|
||||
this.TC_Editor = new System.Windows.Forms.TabControl();
|
||||
this.Tab_Item = new System.Windows.Forms.TabPage();
|
||||
this.B_DumpLoadField = new System.Windows.Forms.Button();
|
||||
this.CM_DLField = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.B_DumpAcre = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_DumpAllAcres = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_ImportAcre = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_ImportAllAcres = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.Tab_Building = new System.Windows.Forms.TabPage();
|
||||
this.B_DumpLoadBuildings = new System.Windows.Forms.Button();
|
||||
this.CM_DLBuilding = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.B_DumpBuildings = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_ImportBuildings = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.L_Bit = new System.Windows.Forms.Label();
|
||||
this.NUD_Bit = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_BuildingType = new System.Windows.Forms.Label();
|
||||
this.NUD_BuildingType = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_UniqueID = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_BuildingX = new System.Windows.Forms.Label();
|
||||
this.L_BuildingUniqueID = new System.Windows.Forms.Label();
|
||||
this.NUD_X = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_TypeArg = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_BuildingY = new System.Windows.Forms.Label();
|
||||
this.L_BuildingStructureArg = new System.Windows.Forms.Label();
|
||||
this.NUD_Y = new System.Windows.Forms.NumericUpDown();
|
||||
this.NUD_Type = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_BuildingRotation = new System.Windows.Forms.Label();
|
||||
this.L_BuildingStructureType = new System.Windows.Forms.Label();
|
||||
this.NUD_Angle = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_PlazaX = new System.Windows.Forms.Label();
|
||||
this.NUD_PlazaX = new System.Windows.Forms.NumericUpDown();
|
||||
this.L_PlazaY = new System.Windows.Forms.Label();
|
||||
this.NUD_PlazaY = new System.Windows.Forms.NumericUpDown();
|
||||
this.B_Help = new System.Windows.Forms.Button();
|
||||
this.LB_Items = new System.Windows.Forms.ListBox();
|
||||
this.Tab_Terrain = new System.Windows.Forms.TabPage();
|
||||
this.PG_TerrainTile = new System.Windows.Forms.PropertyGrid();
|
||||
this.B_DumpLoadTerrain = new System.Windows.Forms.Button();
|
||||
this.B_ModifyAllTerrain = new System.Windows.Forms.Button();
|
||||
this.L_FieldItemTransparency = new System.Windows.Forms.Label();
|
||||
this.CM_DLTerrain = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.B_DumpTerrainAcre = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_DumpTerrainAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_ImportTerrainAcre = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_ImportTerrainAll = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.CM_Terrain = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.B_ZeroElevation = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.B_SetAllTerrain = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RB_Item = new System.Windows.Forms.RadioButton();
|
||||
this.RB_Terrain = new System.Windows.Forms.RadioButton();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.CM_Click.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
|
||||
this.CM_Picture.SuspendLayout();
|
||||
|
|
@ -77,12 +123,30 @@ private void InitializeComponent()
|
|||
((System.ComponentModel.ISupportInitialize)(this.PB_Acre)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TR_Transparency)).BeginInit();
|
||||
this.CM_Remove.SuspendLayout();
|
||||
this.TC_Editor.SuspendLayout();
|
||||
this.Tab_Item.SuspendLayout();
|
||||
this.CM_DLField.SuspendLayout();
|
||||
this.Tab_Building.SuspendLayout();
|
||||
this.CM_DLBuilding.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Bit)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_BuildingType)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_UniqueID)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TypeArg)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Type)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Angle)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaX)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaY)).BeginInit();
|
||||
this.Tab_Terrain.SuspendLayout();
|
||||
this.CM_DLTerrain.SuspendLayout();
|
||||
this.CM_Terrain.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// B_Cancel
|
||||
//
|
||||
this.B_Cancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Cancel.Location = new System.Drawing.Point(820, 502);
|
||||
this.B_Cancel.Location = new System.Drawing.Point(866, 502);
|
||||
this.B_Cancel.Name = "B_Cancel";
|
||||
this.B_Cancel.Size = new System.Drawing.Size(72, 23);
|
||||
this.B_Cancel.TabIndex = 7;
|
||||
|
|
@ -93,7 +157,7 @@ private void InitializeComponent()
|
|||
// B_Save
|
||||
//
|
||||
this.B_Save.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Save.Location = new System.Drawing.Point(898, 502);
|
||||
this.B_Save.Location = new System.Drawing.Point(944, 502);
|
||||
this.B_Save.Name = "B_Save";
|
||||
this.B_Save.Size = new System.Drawing.Size(72, 23);
|
||||
this.B_Save.TabIndex = 6;
|
||||
|
|
@ -106,10 +170,10 @@ private void InitializeComponent()
|
|||
this.PG_Tile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PG_Tile.HelpVisible = false;
|
||||
this.PG_Tile.Location = new System.Drawing.Point(767, 12);
|
||||
this.PG_Tile.Location = new System.Drawing.Point(3, 3);
|
||||
this.PG_Tile.Name = "PG_Tile";
|
||||
this.PG_Tile.PropertySort = System.Windows.Forms.PropertySort.Categorized;
|
||||
this.PG_Tile.Size = new System.Drawing.Size(202, 372);
|
||||
this.PG_Tile.Size = new System.Drawing.Size(238, 390);
|
||||
this.PG_Tile.TabIndex = 9;
|
||||
this.PG_Tile.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this.PG_Tile_PropertyValueChanged);
|
||||
//
|
||||
|
|
@ -117,7 +181,7 @@ private void InitializeComponent()
|
|||
//
|
||||
this.CB_Acre.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.CB_Acre.FormattingEnabled = true;
|
||||
this.CB_Acre.Location = new System.Drawing.Point(691, 337);
|
||||
this.CB_Acre.Location = new System.Drawing.Point(712, 259);
|
||||
this.CB_Acre.Name = "CB_Acre";
|
||||
this.CB_Acre.Size = new System.Drawing.Size(49, 21);
|
||||
this.CB_Acre.TabIndex = 10;
|
||||
|
|
@ -125,52 +189,12 @@ private void InitializeComponent()
|
|||
//
|
||||
// L_Acre
|
||||
//
|
||||
this.L_Acre.AutoSize = true;
|
||||
this.L_Acre.Location = new System.Drawing.Point(653, 340);
|
||||
this.L_Acre.Location = new System.Drawing.Point(619, 262);
|
||||
this.L_Acre.Name = "L_Acre";
|
||||
this.L_Acre.Size = new System.Drawing.Size(32, 13);
|
||||
this.L_Acre.Size = new System.Drawing.Size(87, 19);
|
||||
this.L_Acre.TabIndex = 11;
|
||||
this.L_Acre.Text = "Acre:";
|
||||
//
|
||||
// B_DumpAcre
|
||||
//
|
||||
this.B_DumpAcre.Location = new System.Drawing.Point(532, 439);
|
||||
this.B_DumpAcre.Name = "B_DumpAcre";
|
||||
this.B_DumpAcre.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_DumpAcre.TabIndex = 14;
|
||||
this.B_DumpAcre.Text = "Dump Acre";
|
||||
this.B_DumpAcre.UseVisualStyleBackColor = true;
|
||||
this.B_DumpAcre.Click += new System.EventHandler(this.B_DumpAcre_Click);
|
||||
//
|
||||
// B_DumpAllAcres
|
||||
//
|
||||
this.B_DumpAllAcres.Location = new System.Drawing.Point(532, 485);
|
||||
this.B_DumpAllAcres.Name = "B_DumpAllAcres";
|
||||
this.B_DumpAllAcres.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_DumpAllAcres.TabIndex = 15;
|
||||
this.B_DumpAllAcres.Text = "Dump All Acres";
|
||||
this.B_DumpAllAcres.UseVisualStyleBackColor = true;
|
||||
this.B_DumpAllAcres.Click += new System.EventHandler(this.B_DumpAllAcres_Click);
|
||||
//
|
||||
// B_ImportAllAcres
|
||||
//
|
||||
this.B_ImportAllAcres.Location = new System.Drawing.Point(649, 485);
|
||||
this.B_ImportAllAcres.Name = "B_ImportAllAcres";
|
||||
this.B_ImportAllAcres.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_ImportAllAcres.TabIndex = 17;
|
||||
this.B_ImportAllAcres.Text = "Import All Acres";
|
||||
this.B_ImportAllAcres.UseVisualStyleBackColor = true;
|
||||
this.B_ImportAllAcres.Click += new System.EventHandler(this.B_ImportAllAcres_Click);
|
||||
//
|
||||
// B_ImportAcre
|
||||
//
|
||||
this.B_ImportAcre.Location = new System.Drawing.Point(649, 439);
|
||||
this.B_ImportAcre.Name = "B_ImportAcre";
|
||||
this.B_ImportAcre.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_ImportAcre.TabIndex = 16;
|
||||
this.B_ImportAcre.Text = "Import Acre";
|
||||
this.B_ImportAcre.UseVisualStyleBackColor = true;
|
||||
this.B_ImportAcre.Click += new System.EventHandler(this.B_ImportAcre_Click);
|
||||
this.L_Acre.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// CM_Click
|
||||
//
|
||||
|
|
@ -204,7 +228,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// B_Up
|
||||
//
|
||||
this.B_Up.Location = new System.Drawing.Point(581, 300);
|
||||
this.B_Up.Location = new System.Drawing.Point(581, 285);
|
||||
this.B_Up.Name = "B_Up";
|
||||
this.B_Up.Size = new System.Drawing.Size(32, 32);
|
||||
this.B_Up.TabIndex = 18;
|
||||
|
|
@ -214,7 +238,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// B_Left
|
||||
//
|
||||
this.B_Left.Location = new System.Drawing.Point(551, 330);
|
||||
this.B_Left.Location = new System.Drawing.Point(551, 315);
|
||||
this.B_Left.Name = "B_Left";
|
||||
this.B_Left.Size = new System.Drawing.Size(32, 32);
|
||||
this.B_Left.TabIndex = 19;
|
||||
|
|
@ -224,7 +248,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// B_Right
|
||||
//
|
||||
this.B_Right.Location = new System.Drawing.Point(611, 330);
|
||||
this.B_Right.Location = new System.Drawing.Point(611, 315);
|
||||
this.B_Right.Name = "B_Right";
|
||||
this.B_Right.Size = new System.Drawing.Size(32, 32);
|
||||
this.B_Right.TabIndex = 20;
|
||||
|
|
@ -234,7 +258,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// B_Down
|
||||
//
|
||||
this.B_Down.Location = new System.Drawing.Point(581, 360);
|
||||
this.B_Down.Location = new System.Drawing.Point(581, 345);
|
||||
this.B_Down.Name = "B_Down";
|
||||
this.B_Down.Size = new System.Drawing.Size(32, 32);
|
||||
this.B_Down.TabIndex = 22;
|
||||
|
|
@ -294,7 +318,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// NUD_Layer
|
||||
//
|
||||
this.NUD_Layer.Location = new System.Drawing.Point(691, 364);
|
||||
this.NUD_Layer.Location = new System.Drawing.Point(712, 286);
|
||||
this.NUD_Layer.Maximum = new decimal(new int[] {
|
||||
2,
|
||||
0,
|
||||
|
|
@ -317,9 +341,9 @@ private void InitializeComponent()
|
|||
//
|
||||
// L_Layer
|
||||
//
|
||||
this.L_Layer.Location = new System.Drawing.Point(632, 365);
|
||||
this.L_Layer.Location = new System.Drawing.Point(619, 287);
|
||||
this.L_Layer.Name = "L_Layer";
|
||||
this.L_Layer.Size = new System.Drawing.Size(53, 19);
|
||||
this.L_Layer.Size = new System.Drawing.Size(87, 19);
|
||||
this.L_Layer.TabIndex = 27;
|
||||
this.L_Layer.Text = "Layer:";
|
||||
this.L_Layer.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
|
|
@ -342,10 +366,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// TR_Transparency
|
||||
//
|
||||
this.TR_Transparency.Location = new System.Drawing.Point(535, 250);
|
||||
this.TR_Transparency.Location = new System.Drawing.Point(529, 481);
|
||||
this.TR_Transparency.Maximum = 100;
|
||||
this.TR_Transparency.Name = "TR_Transparency";
|
||||
this.TR_Transparency.Size = new System.Drawing.Size(226, 45);
|
||||
this.TR_Transparency.Size = new System.Drawing.Size(234, 45);
|
||||
this.TR_Transparency.TabIndex = 36;
|
||||
this.TR_Transparency.TickFrequency = 10;
|
||||
this.TR_Transparency.Value = 90;
|
||||
|
|
@ -356,11 +380,11 @@ private void InitializeComponent()
|
|||
this.CHK_NoOverwrite.AutoSize = true;
|
||||
this.CHK_NoOverwrite.Checked = true;
|
||||
this.CHK_NoOverwrite.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.CHK_NoOverwrite.Location = new System.Drawing.Point(534, 416);
|
||||
this.CHK_NoOverwrite.Location = new System.Drawing.Point(533, 435);
|
||||
this.CHK_NoOverwrite.Name = "CHK_NoOverwrite";
|
||||
this.CHK_NoOverwrite.Size = new System.Drawing.Size(173, 17);
|
||||
this.CHK_NoOverwrite.Size = new System.Drawing.Size(196, 17);
|
||||
this.CHK_NoOverwrite.TabIndex = 37;
|
||||
this.CHK_NoOverwrite.Text = "Prevent Writing Occupied Tiles";
|
||||
this.CHK_NoOverwrite.Text = "Prevent Writing Occupied Item Tiles";
|
||||
this.CHK_NoOverwrite.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// CHK_AutoExtension
|
||||
|
|
@ -368,16 +392,17 @@ private void InitializeComponent()
|
|||
this.CHK_AutoExtension.AutoSize = true;
|
||||
this.CHK_AutoExtension.Checked = true;
|
||||
this.CHK_AutoExtension.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.CHK_AutoExtension.Location = new System.Drawing.Point(532, 398);
|
||||
this.CHK_AutoExtension.Location = new System.Drawing.Point(533, 417);
|
||||
this.CHK_AutoExtension.Name = "CHK_AutoExtension";
|
||||
this.CHK_AutoExtension.Size = new System.Drawing.Size(197, 17);
|
||||
this.CHK_AutoExtension.Size = new System.Drawing.Size(202, 17);
|
||||
this.CHK_AutoExtension.TabIndex = 38;
|
||||
this.CHK_AutoExtension.Text = "Automatically Set/Delete Extensions";
|
||||
this.CHK_AutoExtension.Text = "Handle Item Extensions Automatically";
|
||||
this.CHK_AutoExtension.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// B_RemoveItemDropDown
|
||||
//
|
||||
this.B_RemoveItemDropDown.Location = new System.Drawing.Point(767, 439);
|
||||
this.B_RemoveItemDropDown.ContextMenuStrip = this.CM_Remove;
|
||||
this.B_RemoveItemDropDown.Location = new System.Drawing.Point(126, 413);
|
||||
this.B_RemoveItemDropDown.Name = "B_RemoveItemDropDown";
|
||||
this.B_RemoveItemDropDown.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_RemoveItemDropDown.TabIndex = 37;
|
||||
|
|
@ -451,19 +476,566 @@ private void InitializeComponent()
|
|||
// GB_Remove
|
||||
//
|
||||
this.GB_Remove.AutoSize = true;
|
||||
this.GB_Remove.Location = new System.Drawing.Point(764, 423);
|
||||
this.GB_Remove.Location = new System.Drawing.Point(60, 396);
|
||||
this.GB_Remove.Name = "GB_Remove";
|
||||
this.GB_Remove.Size = new System.Drawing.Size(178, 13);
|
||||
this.GB_Remove.TabIndex = 39;
|
||||
this.GB_Remove.Text = "Remove from View (Hold Shift=Map)";
|
||||
//
|
||||
// TC_Editor
|
||||
//
|
||||
this.TC_Editor.Controls.Add(this.Tab_Item);
|
||||
this.TC_Editor.Controls.Add(this.Tab_Building);
|
||||
this.TC_Editor.Controls.Add(this.Tab_Terrain);
|
||||
this.TC_Editor.Location = new System.Drawing.Point(767, 12);
|
||||
this.TC_Editor.Name = "TC_Editor";
|
||||
this.TC_Editor.SelectedIndex = 0;
|
||||
this.TC_Editor.Size = new System.Drawing.Size(252, 484);
|
||||
this.TC_Editor.TabIndex = 40;
|
||||
//
|
||||
// Tab_Item
|
||||
//
|
||||
this.Tab_Item.Controls.Add(this.B_DumpLoadField);
|
||||
this.Tab_Item.Controls.Add(this.PG_Tile);
|
||||
this.Tab_Item.Controls.Add(this.B_RemoveItemDropDown);
|
||||
this.Tab_Item.Controls.Add(this.GB_Remove);
|
||||
this.Tab_Item.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_Item.Name = "Tab_Item";
|
||||
this.Tab_Item.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.Tab_Item.Size = new System.Drawing.Size(244, 458);
|
||||
this.Tab_Item.TabIndex = 0;
|
||||
this.Tab_Item.Text = "Items";
|
||||
this.Tab_Item.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// B_DumpLoadField
|
||||
//
|
||||
this.B_DumpLoadField.ContextMenuStrip = this.CM_DLField;
|
||||
this.B_DumpLoadField.Location = new System.Drawing.Point(6, 413);
|
||||
this.B_DumpLoadField.Name = "B_DumpLoadField";
|
||||
this.B_DumpLoadField.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_DumpLoadField.TabIndex = 38;
|
||||
this.B_DumpLoadField.Text = "Dump/Import";
|
||||
this.B_DumpLoadField.UseVisualStyleBackColor = true;
|
||||
this.B_DumpLoadField.Click += new System.EventHandler(this.B_DumpLoadField_Click);
|
||||
//
|
||||
// CM_DLField
|
||||
//
|
||||
this.CM_DLField.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.B_DumpAcre,
|
||||
this.B_DumpAllAcres,
|
||||
this.B_ImportAcre,
|
||||
this.B_ImportAllAcres});
|
||||
this.CM_DLField.Name = "CM_Picture";
|
||||
this.CM_DLField.ShowImageMargin = false;
|
||||
this.CM_DLField.Size = new System.Drawing.Size(135, 92);
|
||||
//
|
||||
// B_DumpAcre
|
||||
//
|
||||
this.B_DumpAcre.Name = "B_DumpAcre";
|
||||
this.B_DumpAcre.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_DumpAcre.Text = "Dump Acre";
|
||||
this.B_DumpAcre.Click += new System.EventHandler(this.B_DumpAcre_Click);
|
||||
//
|
||||
// B_DumpAllAcres
|
||||
//
|
||||
this.B_DumpAllAcres.Name = "B_DumpAllAcres";
|
||||
this.B_DumpAllAcres.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_DumpAllAcres.Text = "Dump All Acres";
|
||||
this.B_DumpAllAcres.Click += new System.EventHandler(this.B_DumpAllAcres_Click);
|
||||
//
|
||||
// B_ImportAcre
|
||||
//
|
||||
this.B_ImportAcre.Name = "B_ImportAcre";
|
||||
this.B_ImportAcre.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_ImportAcre.Text = "Import Acre";
|
||||
this.B_ImportAcre.Click += new System.EventHandler(this.B_ImportAcre_Click);
|
||||
//
|
||||
// B_ImportAllAcres
|
||||
//
|
||||
this.B_ImportAllAcres.Name = "B_ImportAllAcres";
|
||||
this.B_ImportAllAcres.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_ImportAllAcres.Text = "Import All Acres";
|
||||
this.B_ImportAllAcres.Click += new System.EventHandler(this.B_ImportAllAcres_Click);
|
||||
//
|
||||
// Tab_Building
|
||||
//
|
||||
this.Tab_Building.Controls.Add(this.B_DumpLoadBuildings);
|
||||
this.Tab_Building.Controls.Add(this.L_Bit);
|
||||
this.Tab_Building.Controls.Add(this.NUD_Bit);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingType);
|
||||
this.Tab_Building.Controls.Add(this.NUD_BuildingType);
|
||||
this.Tab_Building.Controls.Add(this.NUD_UniqueID);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingX);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingUniqueID);
|
||||
this.Tab_Building.Controls.Add(this.NUD_X);
|
||||
this.Tab_Building.Controls.Add(this.NUD_TypeArg);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingY);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingStructureArg);
|
||||
this.Tab_Building.Controls.Add(this.NUD_Y);
|
||||
this.Tab_Building.Controls.Add(this.NUD_Type);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingRotation);
|
||||
this.Tab_Building.Controls.Add(this.L_BuildingStructureType);
|
||||
this.Tab_Building.Controls.Add(this.NUD_Angle);
|
||||
this.Tab_Building.Controls.Add(this.L_PlazaX);
|
||||
this.Tab_Building.Controls.Add(this.NUD_PlazaX);
|
||||
this.Tab_Building.Controls.Add(this.L_PlazaY);
|
||||
this.Tab_Building.Controls.Add(this.NUD_PlazaY);
|
||||
this.Tab_Building.Controls.Add(this.B_Help);
|
||||
this.Tab_Building.Controls.Add(this.LB_Items);
|
||||
this.Tab_Building.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_Building.Name = "Tab_Building";
|
||||
this.Tab_Building.Padding = new System.Windows.Forms.Padding(3);
|
||||
this.Tab_Building.Size = new System.Drawing.Size(244, 458);
|
||||
this.Tab_Building.TabIndex = 1;
|
||||
this.Tab_Building.Text = "Buildings";
|
||||
this.Tab_Building.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// B_DumpLoadBuildings
|
||||
//
|
||||
this.B_DumpLoadBuildings.ContextMenuStrip = this.CM_DLBuilding;
|
||||
this.B_DumpLoadBuildings.Location = new System.Drawing.Point(6, 413);
|
||||
this.B_DumpLoadBuildings.Name = "B_DumpLoadBuildings";
|
||||
this.B_DumpLoadBuildings.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_DumpLoadBuildings.TabIndex = 132;
|
||||
this.B_DumpLoadBuildings.Text = "Dump/Import";
|
||||
this.B_DumpLoadBuildings.UseVisualStyleBackColor = true;
|
||||
this.B_DumpLoadBuildings.Click += new System.EventHandler(this.B_DumpLoadBuildings_Click);
|
||||
//
|
||||
// CM_DLBuilding
|
||||
//
|
||||
this.CM_DLBuilding.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.B_DumpBuildings,
|
||||
this.B_ImportBuildings});
|
||||
this.CM_DLBuilding.Name = "CM_Picture";
|
||||
this.CM_DLBuilding.ShowImageMargin = false;
|
||||
this.CM_DLBuilding.Size = new System.Drawing.Size(138, 48);
|
||||
//
|
||||
// B_DumpBuildings
|
||||
//
|
||||
this.B_DumpBuildings.Name = "B_DumpBuildings";
|
||||
this.B_DumpBuildings.Size = new System.Drawing.Size(137, 22);
|
||||
this.B_DumpBuildings.Text = "Dump Buildings";
|
||||
this.B_DumpBuildings.Click += new System.EventHandler(this.B_DumpBuildings_Click);
|
||||
//
|
||||
// B_ImportBuildings
|
||||
//
|
||||
this.B_ImportBuildings.Name = "B_ImportBuildings";
|
||||
this.B_ImportBuildings.Size = new System.Drawing.Size(137, 22);
|
||||
this.B_ImportBuildings.Text = "Import Buildings";
|
||||
this.B_ImportBuildings.Click += new System.EventHandler(this.B_ImportBuildings_Click);
|
||||
//
|
||||
// L_Bit
|
||||
//
|
||||
this.L_Bit.Location = new System.Drawing.Point(36, 303);
|
||||
this.L_Bit.Name = "L_Bit";
|
||||
this.L_Bit.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_Bit.TabIndex = 130;
|
||||
this.L_Bit.Text = "Bit:";
|
||||
this.L_Bit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Bit
|
||||
//
|
||||
this.NUD_Bit.Location = new System.Drawing.Point(142, 304);
|
||||
this.NUD_Bit.Maximum = new decimal(new int[] {
|
||||
200,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Bit.Minimum = new decimal(new int[] {
|
||||
200,
|
||||
0,
|
||||
0,
|
||||
-2147483648});
|
||||
this.NUD_Bit.Name = "NUD_Bit";
|
||||
this.NUD_Bit.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_Bit.TabIndex = 131;
|
||||
this.NUD_Bit.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// L_BuildingType
|
||||
//
|
||||
this.L_BuildingType.Location = new System.Drawing.Point(36, 236);
|
||||
this.L_BuildingType.Name = "L_BuildingType";
|
||||
this.L_BuildingType.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_BuildingType.TabIndex = 116;
|
||||
this.L_BuildingType.Text = "Building Type:";
|
||||
this.L_BuildingType.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_BuildingType
|
||||
//
|
||||
this.NUD_BuildingType.Location = new System.Drawing.Point(142, 237);
|
||||
this.NUD_BuildingType.Name = "NUD_BuildingType";
|
||||
this.NUD_BuildingType.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_BuildingType.TabIndex = 117;
|
||||
this.NUD_BuildingType.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// NUD_UniqueID
|
||||
//
|
||||
this.NUD_UniqueID.Location = new System.Drawing.Point(142, 371);
|
||||
this.NUD_UniqueID.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_UniqueID.Name = "NUD_UniqueID";
|
||||
this.NUD_UniqueID.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_UniqueID.TabIndex = 129;
|
||||
this.NUD_UniqueID.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// L_BuildingX
|
||||
//
|
||||
this.L_BuildingX.Location = new System.Drawing.Point(65, 257);
|
||||
this.L_BuildingX.Name = "L_BuildingX";
|
||||
this.L_BuildingX.Size = new System.Drawing.Size(20, 18);
|
||||
this.L_BuildingX.TabIndex = 118;
|
||||
this.L_BuildingX.Text = "X:";
|
||||
this.L_BuildingX.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// L_BuildingUniqueID
|
||||
//
|
||||
this.L_BuildingUniqueID.Location = new System.Drawing.Point(36, 370);
|
||||
this.L_BuildingUniqueID.Name = "L_BuildingUniqueID";
|
||||
this.L_BuildingUniqueID.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_BuildingUniqueID.TabIndex = 128;
|
||||
this.L_BuildingUniqueID.Text = "UniqueID:";
|
||||
this.L_BuildingUniqueID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_X
|
||||
//
|
||||
this.NUD_X.Location = new System.Drawing.Point(91, 258);
|
||||
this.NUD_X.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_X.Name = "NUD_X";
|
||||
this.NUD_X.Size = new System.Drawing.Size(45, 20);
|
||||
this.NUD_X.TabIndex = 119;
|
||||
this.NUD_X.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// NUD_TypeArg
|
||||
//
|
||||
this.NUD_TypeArg.Location = new System.Drawing.Point(142, 350);
|
||||
this.NUD_TypeArg.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_TypeArg.Name = "NUD_TypeArg";
|
||||
this.NUD_TypeArg.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_TypeArg.TabIndex = 127;
|
||||
this.NUD_TypeArg.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// L_BuildingY
|
||||
//
|
||||
this.L_BuildingY.Location = new System.Drawing.Point(137, 257);
|
||||
this.L_BuildingY.Name = "L_BuildingY";
|
||||
this.L_BuildingY.Size = new System.Drawing.Size(23, 18);
|
||||
this.L_BuildingY.TabIndex = 120;
|
||||
this.L_BuildingY.Text = "Y:";
|
||||
this.L_BuildingY.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// L_BuildingStructureArg
|
||||
//
|
||||
this.L_BuildingStructureArg.Location = new System.Drawing.Point(36, 349);
|
||||
this.L_BuildingStructureArg.Name = "L_BuildingStructureArg";
|
||||
this.L_BuildingStructureArg.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_BuildingStructureArg.TabIndex = 126;
|
||||
this.L_BuildingStructureArg.Text = "TypeArg:";
|
||||
this.L_BuildingStructureArg.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Y
|
||||
//
|
||||
this.NUD_Y.Location = new System.Drawing.Point(166, 258);
|
||||
this.NUD_Y.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Y.Name = "NUD_Y";
|
||||
this.NUD_Y.Size = new System.Drawing.Size(45, 20);
|
||||
this.NUD_Y.TabIndex = 121;
|
||||
this.NUD_Y.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// NUD_Type
|
||||
//
|
||||
this.NUD_Type.Location = new System.Drawing.Point(142, 329);
|
||||
this.NUD_Type.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Type.Name = "NUD_Type";
|
||||
this.NUD_Type.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_Type.TabIndex = 125;
|
||||
this.NUD_Type.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// L_BuildingRotation
|
||||
//
|
||||
this.L_BuildingRotation.Location = new System.Drawing.Point(36, 282);
|
||||
this.L_BuildingRotation.Name = "L_BuildingRotation";
|
||||
this.L_BuildingRotation.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_BuildingRotation.TabIndex = 122;
|
||||
this.L_BuildingRotation.Text = "Angle:";
|
||||
this.L_BuildingRotation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// L_BuildingStructureType
|
||||
//
|
||||
this.L_BuildingStructureType.Location = new System.Drawing.Point(36, 328);
|
||||
this.L_BuildingStructureType.Name = "L_BuildingStructureType";
|
||||
this.L_BuildingStructureType.Size = new System.Drawing.Size(100, 18);
|
||||
this.L_BuildingStructureType.TabIndex = 124;
|
||||
this.L_BuildingStructureType.Text = "Type:";
|
||||
this.L_BuildingStructureType.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_Angle
|
||||
//
|
||||
this.NUD_Angle.Location = new System.Drawing.Point(142, 283);
|
||||
this.NUD_Angle.Maximum = new decimal(new int[] {
|
||||
65535,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_Angle.Name = "NUD_Angle";
|
||||
this.NUD_Angle.Size = new System.Drawing.Size(69, 20);
|
||||
this.NUD_Angle.TabIndex = 123;
|
||||
this.NUD_Angle.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
|
||||
//
|
||||
// L_PlazaX
|
||||
//
|
||||
this.L_PlazaX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.L_PlazaX.Location = new System.Drawing.Point(65, 2);
|
||||
this.L_PlazaX.Name = "L_PlazaX";
|
||||
this.L_PlazaX.Size = new System.Drawing.Size(62, 20);
|
||||
this.L_PlazaX.TabIndex = 115;
|
||||
this.L_PlazaX.Text = "Plaza X:";
|
||||
this.L_PlazaX.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_PlazaX
|
||||
//
|
||||
this.NUD_PlazaX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.NUD_PlazaX.Location = new System.Drawing.Point(128, 3);
|
||||
this.NUD_PlazaX.Maximum = new decimal(new int[] {
|
||||
1024,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_PlazaX.Name = "NUD_PlazaX";
|
||||
this.NUD_PlazaX.Size = new System.Drawing.Size(39, 20);
|
||||
this.NUD_PlazaX.TabIndex = 114;
|
||||
this.NUD_PlazaX.Value = new decimal(new int[] {
|
||||
555,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_PlazaX.ValueChanged += new System.EventHandler(this.NUD_PlazaX_ValueChanged);
|
||||
//
|
||||
// L_PlazaY
|
||||
//
|
||||
this.L_PlazaY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.L_PlazaY.Location = new System.Drawing.Point(65, 23);
|
||||
this.L_PlazaY.Name = "L_PlazaY";
|
||||
this.L_PlazaY.Size = new System.Drawing.Size(62, 20);
|
||||
this.L_PlazaY.TabIndex = 113;
|
||||
this.L_PlazaY.Text = "Plaza Y:";
|
||||
this.L_PlazaY.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
//
|
||||
// NUD_PlazaY
|
||||
//
|
||||
this.NUD_PlazaY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.NUD_PlazaY.Location = new System.Drawing.Point(128, 24);
|
||||
this.NUD_PlazaY.Maximum = new decimal(new int[] {
|
||||
1024,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_PlazaY.Name = "NUD_PlazaY";
|
||||
this.NUD_PlazaY.Size = new System.Drawing.Size(39, 20);
|
||||
this.NUD_PlazaY.TabIndex = 112;
|
||||
this.NUD_PlazaY.Value = new decimal(new int[] {
|
||||
555,
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.NUD_PlazaY.ValueChanged += new System.EventHandler(this.NUD_PlazaY_ValueChanged);
|
||||
//
|
||||
// B_Help
|
||||
//
|
||||
this.B_Help.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.B_Help.Location = new System.Drawing.Point(126, 413);
|
||||
this.B_Help.Name = "B_Help";
|
||||
this.B_Help.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_Help.TabIndex = 111;
|
||||
this.B_Help.Text = "Help";
|
||||
this.B_Help.UseVisualStyleBackColor = true;
|
||||
this.B_Help.Click += new System.EventHandler(this.B_Help_Click);
|
||||
//
|
||||
// LB_Items
|
||||
//
|
||||
this.LB_Items.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.LB_Items.FormattingEnabled = true;
|
||||
this.LB_Items.Location = new System.Drawing.Point(6, 45);
|
||||
this.LB_Items.Name = "LB_Items";
|
||||
this.LB_Items.Size = new System.Drawing.Size(232, 186);
|
||||
this.LB_Items.TabIndex = 109;
|
||||
this.LB_Items.SelectedIndexChanged += new System.EventHandler(this.LB_Items_SelectedIndexChanged);
|
||||
//
|
||||
// Tab_Terrain
|
||||
//
|
||||
this.Tab_Terrain.Controls.Add(this.PG_TerrainTile);
|
||||
this.Tab_Terrain.Controls.Add(this.B_DumpLoadTerrain);
|
||||
this.Tab_Terrain.Controls.Add(this.B_ModifyAllTerrain);
|
||||
this.Tab_Terrain.Location = new System.Drawing.Point(4, 22);
|
||||
this.Tab_Terrain.Name = "Tab_Terrain";
|
||||
this.Tab_Terrain.Size = new System.Drawing.Size(244, 458);
|
||||
this.Tab_Terrain.TabIndex = 2;
|
||||
this.Tab_Terrain.Text = "Terrain";
|
||||
this.Tab_Terrain.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PG_TerrainTile
|
||||
//
|
||||
this.PG_TerrainTile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.PG_TerrainTile.Location = new System.Drawing.Point(3, 3);
|
||||
this.PG_TerrainTile.Name = "PG_TerrainTile";
|
||||
this.PG_TerrainTile.PropertySort = System.Windows.Forms.PropertySort.Categorized;
|
||||
this.PG_TerrainTile.Size = new System.Drawing.Size(238, 404);
|
||||
this.PG_TerrainTile.TabIndex = 41;
|
||||
this.PG_TerrainTile.ToolbarVisible = false;
|
||||
//
|
||||
// B_DumpLoadTerrain
|
||||
//
|
||||
this.B_DumpLoadTerrain.Location = new System.Drawing.Point(6, 413);
|
||||
this.B_DumpLoadTerrain.Name = "B_DumpLoadTerrain";
|
||||
this.B_DumpLoadTerrain.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_DumpLoadTerrain.TabIndex = 40;
|
||||
this.B_DumpLoadTerrain.Text = "Dump/Import";
|
||||
this.B_DumpLoadTerrain.UseVisualStyleBackColor = true;
|
||||
this.B_DumpLoadTerrain.Click += new System.EventHandler(this.B_DumpLoadTerrain_Click);
|
||||
//
|
||||
// B_ModifyAllTerrain
|
||||
//
|
||||
this.B_ModifyAllTerrain.Location = new System.Drawing.Point(126, 413);
|
||||
this.B_ModifyAllTerrain.Name = "B_ModifyAllTerrain";
|
||||
this.B_ModifyAllTerrain.Size = new System.Drawing.Size(112, 40);
|
||||
this.B_ModifyAllTerrain.TabIndex = 39;
|
||||
this.B_ModifyAllTerrain.Text = "Modify All...";
|
||||
this.B_ModifyAllTerrain.UseVisualStyleBackColor = true;
|
||||
this.B_ModifyAllTerrain.Click += new System.EventHandler(this.B_ModifyAllTerrain_Click);
|
||||
//
|
||||
// L_FieldItemTransparency
|
||||
//
|
||||
this.L_FieldItemTransparency.AutoSize = true;
|
||||
this.L_FieldItemTransparency.Location = new System.Drawing.Point(534, 465);
|
||||
this.L_FieldItemTransparency.Name = "L_FieldItemTransparency";
|
||||
this.L_FieldItemTransparency.Size = new System.Drawing.Size(120, 13);
|
||||
this.L_FieldItemTransparency.TabIndex = 42;
|
||||
this.L_FieldItemTransparency.Text = "Field Item Transparency";
|
||||
//
|
||||
// CM_DLTerrain
|
||||
//
|
||||
this.CM_DLTerrain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.B_DumpTerrainAcre,
|
||||
this.B_DumpTerrainAll,
|
||||
this.B_ImportTerrainAcre,
|
||||
this.B_ImportTerrainAll});
|
||||
this.CM_DLTerrain.Name = "CM_Picture";
|
||||
this.CM_DLTerrain.ShowImageMargin = false;
|
||||
this.CM_DLTerrain.Size = new System.Drawing.Size(135, 92);
|
||||
//
|
||||
// B_DumpTerrainAcre
|
||||
//
|
||||
this.B_DumpTerrainAcre.Name = "B_DumpTerrainAcre";
|
||||
this.B_DumpTerrainAcre.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_DumpTerrainAcre.Text = "Dump Acre";
|
||||
this.B_DumpTerrainAcre.Click += new System.EventHandler(this.B_DumpTerrainAcre_Click);
|
||||
//
|
||||
// B_DumpTerrainAll
|
||||
//
|
||||
this.B_DumpTerrainAll.Name = "B_DumpTerrainAll";
|
||||
this.B_DumpTerrainAll.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_DumpTerrainAll.Text = "Dump All Acres";
|
||||
this.B_DumpTerrainAll.Click += new System.EventHandler(this.B_DumpTerrainAll_Click);
|
||||
//
|
||||
// B_ImportTerrainAcre
|
||||
//
|
||||
this.B_ImportTerrainAcre.Name = "B_ImportTerrainAcre";
|
||||
this.B_ImportTerrainAcre.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_ImportTerrainAcre.Text = "Import Acre";
|
||||
this.B_ImportTerrainAcre.Click += new System.EventHandler(this.B_ImportTerrainAcre_Click);
|
||||
//
|
||||
// B_ImportTerrainAll
|
||||
//
|
||||
this.B_ImportTerrainAll.Name = "B_ImportTerrainAll";
|
||||
this.B_ImportTerrainAll.Size = new System.Drawing.Size(134, 22);
|
||||
this.B_ImportTerrainAll.Text = "Import All Acres";
|
||||
this.B_ImportTerrainAll.Click += new System.EventHandler(this.B_ImportTerrainAll_Click);
|
||||
//
|
||||
// CM_Terrain
|
||||
//
|
||||
this.CM_Terrain.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.B_ZeroElevation,
|
||||
this.B_SetAllTerrain});
|
||||
this.CM_Terrain.Name = "CM_Picture";
|
||||
this.CM_Terrain.ShowImageMargin = false;
|
||||
this.CM_Terrain.Size = new System.Drawing.Size(225, 48);
|
||||
//
|
||||
// B_ZeroElevation
|
||||
//
|
||||
this.B_ZeroElevation.Name = "B_ZeroElevation";
|
||||
this.B_ZeroElevation.Size = new System.Drawing.Size(224, 22);
|
||||
this.B_ZeroElevation.Text = "Zero Elevation";
|
||||
//
|
||||
// B_SetAllTerrain
|
||||
//
|
||||
this.B_SetAllTerrain.Name = "B_SetAllTerrain";
|
||||
this.B_SetAllTerrain.Size = new System.Drawing.Size(224, 22);
|
||||
this.B_SetAllTerrain.Text = "Set All Tiles using Tile from Editor";
|
||||
//
|
||||
// RB_Item
|
||||
//
|
||||
this.RB_Item.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.RB_Item.Checked = true;
|
||||
this.RB_Item.Location = new System.Drawing.Point(641, 371);
|
||||
this.RB_Item.Name = "RB_Item";
|
||||
this.RB_Item.Size = new System.Drawing.Size(120, 20);
|
||||
this.RB_Item.TabIndex = 43;
|
||||
this.RB_Item.TabStop = true;
|
||||
this.RB_Item.Text = "Items";
|
||||
this.RB_Item.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.RB_Item.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// RB_Terrain
|
||||
//
|
||||
this.RB_Terrain.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.RB_Terrain.Location = new System.Drawing.Point(641, 390);
|
||||
this.RB_Terrain.Name = "RB_Terrain";
|
||||
this.RB_Terrain.Size = new System.Drawing.Size(120, 20);
|
||||
this.RB_Terrain.TabIndex = 44;
|
||||
this.RB_Terrain.Text = "Terrain";
|
||||
this.RB_Terrain.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||
this.RB_Terrain.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Location = new System.Drawing.Point(641, 350);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(120, 20);
|
||||
this.label1.TabIndex = 45;
|
||||
this.label1.Text = "Tile Editor Mode";
|
||||
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(981, 537);
|
||||
this.Controls.Add(this.GB_Remove);
|
||||
this.Controls.Add(this.B_RemoveItemDropDown);
|
||||
this.ClientSize = new System.Drawing.Size(1027, 537);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.RB_Terrain);
|
||||
this.Controls.Add(this.RB_Item);
|
||||
this.Controls.Add(this.L_FieldItemTransparency);
|
||||
this.Controls.Add(this.TC_Editor);
|
||||
this.Controls.Add(this.CHK_AutoExtension);
|
||||
this.Controls.Add(this.CHK_NoOverwrite);
|
||||
this.Controls.Add(this.TR_Transparency);
|
||||
|
|
@ -477,13 +1049,8 @@ private void InitializeComponent()
|
|||
this.Controls.Add(this.B_Right);
|
||||
this.Controls.Add(this.B_Left);
|
||||
this.Controls.Add(this.B_Up);
|
||||
this.Controls.Add(this.B_ImportAllAcres);
|
||||
this.Controls.Add(this.B_ImportAcre);
|
||||
this.Controls.Add(this.B_DumpAllAcres);
|
||||
this.Controls.Add(this.B_DumpAcre);
|
||||
this.Controls.Add(this.L_Acre);
|
||||
this.Controls.Add(this.CB_Acre);
|
||||
this.Controls.Add(this.PG_Tile);
|
||||
this.Controls.Add(this.B_Cancel);
|
||||
this.Controls.Add(this.B_Save);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
|
|
@ -500,6 +1067,25 @@ private void InitializeComponent()
|
|||
((System.ComponentModel.ISupportInitialize)(this.PB_Acre)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.TR_Transparency)).EndInit();
|
||||
this.CM_Remove.ResumeLayout(false);
|
||||
this.TC_Editor.ResumeLayout(false);
|
||||
this.Tab_Item.ResumeLayout(false);
|
||||
this.Tab_Item.PerformLayout();
|
||||
this.CM_DLField.ResumeLayout(false);
|
||||
this.Tab_Building.ResumeLayout(false);
|
||||
this.CM_DLBuilding.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Bit)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_BuildingType)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_UniqueID)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_TypeArg)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Type)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_Angle)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaX)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaY)).EndInit();
|
||||
this.Tab_Terrain.ResumeLayout(false);
|
||||
this.CM_DLTerrain.ResumeLayout(false);
|
||||
this.CM_Terrain.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
@ -512,10 +1098,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.PropertyGrid PG_Tile;
|
||||
private System.Windows.Forms.ComboBox CB_Acre;
|
||||
private System.Windows.Forms.Label L_Acre;
|
||||
private System.Windows.Forms.Button B_DumpAcre;
|
||||
private System.Windows.Forms.Button B_DumpAllAcres;
|
||||
private System.Windows.Forms.Button B_ImportAllAcres;
|
||||
private System.Windows.Forms.Button B_ImportAcre;
|
||||
private System.Windows.Forms.ContextMenuStrip CM_Click;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_View;
|
||||
private System.Windows.Forms.ToolStripMenuItem Menu_Set;
|
||||
|
|
@ -546,5 +1128,56 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem B_FillHoles;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_RemoveAll;
|
||||
private System.Windows.Forms.Label GB_Remove;
|
||||
private System.Windows.Forms.TabControl TC_Editor;
|
||||
private System.Windows.Forms.TabPage Tab_Item;
|
||||
private System.Windows.Forms.Button B_DumpLoadField;
|
||||
private System.Windows.Forms.TabPage Tab_Building;
|
||||
private System.Windows.Forms.ContextMenuStrip CM_DLField;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_DumpAcre;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_DumpAllAcres;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ImportAcre;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ImportAllAcres;
|
||||
private System.Windows.Forms.Label L_FieldItemTransparency;
|
||||
private System.Windows.Forms.TabPage Tab_Terrain;
|
||||
private System.Windows.Forms.ListBox LB_Items;
|
||||
private System.Windows.Forms.Button B_Help;
|
||||
private System.Windows.Forms.Label L_PlazaX;
|
||||
private System.Windows.Forms.NumericUpDown NUD_PlazaX;
|
||||
private System.Windows.Forms.Label L_PlazaY;
|
||||
private System.Windows.Forms.NumericUpDown NUD_PlazaY;
|
||||
private System.Windows.Forms.Button B_DumpLoadTerrain;
|
||||
private System.Windows.Forms.Button B_ModifyAllTerrain;
|
||||
private System.Windows.Forms.ContextMenuStrip CM_DLTerrain;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_DumpTerrainAcre;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_DumpTerrainAll;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ImportTerrainAcre;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ImportTerrainAll;
|
||||
private System.Windows.Forms.Label L_Bit;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Bit;
|
||||
private System.Windows.Forms.Label L_BuildingType;
|
||||
private System.Windows.Forms.NumericUpDown NUD_BuildingType;
|
||||
private System.Windows.Forms.NumericUpDown NUD_UniqueID;
|
||||
private System.Windows.Forms.Label L_BuildingX;
|
||||
private System.Windows.Forms.Label L_BuildingUniqueID;
|
||||
private System.Windows.Forms.NumericUpDown NUD_X;
|
||||
private System.Windows.Forms.NumericUpDown NUD_TypeArg;
|
||||
private System.Windows.Forms.Label L_BuildingY;
|
||||
private System.Windows.Forms.Label L_BuildingStructureArg;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Y;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Type;
|
||||
private System.Windows.Forms.Label L_BuildingRotation;
|
||||
private System.Windows.Forms.Label L_BuildingStructureType;
|
||||
private System.Windows.Forms.NumericUpDown NUD_Angle;
|
||||
private System.Windows.Forms.Button B_DumpLoadBuildings;
|
||||
private System.Windows.Forms.ContextMenuStrip CM_DLBuilding;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_DumpBuildings;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ImportBuildings;
|
||||
private System.Windows.Forms.ContextMenuStrip CM_Terrain;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_ZeroElevation;
|
||||
private System.Windows.Forms.ToolStripMenuItem B_SetAllTerrain;
|
||||
private System.Windows.Forms.PropertyGrid PG_TerrainTile;
|
||||
private System.Windows.Forms.RadioButton RB_Item;
|
||||
private System.Windows.Forms.RadioButton RB_Terrain;
|
||||
private System.Windows.Forms.Label label1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,24 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHSE.Core;
|
||||
using NHSE.Sprites;
|
||||
|
||||
namespace NHSE.WinForms
|
||||
{
|
||||
public partial class FieldItemEditor : Form
|
||||
public sealed partial class FieldItemEditor : Form
|
||||
{
|
||||
private readonly MainSave SAV;
|
||||
private readonly FieldItemManager Items;
|
||||
|
||||
private const int MapScale = 1;
|
||||
private const int AcreScale = 16;
|
||||
private readonly MapManager Map;
|
||||
private readonly MapViewer View;
|
||||
|
||||
// Cached acre view objects to remove allocation/GC
|
||||
private readonly int[] Scale1;
|
||||
private readonly int[] ScaleX;
|
||||
private readonly Bitmap ScaleAcre;
|
||||
private bool Loading;
|
||||
private int SelectedBuildingIndex;
|
||||
|
||||
private readonly int[] Map;
|
||||
private readonly Bitmap MapReticle;
|
||||
|
||||
private readonly TerrainManager Terrain;
|
||||
private readonly IReadOnlyList<Building> Buildings;
|
||||
private readonly uint PlazaX;
|
||||
private readonly uint PlazaY;
|
||||
|
||||
private int X;
|
||||
private int Y;
|
||||
private int HoverX;
|
||||
private int HoverY;
|
||||
|
||||
public FieldItemEditor(MainSave sav)
|
||||
{
|
||||
|
|
@ -39,28 +26,26 @@ public FieldItemEditor(MainSave sav)
|
|||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
|
||||
SAV = sav;
|
||||
Items = new FieldItemManager(SAV.GetFieldItems());
|
||||
|
||||
var l1 = Items.Layer1;
|
||||
Scale1 = new int[l1.GridWidth * l1.GridHeight];
|
||||
ScaleX = new int[Scale1.Length * AcreScale * AcreScale];
|
||||
ScaleAcre = new Bitmap(l1.GridWidth * AcreScale, l1.GridHeight * AcreScale);
|
||||
|
||||
Map = new int[l1.MapWidth * l1.MapHeight * MapScale * MapScale];
|
||||
MapReticle = new Bitmap(l1.MapWidth * MapScale, l1.MapHeight * MapScale);
|
||||
|
||||
Terrain = new TerrainManager(sav.GetTerrain());
|
||||
Buildings = sav.Buildings;
|
||||
PlazaX = sav.PlazaX;
|
||||
PlazaY = sav.PlazaY;
|
||||
PB_Map.BackgroundImage = TerrainSprite.GetMapWithBuildings(Terrain, Buildings, (ushort)PlazaX, (ushort)PlazaY, null, 2);
|
||||
Map = new MapManager(sav);
|
||||
View = new MapViewer(Map);
|
||||
|
||||
Loading = true;
|
||||
foreach (var acre in MapGrid.Acres)
|
||||
CB_Acre.Items.Add(acre.Name);
|
||||
|
||||
NUD_PlazaX.Value = sav.PlazaX;
|
||||
NUD_PlazaY.Value = sav.PlazaY;
|
||||
|
||||
foreach (var obj in Map.Buildings)
|
||||
LB_Items.Items.Add(obj.ToString());
|
||||
|
||||
ReloadMapBackground();
|
||||
PG_Tile.SelectedObject = new FieldItem();
|
||||
PG_TerrainTile.SelectedObject = new TerrainTile();
|
||||
LB_Items.SelectedIndex = 0;
|
||||
CB_Acre.SelectedIndex = 0;
|
||||
LoadGrid(X, Y);
|
||||
Loading = false;
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private int AcreIndex => CB_Acre.SelectedIndex;
|
||||
|
|
@ -69,78 +54,116 @@ public FieldItemEditor(MainSave sav)
|
|||
|
||||
private void ChangeViewToAcre(int acre)
|
||||
{
|
||||
Items.Layer1.GetViewAnchorCoordinates(acre, out X, out Y);
|
||||
LoadGrid(X, Y);
|
||||
View.SetViewToAcre(acre);
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private FieldItemLayer Layer => NUD_Layer.Value == 1 ? Items.Layer1 : Items.Layer2;
|
||||
|
||||
private void ReloadMap()
|
||||
private void LoadItemGridAcre()
|
||||
{
|
||||
var transparency = TR_Transparency.Value / 100d;
|
||||
var t = ((int)(0xFF * transparency) << 24) | 0x00FF_FFFF;
|
||||
PB_Map.Image = FieldItemSpriteDrawer.GetBitmapLayer(Layer, X, Y, Map, MapReticle, t);
|
||||
}
|
||||
|
||||
private void LoadGrid(int topX, int topY)
|
||||
{
|
||||
ReloadGrid(Layer, topX, topY);
|
||||
ReloadBackground(topX, topY);
|
||||
ReloadItems();
|
||||
ReloadAcreBackground();
|
||||
UpdateArrowVisibility();
|
||||
ReloadMap();
|
||||
}
|
||||
|
||||
private void ReloadBackground(int topX, int topY)
|
||||
private int GetItemTransparency() => ((int)(0xFF * TR_Transparency.Value / 100d) << 24) | 0x00FF_FFFF;
|
||||
private void ReloadMapBackground() => PB_Map.BackgroundImage = View.GetBackgroundTerrain(SelectedBuildingIndex);
|
||||
private void ReloadAcreBackground() => PB_Acre.BackgroundImage = View.GetBackgroundAcre(L_Coordinates.Font, SelectedBuildingIndex);
|
||||
private void ReloadMapItemGrid() => PB_Map.Image = View.GetMapWithReticle(GetItemTransparency());
|
||||
private void ReloadAcreItemGrid() => PB_Acre.Image = View.GetLayerAcre(GetItemTransparency());
|
||||
|
||||
private void ReloadItems()
|
||||
{
|
||||
PB_Acre.BackgroundImage = TerrainSprite.GetAcre(topX/2, topY/2, Terrain, AcreScale * 2, Buildings, (ushort)PlazaX, (ushort)PlazaY);
|
||||
ReloadAcreItemGrid();
|
||||
ReloadMapItemGrid();
|
||||
}
|
||||
|
||||
private void ReloadGrid(FieldItemLayer layer, int topX, int topY)
|
||||
private void ReloadBuildingsTerrain()
|
||||
{
|
||||
var transparency = TR_Transparency.Value / 100d;
|
||||
var t = ((int) (0xFF * transparency) << 24) | 0x00FF_FFFF;
|
||||
PB_Acre.Image = FieldItemSpriteDrawer.GetBitmapLayerAcre(layer, topX, topY, AcreScale, Scale1, ScaleX, ScaleAcre, t);
|
||||
ReloadAcreBackground();
|
||||
ReloadMapBackground();
|
||||
}
|
||||
|
||||
private void UpdateArrowVisibility()
|
||||
{
|
||||
B_Up.Enabled = Y != 0;
|
||||
B_Down.Enabled = Y < Layer.MapHeight - Layer.GridHeight;
|
||||
B_Left.Enabled = X != 0;
|
||||
B_Right.Enabled = X < Layer.MapWidth - Layer.GridWidth;
|
||||
B_Up.Enabled = View.CanUp;
|
||||
B_Down.Enabled = View.CanDown;
|
||||
B_Left.Enabled = View.CanLeft;
|
||||
B_Right.Enabled = View.CanRight;
|
||||
}
|
||||
|
||||
private void PB_Acre_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
var tile = GetTile(Layer, e, out var x, out var y);
|
||||
if (RB_Item.Checked)
|
||||
OmniTile(e);
|
||||
else if (RB_Terrain.Checked)
|
||||
OmniTileTerrain(e);
|
||||
}
|
||||
|
||||
private void OmniTile(MouseEventArgs e)
|
||||
{
|
||||
var tile = GetTile(Map.CurrentLayer, e, out var x, out var y);
|
||||
OmniTile(tile, x, y);
|
||||
}
|
||||
|
||||
private void OmniTileTerrain(MouseEventArgs e)
|
||||
{
|
||||
SetHoveredItem(e);
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
OmniTileTerrain(tile);
|
||||
}
|
||||
|
||||
private void OmniTile(FieldItem tile, int x, int y)
|
||||
{
|
||||
switch (ModifierKeys)
|
||||
{
|
||||
default: ViewTile(tile); return;
|
||||
case Keys.Shift: SetTile(tile, x, y); return;
|
||||
case Keys.Alt: DeleteTile(tile, x, y); return;
|
||||
default:
|
||||
ViewTile(tile);
|
||||
return;
|
||||
case Keys.Shift:
|
||||
SetTile(tile, x, y);
|
||||
return;
|
||||
case Keys.Alt:
|
||||
DeleteTile(tile, x, y);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private int HoverX;
|
||||
private int HoverY;
|
||||
private void OmniTileTerrain(TerrainTile tile)
|
||||
{
|
||||
switch (ModifierKeys)
|
||||
{
|
||||
default:
|
||||
ViewTile(tile);
|
||||
return;
|
||||
case Keys.Shift:
|
||||
SetTile(tile);
|
||||
return;
|
||||
case Keys.Alt:
|
||||
DeleteTile(tile);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private FieldItem GetTile(FieldItemLayer layer, MouseEventArgs e, out int x, out int y)
|
||||
{
|
||||
SetHoveredItem(e);
|
||||
return layer.GetTile(x = X + HoverX, y = Y + HoverY);
|
||||
return layer.GetTile(x = View.X + HoverX, y = View.Y + HoverY);
|
||||
}
|
||||
|
||||
private void SetHoveredItem(MouseEventArgs e)
|
||||
{
|
||||
// Mouse event may fire with a slightly too large x/y; clamp just in case.
|
||||
HoverX = (e.X / AcreScale) & 0x1F;
|
||||
HoverY = (e.Y / AcreScale) & 0x1F;
|
||||
HoverX = (e.X / View.AcreScale) & 0x1F;
|
||||
HoverY = (e.Y / View.AcreScale) & 0x1F;
|
||||
}
|
||||
|
||||
private void PB_Acre_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
var oldTile = Layer.GetTile(X + HoverX, Y + HoverY);
|
||||
var tile = GetTile(Layer, e, out _, out _);
|
||||
var l = Map.CurrentLayer;
|
||||
var oldTile = l.GetTile(View.X + HoverX, View.Y + HoverY);
|
||||
var tile = GetTile(l, e, out _, out _);
|
||||
if (tile == oldTile)
|
||||
return;
|
||||
var str = GameInfo.Strings;
|
||||
|
|
@ -153,12 +176,22 @@ private void ViewTile(FieldItem tile)
|
|||
var pgt = (FieldItem)PG_Tile.SelectedObject;
|
||||
pgt.CopyFrom(tile);
|
||||
PG_Tile.SelectedObject = pgt;
|
||||
TC_Editor.SelectedTab = Tab_Item;
|
||||
}
|
||||
|
||||
private void ViewTile(TerrainTile tile)
|
||||
{
|
||||
var pgt = (TerrainTile)PG_TerrainTile.SelectedObject;
|
||||
pgt.CopyFrom(tile);
|
||||
PG_TerrainTile.SelectedObject = pgt;
|
||||
TC_Editor.SelectedTab = Tab_Terrain;
|
||||
}
|
||||
|
||||
private void SetTile(FieldItem tile, int x, int y)
|
||||
{
|
||||
var l = Map.CurrentLayer;
|
||||
var pgt = (FieldItem)PG_Tile.SelectedObject;
|
||||
var permission = Layer.IsOccupied(pgt, x, y);
|
||||
var permission = l.IsOccupied(pgt, x, y);
|
||||
switch (permission)
|
||||
{
|
||||
case FieldItemPermission.OutOfBounds:
|
||||
|
|
@ -169,189 +202,178 @@ private void SetTile(FieldItem tile, int x, int y)
|
|||
|
||||
// Clean up original placed data
|
||||
if (tile.IsRoot && CHK_AutoExtension.Checked)
|
||||
Layer.DeleteExtensionTiles(tile, x, y);
|
||||
l.DeleteExtensionTiles(tile, x, y);
|
||||
|
||||
// Set new placed data
|
||||
if (pgt.IsRoot && CHK_AutoExtension.Checked)
|
||||
Layer.SetExtensionTiles(pgt, x, y);
|
||||
l.SetExtensionTiles(pgt, x, y);
|
||||
tile.CopyFrom(pgt);
|
||||
|
||||
ReloadGrid(Layer, X, Y);
|
||||
ReloadMap();
|
||||
ReloadItems();
|
||||
}
|
||||
|
||||
private void SetTile(TerrainTile tile)
|
||||
{
|
||||
var pgt = (TerrainTile)PG_TerrainTile.SelectedObject;
|
||||
tile.CopyFrom(pgt);
|
||||
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void DeleteTile(FieldItem tile, int x, int y)
|
||||
{
|
||||
if (tile.IsRoot && CHK_AutoExtension.Checked)
|
||||
Layer.DeleteExtensionTiles(tile, x, y);
|
||||
Map.CurrentLayer.DeleteExtensionTiles(tile, x, y);
|
||||
tile.Delete();
|
||||
ReloadItems();
|
||||
}
|
||||
|
||||
ReloadGrid(Layer, X, Y);
|
||||
ReloadMap();
|
||||
private void DeleteTile(TerrainTile tile)
|
||||
{
|
||||
tile.Clear();
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void B_Cancel_Click(object sender, EventArgs e) => Close();
|
||||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
var all = ArrayUtil.ConcatAll(Items.Layer1.Tiles, Items.Layer2.Tiles);
|
||||
var all = ArrayUtil.ConcatAll(Map.Items.Layer1.Tiles, Map.Items.Layer2.Tiles);
|
||||
SAV.SetFieldItems(all);
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Menu_View_Click(object sender, EventArgs e)
|
||||
{
|
||||
var tile = Layer.GetTile(X + HoverX, Y + HoverY);
|
||||
ViewTile(tile);
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
ViewTile(tile);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
ViewTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Set_Click(object sender, EventArgs e)
|
||||
{
|
||||
int x = X + HoverX;
|
||||
int y = Y + HoverY;
|
||||
var tile = Layer.GetTile(x, y);
|
||||
SetTile(tile, x, y);
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
SetTile(tile, x, y);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
SetTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Reset_Click(object sender, EventArgs e)
|
||||
{
|
||||
int x = X + HoverX;
|
||||
int y = Y + HoverY;
|
||||
var tile = Layer.GetTile(x, y);
|
||||
DeleteTile(tile, x, y);
|
||||
var x = View.X + HoverX;
|
||||
var y = View.Y + HoverY;
|
||||
|
||||
if (RB_Item.Checked)
|
||||
{
|
||||
var tile = Map.CurrentLayer.GetTile(x, y);
|
||||
DeleteTile(tile, x, y);
|
||||
}
|
||||
else if (RB_Terrain.Checked)
|
||||
{
|
||||
var tile = Map.Terrain.GetTile(x / 2, y / 2);
|
||||
DeleteTile(tile);
|
||||
}
|
||||
}
|
||||
|
||||
private void B_Up_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys != Keys.Shift)
|
||||
{
|
||||
if (Y != 0)
|
||||
LoadGrid(X, Y -= 2);
|
||||
return;
|
||||
}
|
||||
|
||||
CB_Acre.SelectedIndex -= MapGrid.AcreWidth;
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
CB_Acre.SelectedIndex -= MapGrid.AcreWidth;
|
||||
else if (View.ArrowUp())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void B_Left_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys != Keys.Shift)
|
||||
{
|
||||
if (X != 0)
|
||||
LoadGrid(X -= 2, Y);
|
||||
return;
|
||||
}
|
||||
|
||||
--CB_Acre.SelectedIndex;
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
--CB_Acre.SelectedIndex;
|
||||
else if (View.ArrowLeft())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void B_Right_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys != Keys.Shift)
|
||||
{
|
||||
if (X != Layer.MapWidth - 2)
|
||||
LoadGrid(X += 2, Y);
|
||||
return;
|
||||
}
|
||||
|
||||
++CB_Acre.SelectedIndex;
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
++CB_Acre.SelectedIndex;
|
||||
else if (View.ArrowRight())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void B_Down_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys != Keys.Shift)
|
||||
{
|
||||
if (Y != Layer.MapHeight - 1)
|
||||
LoadGrid(X, ++Y);
|
||||
return;
|
||||
}
|
||||
|
||||
CB_Acre.SelectedIndex += MapGrid.AcreWidth;
|
||||
if (ModifierKeys == Keys.Shift)
|
||||
CB_Acre.SelectedIndex += MapGrid.AcreWidth;
|
||||
else if (View.ArrowDown())
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Layer;
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}-{NUD_Layer.Value}.nhl",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var acre = AcreIndex;
|
||||
var data = layer.DumpAcre(acre);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Layer;
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = "acres.nhl",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = layer.DumpAllAcres();
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreSingle(Map.CurrentLayer, AcreIndex, CB_Acre.Text, (int)NUD_Layer.Value);
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e) => MapDumpHelper.DumpLayerAcreAll(Map.CurrentLayer);
|
||||
|
||||
private void B_ImportAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Layer;
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}-{NUD_Layer.Value}.nhl",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
var layer = Map.CurrentLayer;
|
||||
if (!MapDumpHelper.ImportToLayerAcreSingle(layer, AcreIndex, CB_Acre.Text, (int)NUD_Layer.Value))
|
||||
return;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = layer.AcreTileCount * FieldItem.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
layer.ImportAcre(AcreIndex, data);
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_ImportAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
var layer = Layer;
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = "acres.nhl",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
if (!MapDumpHelper.ImportToLayerAcreAll(Map.CurrentLayer))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_DumpBuildings_Click(object sender, EventArgs e) => MapDumpHelper.DumpBuildings(Map.Buildings);
|
||||
|
||||
private void B_ImportBuildings_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportBuildings(Map.Buildings))
|
||||
return;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
for (int i = 0; i < Map.Buildings.Count; i++)
|
||||
LB_Items.Items[i] = Map.Buildings[i].ToString();
|
||||
LB_Items.SelectedIndex = 0;
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
private void B_DumpTerrainAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAcre(Map.Terrain, AcreIndex, CB_Acre.Text);
|
||||
private void B_DumpTerrainAll_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAll(Map.Terrain);
|
||||
|
||||
int expect = layer.MapTileCount * FieldItem.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
private void B_ImportTerrainAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportTerrainAcre(Map.Terrain, AcreIndex, CB_Acre.Text))
|
||||
return;
|
||||
}
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
layer.ImportAllAcres(data);
|
||||
private void B_ImportTerrainAll_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!MapDumpHelper.ImportTerrainAll(Map.Terrain))
|
||||
return;
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
|
@ -366,7 +388,7 @@ private void Menu_SavePNG_Click(object sender, EventArgs e)
|
|||
}
|
||||
|
||||
const string name = "map";
|
||||
var bmp = FieldItemSpriteDrawer.GetBitmapLayer(Items.Layer1);
|
||||
var bmp = FieldItemSpriteDrawer.GetBitmapLayer(Map.Items.Layer1);
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "png file (*.png)|*.png|All files (*.*)|*.*",
|
||||
|
|
@ -382,11 +404,11 @@ private void Menu_SavePNG_Click(object sender, EventArgs e)
|
|||
|
||||
private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
var layer = Map.Items.Layer1;
|
||||
int mX = e.X;
|
||||
int mY = e.Y;
|
||||
bool centerReticle = CHK_SnapToAcre.Checked;
|
||||
GetViewAnchorCoordinates(mX, mY, out var x, out var y, centerReticle);
|
||||
View.GetViewAnchorCoordinates(mX, mY, out var x, out var y, centerReticle);
|
||||
x &= 0xFFFE;
|
||||
y &= 0xFFFE;
|
||||
|
||||
|
|
@ -402,8 +424,8 @@ private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
|
|||
else
|
||||
{
|
||||
const int delta = 0; // disabled = 0
|
||||
var dx = Math.Abs(X - x);
|
||||
var dy = Math.Abs(Y - y);
|
||||
var dx = Math.Abs(View.X - x);
|
||||
var dy = Math.Abs(View.Y - y);
|
||||
if (dx <= delta && dy <= delta && !sameAcre)
|
||||
return;
|
||||
}
|
||||
|
|
@ -411,7 +433,8 @@ private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
|
|||
|
||||
if (!CHK_SnapToAcre.Checked)
|
||||
{
|
||||
LoadGrid(X = x, Y = y);
|
||||
View.SetViewTo(x, y);
|
||||
LoadItemGridAcre();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -419,19 +442,6 @@ private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
|
|||
CB_Acre.SelectedIndex = acre;
|
||||
}
|
||||
|
||||
private static void GetCursorCoordinates(int mX, int mY, out int x, out int y)
|
||||
{
|
||||
x = mX / MapScale;
|
||||
y = mY / MapScale;
|
||||
}
|
||||
|
||||
private void GetViewAnchorCoordinates(int mX, int mY, out int x, out int y, bool centerReticle)
|
||||
{
|
||||
var layer = Items.Layer1;
|
||||
GetCursorCoordinates(mX, mY, out x, out y);
|
||||
layer.GetViewAnchorCoordinates(ref x, ref y, centerReticle);
|
||||
}
|
||||
|
||||
private void PB_Map_MouseMove(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
|
|
@ -440,14 +450,16 @@ private void PB_Map_MouseMove(object sender, MouseEventArgs e)
|
|||
}
|
||||
else
|
||||
{
|
||||
int mX = e.X;
|
||||
int mY = e.Y;
|
||||
GetCursorCoordinates(mX, mY, out var x, out var y);
|
||||
View.GetCursorCoordinates(e.X, e.Y, out var x, out var y);
|
||||
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);
|
||||
private void NUD_Layer_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
Map.MapLayer = (int) NUD_Layer.Value - 1;
|
||||
LoadItemGridAcre();
|
||||
}
|
||||
|
||||
private void Remove(ToolStripItem sender, Func<int, int, int, int, int> removal)
|
||||
{
|
||||
|
|
@ -458,36 +470,109 @@ private void Remove(ToolStripItem sender, Func<int, int, int, int, int> removal)
|
|||
if (question != DialogResult.Yes)
|
||||
return;
|
||||
|
||||
var count = wholeMap
|
||||
? removal(0, 0, Layer.MapWidth, Layer.MapHeight)
|
||||
: removal(X, Y, Layer.GridWidth, Layer.GridHeight);
|
||||
int count = View.RemoveFieldItems(removal, wholeMap);
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
WinFormsUtil.Alert(MessageStrings.MsgFieldItemRemoveNone);
|
||||
return;
|
||||
}
|
||||
LoadGrid(X, Y);
|
||||
LoadItemGridAcre();
|
||||
WinFormsUtil.Alert(string.Format(MessageStrings.MsgFieldItemRemoveCount, count));
|
||||
}
|
||||
|
||||
private void B_RemoveAllWeeds_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, Layer.RemoveAllWeeds);
|
||||
private void B_FillHoles_Click(object sender, EventArgs e) => Remove(B_FillHoles, Layer.RemoveAllHoles);
|
||||
private void B_RemovePlants_Click(object sender, EventArgs e) => Remove(B_RemovePlants, Layer.RemoveAllPlants);
|
||||
private void B_RemoveFences_Click(object sender, EventArgs e) => Remove(B_RemoveFences, Layer.RemoveAllFences);
|
||||
private void B_RemoveObjects_Click(object sender, EventArgs e) => Remove(B_RemoveObjects, Layer.RemoveAllObjects);
|
||||
private void B_RemoveAll_Click(object sender, EventArgs e) => Remove(B_RemoveAll, Layer.RemoveAll);
|
||||
private void B_RemovePlacedItems_Click(object sender, EventArgs e) => Remove(B_RemovePlacedItems, Layer.RemoveAllPlacedItems);
|
||||
private void B_RemoveAllWeeds_Click(object sender, EventArgs e) => Remove(B_RemoveAllWeeds, Map.CurrentLayer.RemoveAllWeeds);
|
||||
private void B_FillHoles_Click(object sender, EventArgs e) => Remove(B_FillHoles, Map.CurrentLayer.RemoveAllHoles);
|
||||
private void B_RemovePlants_Click(object sender, EventArgs e) => Remove(B_RemovePlants, Map.CurrentLayer.RemoveAllPlants);
|
||||
private void B_RemoveFences_Click(object sender, EventArgs e) => Remove(B_RemoveFences, Map.CurrentLayer.RemoveAllFences);
|
||||
private void B_RemoveObjects_Click(object sender, EventArgs e) => Remove(B_RemoveObjects, Map.CurrentLayer.RemoveAllObjects);
|
||||
private void B_RemoveAll_Click(object sender, EventArgs e) => Remove(B_RemoveAll, Map.CurrentLayer.RemoveAll);
|
||||
private void B_RemovePlacedItems_Click(object sender, EventArgs e) => Remove(B_RemovePlacedItems, Map.CurrentLayer.RemoveAllPlacedItems);
|
||||
|
||||
private void PG_Tile_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) => PG_Tile.SelectedObject = PG_Tile.SelectedObject;
|
||||
|
||||
private void TR_Transparency_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
ReloadGrid(Layer, X, Y);
|
||||
ReloadMap();
|
||||
}
|
||||
|
||||
private static void ShowContextMenuBelow(ToolStripDropDown c, Control n) => c.Show(n.PointToScreen(new Point(0, n.Height)));
|
||||
private void B_RemoveItemDropDown_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_Remove, B_RemoveItemDropDown);
|
||||
private void B_DumpLoadField_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLField, B_DumpLoadField);
|
||||
private void B_DumpLoadTerrain_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLTerrain, B_DumpLoadTerrain);
|
||||
private void B_DumpLoadBuildings_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_DLBuilding, B_DumpLoadBuildings);
|
||||
private void B_ModifyAllTerrain_Click(object sender, EventArgs e) => ShowContextMenuBelow(CM_Terrain, B_ModifyAllTerrain);
|
||||
private void TR_Transparency_Scroll(object sender, EventArgs e) => ReloadItems();
|
||||
|
||||
#region Buildings
|
||||
|
||||
private void B_Help_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var form = new BuildingHelp();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void NUD_PlazaX_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
Map.PlazaX = (uint) NUD_PlazaX.Value;
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void NUD_PlazaY_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading)
|
||||
return;
|
||||
Map.PlazaY = (uint) NUD_PlazaY.Value;
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void LB_Items_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (LB_Items.SelectedIndex < 0)
|
||||
return;
|
||||
LoadIndex(LB_Items.SelectedIndex);
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
|
||||
private void LoadIndex(int index)
|
||||
{
|
||||
Loading = true;
|
||||
SelectedBuildingIndex = index;
|
||||
var b = Map.Buildings[index];
|
||||
NUD_BuildingType.Value = (int)b.BuildingType;
|
||||
NUD_X.Value = b.X;
|
||||
NUD_Y.Value = b.Y;
|
||||
NUD_Angle.Value = b.Angle;
|
||||
NUD_Bit.Value = b.Bit;
|
||||
NUD_Type.Value = b.Type;
|
||||
NUD_TypeArg.Value = b.TypeArg;
|
||||
NUD_UniqueID.Value = b.UniqueID;
|
||||
Loading = false;
|
||||
}
|
||||
|
||||
private void NUD_BuildingType_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (Loading || !(sender is NumericUpDown n))
|
||||
return;
|
||||
|
||||
var b = Map.Buildings[SelectedBuildingIndex];
|
||||
if (sender == NUD_BuildingType)
|
||||
b.BuildingType = (BuildingType)n.Value;
|
||||
else if (sender == NUD_X)
|
||||
b.X = (ushort)n.Value;
|
||||
else if (sender == NUD_Y)
|
||||
b.Y = (ushort)n.Value;
|
||||
else if (sender == NUD_Angle)
|
||||
b.Angle = (byte)n.Value;
|
||||
else if (sender == NUD_Bit)
|
||||
b.Bit = (sbyte)n.Value;
|
||||
else if (sender == NUD_Type)
|
||||
b.Type = (ushort)n.Value;
|
||||
else if (sender == NUD_TypeArg)
|
||||
b.TypeArg = (byte)n.Value;
|
||||
else if (sender == NUD_UniqueID)
|
||||
b.UniqueID = (ushort)n.Value;
|
||||
|
||||
LB_Items.Items[SelectedBuildingIndex] = Map.Buildings[SelectedBuildingIndex].ToString();
|
||||
ReloadBuildingsTerrain();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,4 +129,16 @@
|
|||
<metadata name="CM_Remove.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>465, 17</value>
|
||||
</metadata>
|
||||
<metadata name="CM_DLField.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>620, 17</value>
|
||||
</metadata>
|
||||
<metadata name="CM_DLBuilding.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>930, 17</value>
|
||||
</metadata>
|
||||
<metadata name="CM_DLTerrain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>775, 17</value>
|
||||
</metadata>
|
||||
<metadata name="CM_Terrain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1085, 17</value>
|
||||
</metadata>
|
||||
</root>
|
||||
213
NHSE.WinForms/Subforms/Map/MapDumpHelper.cs
Normal file
213
NHSE.WinForms/Subforms/Map/MapDumpHelper.cs
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHSE.Core;
|
||||
|
||||
namespace NHSE.WinForms
|
||||
{
|
||||
public static class MapDumpHelper
|
||||
{
|
||||
public static bool ImportToLayerAcreSingle(FieldItemLayer layer, int acreIndex, string acre, int layerIndex)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{acre}-{layerIndex}.nhl",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = layer.AcreTileCount * FieldItem.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
layer.ImportAcre(acreIndex, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ImportToLayerAcreAll(FieldItemLayer layer)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = "acres.nhl",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = layer.MapTileCount * FieldItem.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
layer.ImportAllAcres(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DumpLayerAcreSingle(FieldItemLayer layer, int acreIndex, string acre, int layerIndex)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = $"{acre}-{layerIndex}.nhl",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = layer.DumpAcre(acreIndex);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static void DumpLayerAcreAll(FieldItemLayer layer)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Field Item Layer (*.nhl)|*.nhl|All files (*.*)|*.*",
|
||||
FileName = "acres.nhl",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = layer.DumpAllAcres();
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static bool ImportTerrainAcre(TerrainManager m, int acreIndex, string acre)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = $"{acre}.nht",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = m.AcreTileCount * TerrainTile.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
m.ImportAcre(acreIndex, data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ImportTerrainAll(TerrainManager m)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = "terrainAcres.nht",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = m.MapTileCount * TerrainTile.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
m.ImportAllAcres(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DumpTerrainAcre(TerrainManager m, int acreIndex, string acre)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = $"{acre}.nht",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = m.DumpAcre(acreIndex);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static void DumpTerrainAll(TerrainManager m)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = "terrainAcres.nht",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = m.DumpAllAcres();
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static void DumpBuildings(IReadOnlyList<Building> buildings)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Building List (*.nhb)|*.nhb|All files (*.*)|*.*",
|
||||
FileName = "buildings.nhb",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
byte[] data = Building.SetArray(buildings);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
public static bool ImportBuildings(IReadOnlyList<Building> buildings)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Building List (*.nhb)|*.nhb|All files (*.*)|*.*",
|
||||
FileName = "buildings.nhb",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
return false;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
const int expect = Building.SIZE * MainSaveOffsets.BuildingCount; // 46
|
||||
const int oldSize = Building.SIZE * 40;
|
||||
if (fi.Length != expect && fi.Length != oldSize)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
var arr = Building.GetArray(data);
|
||||
for (int i = 0; i < arr.Length; i++)
|
||||
buildings[i].CopyFrom(arr[i]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
60
NHSE.WinForms/Subforms/Map/MapViewer.cs
Normal file
60
NHSE.WinForms/Subforms/Map/MapViewer.cs
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using NHSE.Core;
|
||||
using NHSE.Sprites;
|
||||
|
||||
namespace NHSE.WinForms
|
||||
{
|
||||
public sealed class MapViewer : MapView, IDisposable
|
||||
{
|
||||
// Cached acre view objects to remove allocation/GC
|
||||
private readonly int[] Scale1;
|
||||
private readonly int[] ScaleX;
|
||||
private readonly Bitmap ScaleAcre;
|
||||
private readonly int[] MapPixels;
|
||||
private readonly Bitmap MapReticle;
|
||||
|
||||
public MapViewer(MapManager m) : base(m)
|
||||
{
|
||||
var l1 = m.Items.Layer1;
|
||||
Scale1 = new int[l1.GridWidth * l1.GridHeight];
|
||||
ScaleX = new int[Scale1.Length * AcreScale * AcreScale];
|
||||
ScaleAcre = new Bitmap(l1.GridWidth * AcreScale, l1.GridHeight * AcreScale);
|
||||
|
||||
MapPixels = new int[l1.MapWidth * l1.MapHeight * MapScale * MapScale];
|
||||
MapReticle = new Bitmap(l1.MapWidth * MapScale, l1.MapHeight * MapScale);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
ScaleAcre.Dispose();
|
||||
MapReticle.Dispose();
|
||||
}
|
||||
|
||||
public Bitmap GetLayerAcre(int t) => GetLayerAcre(X, Y, t);
|
||||
public Bitmap GetBackgroundAcre(Font f, int index = -1) => GetBackgroundAcre(X, Y, f, index);
|
||||
public Bitmap GetMapWithReticle(int t) => GetMapWithReticle(X, Y, t, Map.CurrentLayer);
|
||||
|
||||
public Bitmap GetBackgroundTerrain(int index = -1)
|
||||
{
|
||||
return TerrainSprite.GetMapWithBuildings(Map.Terrain, Map.Buildings, (ushort)Map.PlazaX, (ushort)Map.PlazaY, null, 2, index);
|
||||
}
|
||||
|
||||
private Bitmap GetLayerAcre(int topX, int topY, int t)
|
||||
{
|
||||
var layer = Map.CurrentLayer;
|
||||
return FieldItemSpriteDrawer.GetBitmapLayerAcre(layer, topX, topY, AcreScale, Scale1, ScaleX, ScaleAcre, t);
|
||||
}
|
||||
|
||||
private Bitmap GetBackgroundAcre(int topX, int topY, Font f, int index = -1)
|
||||
{
|
||||
return TerrainSprite.GetAcre(topX / 2, topY / 2, Map.Terrain, AcreScale * 2, Map.Buildings,
|
||||
(ushort)Map.PlazaX, (ushort)Map.PlazaY, f, index);
|
||||
}
|
||||
|
||||
private Bitmap GetMapWithReticle(int topX, int topY, int t, FieldItemLayer layer)
|
||||
{
|
||||
return FieldItemSpriteDrawer.GetBitmapLayer(layer, topX, topY, MapPixels, MapReticle, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using NHSE.Core;
|
||||
using NHSE.Sprites;
|
||||
|
|
@ -26,7 +25,7 @@ public TerrainEditor(MainSave sav)
|
|||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
|
||||
SAV = sav;
|
||||
Terrain = new TerrainManager(SAV.GetTerrain());
|
||||
Terrain = new TerrainManager(SAV.GetTerrainTiles());
|
||||
Grid = GenerateGrid(GridWidth, GridHeight);
|
||||
|
||||
foreach (var acre in MapGrid.Acres)
|
||||
|
|
@ -151,7 +150,7 @@ private void DeleteTile(TerrainTile tile, Control obj)
|
|||
|
||||
private void B_Save_Click(object sender, EventArgs e)
|
||||
{
|
||||
SAV.SetTerrain(Terrain.Tiles);
|
||||
SAV.SetTerrainTiles(Terrain.Tiles);
|
||||
Close();
|
||||
}
|
||||
|
||||
|
|
@ -201,6 +200,8 @@ private static void RefreshTile(Control button, TerrainTile tile)
|
|||
private void B_Left_Click(object sender, EventArgs e) => --CB_Acre.SelectedIndex;
|
||||
private void B_Right_Click(object sender, EventArgs e) => ++CB_Acre.SelectedIndex;
|
||||
private void B_Down_Click(object sender, EventArgs e) => CB_Acre.SelectedIndex += MapGrid.AcreWidth;
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAcre(Terrain, AcreIndex, CB_Acre.Text);
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e) => MapDumpHelper.DumpTerrainAll(Terrain);
|
||||
|
||||
private void B_ZeroElevation_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
@ -224,85 +225,18 @@ private void B_SetAll_Click(object sender, EventArgs e)
|
|||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_DumpAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}.nht",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var acre = AcreIndex;
|
||||
var data = Terrain.DumpAcre(acre);
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
private void B_DumpAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var sfd = new SaveFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = "terrainAcres.nht",
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
var path = sfd.FileName;
|
||||
var data = Terrain.DumpAllAcres();
|
||||
File.WriteAllBytes(path, data);
|
||||
}
|
||||
|
||||
private void B_ImportAcre_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = $"{CB_Acre.Text}.nht",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
if (!MapDumpHelper.ImportTerrainAcre(Terrain, AcreIndex, CB_Acre.Text))
|
||||
return;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = Terrain.AcreTileCount * TerrainTile.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
Terrain.ImportAcre(AcreIndex, data);
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
||||
private void B_ImportAllAcres_Click(object sender, EventArgs e)
|
||||
{
|
||||
using var ofd = new OpenFileDialog
|
||||
{
|
||||
Filter = "New Horizons Terrain (*.nht)|*.nht|All files (*.*)|*.*",
|
||||
FileName = "terrainAcres.nht",
|
||||
};
|
||||
if (ofd.ShowDialog() != DialogResult.OK)
|
||||
if (!MapDumpHelper.ImportTerrainAll(Terrain))
|
||||
return;
|
||||
|
||||
var path = ofd.FileName;
|
||||
var fi = new FileInfo(path);
|
||||
|
||||
int expect = Terrain.MapTileCount * TerrainTile.SIZE;
|
||||
if (fi.Length != expect)
|
||||
{
|
||||
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, fi.Length, expect));
|
||||
return;
|
||||
}
|
||||
|
||||
var data = File.ReadAllBytes(path);
|
||||
Terrain.ImportAllAcres(data);
|
||||
ChangeViewToAcre(AcreIndex);
|
||||
System.Media.SystemSounds.Asterisk.Play();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user