Remove deprecated editors

This commit is contained in:
Kurt
2020-05-09 17:05:38 -07:00
parent 74bf1d4cef
commit ce427bd698
12 changed files with 27 additions and 3720 deletions

View File

@@ -44,6 +44,8 @@ private void InitializeComponent()
this.CM_Picture = new System.Windows.Forms.ContextMenuStrip(this.components);
this.Menu_SavePNG = new System.Windows.Forms.ToolStripMenuItem();
this.Tab_Map = new System.Windows.Forms.TabPage();
this.B_EditDesignsTailor = new System.Windows.Forms.Button();
this.B_EditPatternFlag = new System.Windows.Forms.Button();
this.CB_AirportColor = new System.Windows.Forms.ComboBox();
this.L_AirportColor = new System.Windows.Forms.Label();
this.L_Hemisphere = new System.Windows.Forms.Label();
@@ -53,9 +55,6 @@ private void InitializeComponent()
this.CM_EditMap = new System.Windows.Forms.ContextMenuStrip(this.components);
this.B_EditLandFlags = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditFieldItems = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditTerrain = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditBuildings = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditAcres = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditBulletin = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditFieldGoods = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPRODesigns = new System.Windows.Forms.Button();
@@ -95,8 +94,6 @@ private void InitializeComponent()
this.CB_Players = new System.Windows.Forms.ComboBox();
this.PB_Player = new System.Windows.Forms.PictureBox();
this.TC_Editors = new System.Windows.Forms.TabControl();
this.B_EditPatternFlag = new System.Windows.Forms.Button();
this.B_EditDesignsTailor = new System.Windows.Forms.Button();
this.Menu_Editor.SuspendLayout();
this.CM_Picture.SuspendLayout();
this.Tab_Map.SuspendLayout();
@@ -257,6 +254,26 @@ private void InitializeComponent()
this.Tab_Map.Text = "Map";
this.Tab_Map.UseVisualStyleBackColor = true;
//
// B_EditDesignsTailor
//
this.B_EditDesignsTailor.Location = new System.Drawing.Point(300, 98);
this.B_EditDesignsTailor.Name = "B_EditDesignsTailor";
this.B_EditDesignsTailor.Size = new System.Drawing.Size(92, 40);
this.B_EditDesignsTailor.TabIndex = 63;
this.B_EditDesignsTailor.Text = "Edit Tailor Designs";
this.B_EditDesignsTailor.UseVisualStyleBackColor = true;
this.B_EditDesignsTailor.Click += new System.EventHandler(this.B_EditDesignsTailor_Click);
//
// B_EditPatternFlag
//
this.B_EditPatternFlag.Location = new System.Drawing.Point(202, 98);
this.B_EditPatternFlag.Name = "B_EditPatternFlag";
this.B_EditPatternFlag.Size = new System.Drawing.Size(92, 40);
this.B_EditPatternFlag.TabIndex = 62;
this.B_EditPatternFlag.Text = "Edit Flag Design";
this.B_EditPatternFlag.UseVisualStyleBackColor = true;
this.B_EditPatternFlag.Click += new System.EventHandler(this.B_EditPatternFlag_Click);
//
// CB_AirportColor
//
this.CB_AirportColor.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
@@ -320,60 +337,36 @@ private void InitializeComponent()
this.CM_EditMap.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.B_EditLandFlags,
this.B_EditFieldItems,
this.B_EditTerrain,
this.B_EditBuildings,
this.B_EditAcres,
this.B_EditBulletin,
this.B_EditFieldGoods});
this.CM_EditMap.Name = "CM_EditMap";
this.CM_EditMap.Size = new System.Drawing.Size(172, 158);
this.CM_EditMap.Size = new System.Drawing.Size(181, 114);
//
// B_EditLandFlags
//
this.B_EditLandFlags.Name = "B_EditLandFlags";
this.B_EditLandFlags.Size = new System.Drawing.Size(171, 22);
this.B_EditLandFlags.Size = new System.Drawing.Size(180, 22);
this.B_EditLandFlags.Text = "Edit Flags";
this.B_EditLandFlags.Click += new System.EventHandler(this.B_EditLandFlags_Click);
//
// B_EditFieldItems
//
this.B_EditFieldItems.Name = "B_EditFieldItems";
this.B_EditFieldItems.Size = new System.Drawing.Size(171, 22);
this.B_EditFieldItems.Size = new System.Drawing.Size(180, 22);
this.B_EditFieldItems.Text = "Edit Field Items";
this.B_EditFieldItems.Click += new System.EventHandler(this.B_EditFieldItems_Click);
//
// B_EditTerrain
//
this.B_EditTerrain.Name = "B_EditTerrain";
this.B_EditTerrain.Size = new System.Drawing.Size(171, 22);
this.B_EditTerrain.Text = "Edit Terrain";
this.B_EditTerrain.Click += new System.EventHandler(this.B_EditTerrain_Click);
//
// B_EditBuildings
//
this.B_EditBuildings.Name = "B_EditBuildings";
this.B_EditBuildings.Size = new System.Drawing.Size(171, 22);
this.B_EditBuildings.Text = "Edit Buildings";
this.B_EditBuildings.Click += new System.EventHandler(this.B_EditBuildings_Click);
//
// B_EditAcres
//
this.B_EditAcres.Name = "B_EditAcres";
this.B_EditAcres.Size = new System.Drawing.Size(171, 22);
this.B_EditAcres.Text = "Edit Acres";
this.B_EditAcres.Click += new System.EventHandler(this.B_EditAcres_Click);
//
// B_EditBulletin
//
this.B_EditBulletin.Name = "B_EditBulletin";
this.B_EditBulletin.Size = new System.Drawing.Size(171, 22);
this.B_EditBulletin.Size = new System.Drawing.Size(180, 22);
this.B_EditBulletin.Text = "Edit Bulletin Board";
this.B_EditBulletin.Click += new System.EventHandler(this.B_EditBulletin_Click);
//
// B_EditFieldGoods
//
this.B_EditFieldGoods.Name = "B_EditFieldGoods";
this.B_EditFieldGoods.Size = new System.Drawing.Size(171, 22);
this.B_EditFieldGoods.Size = new System.Drawing.Size(180, 22);
this.B_EditFieldGoods.Text = "Edit Field Goods";
this.B_EditFieldGoods.Click += new System.EventHandler(this.B_EditFieldGoods_Click);
//
@@ -772,26 +765,6 @@ private void InitializeComponent()
this.TC_Editors.Size = new System.Drawing.Size(404, 237);
this.TC_Editors.TabIndex = 1;
//
// B_EditPatternFlag
//
this.B_EditPatternFlag.Location = new System.Drawing.Point(202, 98);
this.B_EditPatternFlag.Name = "B_EditPatternFlag";
this.B_EditPatternFlag.Size = new System.Drawing.Size(92, 40);
this.B_EditPatternFlag.TabIndex = 62;
this.B_EditPatternFlag.Text = "Edit Flag Design";
this.B_EditPatternFlag.UseVisualStyleBackColor = true;
this.B_EditPatternFlag.Click += new System.EventHandler(this.B_EditPatternFlag_Click);
//
// B_EditDesignsTailor
//
this.B_EditDesignsTailor.Location = new System.Drawing.Point(300, 98);
this.B_EditDesignsTailor.Name = "B_EditDesignsTailor";
this.B_EditDesignsTailor.Size = new System.Drawing.Size(92, 40);
this.B_EditDesignsTailor.TabIndex = 63;
this.B_EditDesignsTailor.Text = "Edit Tailor Designs";
this.B_EditDesignsTailor.UseVisualStyleBackColor = true;
this.B_EditDesignsTailor.Click += new System.EventHandler(this.B_EditDesignsTailor_Click);
//
// Editor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -866,9 +839,6 @@ private void InitializeComponent()
private System.Windows.Forms.Button B_EditPRODesigns;
private System.Windows.Forms.Button B_EditMap;
private System.Windows.Forms.ContextMenuStrip CM_EditMap;
private System.Windows.Forms.ToolStripMenuItem B_EditTerrain;
private System.Windows.Forms.ToolStripMenuItem B_EditBuildings;
private System.Windows.Forms.ToolStripMenuItem B_EditAcres;
private System.Windows.Forms.ToolStripMenuItem B_EditFieldItems;
private System.Windows.Forms.ContextMenuStrip CM_EditPlayer;
private System.Windows.Forms.ToolStripMenuItem B_EditPlayerStorage;

View File

@@ -393,12 +393,6 @@ private void Menu_SavePNG_Click(object sender, EventArgs e)
bmp.Save(sfd.FileName, ImageFormat.Png);
}
private void B_EditBuildings_Click(object sender, EventArgs e)
{
using var editor = new BuildingEditor(SAV.Main);
editor.ShowDialog();
}
private void B_EditTurnipExchange_Click(object sender, EventArgs e)
{
var turnips = SAV.Main.Turnips;
@@ -407,18 +401,6 @@ private void B_EditTurnipExchange_Click(object sender, EventArgs e)
SAV.Main.Turnips = turnips;
}
private void B_EditAcres_Click(object sender, EventArgs e)
{
using var editor = new AcreEditor(SAV.Main);
editor.ShowDialog();
}
private void B_EditTerrain_Click(object sender, EventArgs e)
{
using var editor = new TerrainEditor(SAV.Main);
editor.ShowDialog();
}
private void B_EditFieldItems_Click(object sender, EventArgs e)
{
using var editor = new FieldItemEditor(SAV.Main);

View File

@@ -71,9 +71,6 @@
<SubType>Form</SubType>
</Compile>
<Compile Update="Subforms\Map\FieldItemEditor.cs" />
<Compile Update="Subforms\Map\TerrainEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Subforms\SingleObjectEditor.cs">
<SubType>Form</SubType>
</Compile>

File diff suppressed because it is too large Load Diff

View File

@@ -1,118 +0,0 @@
using System;
using System.IO;
using System.Windows.Forms;
using NHSE.Core;
namespace NHSE.WinForms
{
public partial class AcreEditor : Form
{
private readonly NumericUpDown[] Acres;
private readonly MainSave SAV;
public AcreEditor(MainSave sav)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
SAV = sav;
Acres = new[]
{
NUD_00, NUD_01, NUD_02, NUD_03, NUD_04, NUD_05, NUD_06, NUD_07, NUD_08,
NUD_09, NUD_0A, NUD_0B, NUD_0C, NUD_0D, NUD_0E, NUD_0F, NUD_10, NUD_11,
NUD_12, NUD_13, NUD_14, NUD_15, NUD_16, NUD_17, NUD_18, NUD_19, NUD_1A,
NUD_1B, NUD_1C, NUD_1D, NUD_1E, NUD_1F, NUD_20, NUD_21, NUD_22, NUD_23,
NUD_24, NUD_25, NUD_26, NUD_27, NUD_28, NUD_29, NUD_2A, NUD_2B, NUD_2C,
NUD_2D, NUD_2E, NUD_2F, NUD_30, NUD_31, NUD_32, NUD_33, NUD_34, NUD_35,
NUD_36, NUD_37, NUD_38, NUD_39, NUD_3A, NUD_3B, NUD_3C, NUD_3D, NUD_3E,
NUD_3F, NUD_40, NUD_41, NUD_42, NUD_43, NUD_44, NUD_45, NUD_46, NUD_47,
};
LoadAcres();
LoadHintComboBox();
for (var i = 0; i < Acres.Length; i++)
{
var a = Acres[i];
var x = i % MainSave.AcreWidth;
var y = i / MainSave.AcreWidth;
a.MouseEnter += (sender, args) => UpdateAcre((ushort)a.Value, x, y);
a.ValueChanged += (sender, args) => UpdateAcre((ushort)a.Value, x, y);
}
}
private void UpdateAcre(ushort val, int x, int y)
{
var name = (OutsideAcre)val;
L_Hovered.Text = $"{x},{y} - 0x{val:X2} = {name}";
L_Hovered.Visible = true;
}
private void LoadHintComboBox()
{
CB_AcreNames.DisplayMember = nameof(ComboItem.Text);
CB_AcreNames.ValueMember = nameof(ComboItem.Value);
CB_AcreNames.DataSource = ComboItemUtil.GetArray<ushort>(typeof(OutsideAcre));
CB_AcreNames.SelectedIndex = 0;
}
private void LoadAcres()
{
for (int i = 0; i < Acres.Length; i++)
Acres[i].Value = SAV.GetAcre(i);
}
private void SaveAcres()
{
for (int i = 0; i < Acres.Length; i++)
SAV.SetAcre(i, (ushort)Acres[i].Value);
}
private void B_Save_Click(object sender, EventArgs e) { SaveAcres(); Close(); }
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void B_Export_Click(object sender, EventArgs e)
{
using var sfd = new SaveFileDialog
{
Filter = "New Horizons Acres (*.nha)|*.nha|All files (*.*)|*.*",
FileName = "acres.nha",
};
if (sfd.ShowDialog() != DialogResult.OK)
return;
var original = SAV.GetAcreBytes();
SaveAcres();
var modified = SAV.GetAcreBytes();
SAV.SetAcreBytes(original);
File.WriteAllBytes(sfd.FileName, modified);
}
private void B_Import_Click(object sender, EventArgs e)
{
using var ofd = new OpenFileDialog
{
Filter = "New Horizons Acres (*.nha)|*.nha|All files (*.*)|*.*",
FileName = "acres.nha",
};
if (ofd.ShowDialog() != DialogResult.OK)
return;
var path = ofd.FileName;
var original = SAV.GetAcreBytes();
var modified = File.ReadAllBytes(path);
if (original.Length != modified.Length)
{
WinFormsUtil.Error(string.Format(MessageStrings.MsgDataSizeMismatchImport, modified.Length, original.Length), path);
return;
}
SAV.SetAcreBytes(modified);
LoadAcres();
SAV.SetAcreBytes(original);
}
}
}

View File

@@ -1,120 +0,0 @@
<?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>

View File

@@ -1,538 +0,0 @@
namespace NHSE.WinForms
{
partial class BuildingEditor
{
/// <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();
Map.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.B_Save = new System.Windows.Forms.Button();
this.B_Cancel = new System.Windows.Forms.Button();
this.LB_Items = new System.Windows.Forms.ListBox();
this.PB_Map = new System.Windows.Forms.PictureBox();
this.L_BuildingType = new System.Windows.Forms.Label();
this.NUD_BuildingType = new System.Windows.Forms.NumericUpDown();
this.NUD_X = new System.Windows.Forms.NumericUpDown();
this.L_BuildingX = new System.Windows.Forms.Label();
this.NUD_Y = new System.Windows.Forms.NumericUpDown();
this.L_BuildingY = new System.Windows.Forms.Label();
this.NUD_Angle = new System.Windows.Forms.NumericUpDown();
this.L_BuildingRotation = new System.Windows.Forms.Label();
this.NUD_Type = new System.Windows.Forms.NumericUpDown();
this.L_BuildingStructureType = new System.Windows.Forms.Label();
this.NUD_TypeArg = new System.Windows.Forms.NumericUpDown();
this.L_BuildingStructureArg = new System.Windows.Forms.Label();
this.NUD_UniqueID = new System.Windows.Forms.NumericUpDown();
this.L_BuildingUniqueID = new System.Windows.Forms.Label();
this.GB_Building = new System.Windows.Forms.GroupBox();
this.L_Bit = new System.Windows.Forms.Label();
this.NUD_Bit = new System.Windows.Forms.NumericUpDown();
this.GB_Info = new System.Windows.Forms.GroupBox();
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.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_Import = new System.Windows.Forms.Button();
this.B_Dump = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_BuildingType)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Angle)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Type)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TypeArg)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_UniqueID)).BeginInit();
this.GB_Building.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_Bit)).BeginInit();
this.GB_Info.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaY)).BeginInit();
this.SuspendLayout();
//
// 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(609, 528);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(65, 23);
this.B_Save.TabIndex = 1;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// 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(609, 554);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(65, 23);
this.B_Cancel.TabIndex = 2;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_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(12, 12);
this.LB_Items.Name = "LB_Items";
this.LB_Items.Size = new System.Drawing.Size(206, 563);
this.LB_Items.TabIndex = 3;
this.LB_Items.SelectedIndexChanged += new System.EventHandler(this.LB_Items_SelectedIndexChanged);
//
// PB_Map
//
this.PB_Map.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.PB_Map.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.PB_Map.Location = new System.Drawing.Point(224, 12);
this.PB_Map.Name = "PB_Map";
this.PB_Map.Size = new System.Drawing.Size(450, 386);
this.PB_Map.TabIndex = 5;
this.PB_Map.TabStop = false;
//
// L_BuildingType
//
this.L_BuildingType.Location = new System.Drawing.Point(6, 12);
this.L_BuildingType.Name = "L_BuildingType";
this.L_BuildingType.Size = new System.Drawing.Size(100, 18);
this.L_BuildingType.TabIndex = 6;
this.L_BuildingType.Text = "Building Type:";
this.L_BuildingType.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_BuildingType
//
this.NUD_BuildingType.Location = new System.Drawing.Point(112, 13);
this.NUD_BuildingType.Name = "NUD_BuildingType";
this.NUD_BuildingType.Size = new System.Drawing.Size(69, 20);
this.NUD_BuildingType.TabIndex = 7;
this.NUD_BuildingType.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// NUD_X
//
this.NUD_X.Location = new System.Drawing.Point(61, 34);
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 = 9;
this.NUD_X.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingX
//
this.L_BuildingX.Location = new System.Drawing.Point(35, 33);
this.L_BuildingX.Name = "L_BuildingX";
this.L_BuildingX.Size = new System.Drawing.Size(20, 18);
this.L_BuildingX.TabIndex = 8;
this.L_BuildingX.Text = "X:";
this.L_BuildingX.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Y
//
this.NUD_Y.Location = new System.Drawing.Point(136, 34);
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 = 11;
this.NUD_Y.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingY
//
this.L_BuildingY.Location = new System.Drawing.Point(107, 33);
this.L_BuildingY.Name = "L_BuildingY";
this.L_BuildingY.Size = new System.Drawing.Size(23, 18);
this.L_BuildingY.TabIndex = 10;
this.L_BuildingY.Text = "Y:";
this.L_BuildingY.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Angle
//
this.NUD_Angle.Location = new System.Drawing.Point(112, 59);
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 = 13;
this.NUD_Angle.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingRotation
//
this.L_BuildingRotation.Location = new System.Drawing.Point(6, 58);
this.L_BuildingRotation.Name = "L_BuildingRotation";
this.L_BuildingRotation.Size = new System.Drawing.Size(100, 18);
this.L_BuildingRotation.TabIndex = 12;
this.L_BuildingRotation.Text = "Angle:";
this.L_BuildingRotation.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Type
//
this.NUD_Type.Location = new System.Drawing.Point(112, 105);
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 = 15;
this.NUD_Type.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingStructureType
//
this.L_BuildingStructureType.Location = new System.Drawing.Point(6, 104);
this.L_BuildingStructureType.Name = "L_BuildingStructureType";
this.L_BuildingStructureType.Size = new System.Drawing.Size(100, 18);
this.L_BuildingStructureType.TabIndex = 14;
this.L_BuildingStructureType.Text = "Type:";
this.L_BuildingStructureType.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_TypeArg
//
this.NUD_TypeArg.Location = new System.Drawing.Point(112, 126);
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 = 17;
this.NUD_TypeArg.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingStructureArg
//
this.L_BuildingStructureArg.Location = new System.Drawing.Point(6, 125);
this.L_BuildingStructureArg.Name = "L_BuildingStructureArg";
this.L_BuildingStructureArg.Size = new System.Drawing.Size(100, 18);
this.L_BuildingStructureArg.TabIndex = 16;
this.L_BuildingStructureArg.Text = "TypeArg:";
this.L_BuildingStructureArg.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_UniqueID
//
this.NUD_UniqueID.Location = new System.Drawing.Point(112, 147);
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 = 19;
this.NUD_UniqueID.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// L_BuildingUniqueID
//
this.L_BuildingUniqueID.Location = new System.Drawing.Point(6, 146);
this.L_BuildingUniqueID.Name = "L_BuildingUniqueID";
this.L_BuildingUniqueID.Size = new System.Drawing.Size(100, 18);
this.L_BuildingUniqueID.TabIndex = 18;
this.L_BuildingUniqueID.Text = "UniqueID:";
this.L_BuildingUniqueID.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// GB_Building
//
this.GB_Building.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.GB_Building.Controls.Add(this.L_Bit);
this.GB_Building.Controls.Add(this.NUD_Bit);
this.GB_Building.Controls.Add(this.L_BuildingType);
this.GB_Building.Controls.Add(this.NUD_BuildingType);
this.GB_Building.Controls.Add(this.NUD_UniqueID);
this.GB_Building.Controls.Add(this.L_BuildingX);
this.GB_Building.Controls.Add(this.L_BuildingUniqueID);
this.GB_Building.Controls.Add(this.NUD_X);
this.GB_Building.Controls.Add(this.NUD_TypeArg);
this.GB_Building.Controls.Add(this.L_BuildingY);
this.GB_Building.Controls.Add(this.L_BuildingStructureArg);
this.GB_Building.Controls.Add(this.NUD_Y);
this.GB_Building.Controls.Add(this.NUD_Type);
this.GB_Building.Controls.Add(this.L_BuildingRotation);
this.GB_Building.Controls.Add(this.L_BuildingStructureType);
this.GB_Building.Controls.Add(this.NUD_Angle);
this.GB_Building.Location = new System.Drawing.Point(224, 401);
this.GB_Building.Name = "GB_Building";
this.GB_Building.Size = new System.Drawing.Size(194, 176);
this.GB_Building.TabIndex = 21;
this.GB_Building.TabStop = false;
this.GB_Building.Text = "Editor";
//
// L_Bit
//
this.L_Bit.Location = new System.Drawing.Point(6, 79);
this.L_Bit.Name = "L_Bit";
this.L_Bit.Size = new System.Drawing.Size(100, 18);
this.L_Bit.TabIndex = 20;
this.L_Bit.Text = "Bit:";
this.L_Bit.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_Bit
//
this.NUD_Bit.Location = new System.Drawing.Point(112, 80);
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 = 21;
this.NUD_Bit.ValueChanged += new System.EventHandler(this.NUD_BuildingType_ValueChanged);
//
// GB_Info
//
this.GB_Info.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.GB_Info.Controls.Add(this.L_StructureValues);
this.GB_Info.Controls.Add(this.CB_StructureValues);
this.GB_Info.Controls.Add(this.L_StructureType);
this.GB_Info.Controls.Add(this.CB_StructureType);
this.GB_Info.Location = new System.Drawing.Point(424, 401);
this.GB_Info.Name = "GB_Info";
this.GB_Info.Size = new System.Drawing.Size(250, 117);
this.GB_Info.TabIndex = 22;
this.GB_Info.TabStop = false;
this.GB_Info.Text = "Info";
//
// L_StructureValues
//
this.L_StructureValues.AutoSize = true;
this.L_StructureValues.Location = new System.Drawing.Point(17, 64);
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(20, 80);
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(17, 18);
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(20, 35);
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);
//
// 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(497, 530);
this.L_PlazaX.Name = "L_PlazaX";
this.L_PlazaX.Size = new System.Drawing.Size(62, 20);
this.L_PlazaX.TabIndex = 104;
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(560, 531);
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 = 103;
this.NUD_PlazaX.Value = new decimal(new int[] {
555,
0,
0,
0});
this.NUD_PlazaX.ValueChanged += new System.EventHandler(this.NUD_PlazaCoordinate_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(497, 553);
this.L_PlazaY.Name = "L_PlazaY";
this.L_PlazaY.Size = new System.Drawing.Size(62, 20);
this.L_PlazaY.TabIndex = 102;
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(560, 554);
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 = 101;
this.NUD_PlazaY.Value = new decimal(new int[] {
555,
0,
0,
0});
this.NUD_PlazaY.ValueChanged += new System.EventHandler(this.NUD_PlazaCoordinate_ValueChanged);
//
// B_Import
//
this.B_Import.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Import.Location = new System.Drawing.Point(424, 554);
this.B_Import.Name = "B_Import";
this.B_Import.Size = new System.Drawing.Size(65, 23);
this.B_Import.TabIndex = 106;
this.B_Import.Text = "Import";
this.B_Import.UseVisualStyleBackColor = true;
this.B_Import.Click += new System.EventHandler(this.B_ImportAll_Click);
//
// B_Dump
//
this.B_Dump.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.B_Dump.Location = new System.Drawing.Point(424, 528);
this.B_Dump.Name = "B_Dump";
this.B_Dump.Size = new System.Drawing.Size(65, 23);
this.B_Dump.TabIndex = 105;
this.B_Dump.Text = "Dump";
this.B_Dump.UseVisualStyleBackColor = true;
this.B_Dump.Click += new System.EventHandler(this.B_DumpAll_Click);
//
// BuildingEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(684, 588);
this.Controls.Add(this.B_Import);
this.Controls.Add(this.B_Dump);
this.Controls.Add(this.L_PlazaX);
this.Controls.Add(this.NUD_PlazaX);
this.Controls.Add(this.L_PlazaY);
this.Controls.Add(this.NUD_PlazaY);
this.Controls.Add(this.GB_Info);
this.Controls.Add(this.GB_Building);
this.Controls.Add(this.PB_Map);
this.Controls.Add(this.LB_Items);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.Icon = global::NHSE.WinForms.Properties.Resources.icon;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "BuildingEditor";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Building Editor";
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_BuildingType)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_X)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Y)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Angle)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_Type)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_TypeArg)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_UniqueID)).EndInit();
this.GB_Building.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.NUD_Bit)).EndInit();
this.GB_Info.ResumeLayout(false);
this.GB_Info.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaX)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_PlazaY)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.ListBox LB_Items;
private System.Windows.Forms.PictureBox PB_Map;
private System.Windows.Forms.Label L_BuildingType;
private System.Windows.Forms.NumericUpDown NUD_BuildingType;
private System.Windows.Forms.NumericUpDown NUD_X;
private System.Windows.Forms.Label L_BuildingX;
private System.Windows.Forms.NumericUpDown NUD_Y;
private System.Windows.Forms.Label L_BuildingY;
private System.Windows.Forms.NumericUpDown NUD_Angle;
private System.Windows.Forms.Label L_BuildingRotation;
private System.Windows.Forms.NumericUpDown NUD_Type;
private System.Windows.Forms.Label L_BuildingStructureType;
private System.Windows.Forms.NumericUpDown NUD_TypeArg;
private System.Windows.Forms.Label L_BuildingStructureArg;
private System.Windows.Forms.NumericUpDown NUD_UniqueID;
private System.Windows.Forms.Label L_BuildingUniqueID;
private System.Windows.Forms.GroupBox GB_Building;
private System.Windows.Forms.GroupBox GB_Info;
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;
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_Import;
private System.Windows.Forms.Button B_Dump;
private System.Windows.Forms.Label L_Bit;
private System.Windows.Forms.NumericUpDown NUD_Bit;
}
}

View File

@@ -1,147 +0,0 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using NHSE.Core;
using NHSE.Sprites;
namespace NHSE.WinForms
{
public partial class BuildingEditor : Form
{
private readonly IReadOnlyList<Building> Buildings;
private readonly MainSave SAV;
private static readonly IReadOnlyDictionary<string, string[]> HelpDictionary = StructureUtil.GetStructureHelpList();
private readonly Bitmap Map;
private readonly int[] Scale1;
private readonly int[] ScaleX;
private readonly MapTerrainStructure Manager;
private const int scale = 4;
public BuildingEditor(MainSave sav)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
Manager = new MapTerrainStructure(sav);
SAV = sav;
Buildings = Manager.Buildings;
Scale1 = new int[Manager.Terrain.MapWidth * Manager.Terrain.MapHeight];
ScaleX = new int[Scale1.Length * scale * scale];
Map = new Bitmap(Manager.Terrain.MapWidth * scale, Manager.Terrain.MapHeight * scale);
NUD_PlazaX.Value = sav.EventPlazaLeftUpX;
NUD_PlazaY.Value = sav.EventPlazaLeftUpZ;
foreach (var obj in Manager.Buildings)
LB_Items.Items.Add(obj.ToString());
LB_Items.SelectedIndex = 0;
foreach (var entry in HelpDictionary)
CB_StructureType.Items.Add(entry.Key);
CB_StructureType.SelectedIndex = 0;
DialogResult = DialogResult.Cancel;
}
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void B_Save_Click(object sender, EventArgs e)
{
SAV.EventPlazaLeftUpX = (uint)NUD_PlazaX.Value;
SAV.EventPlazaLeftUpZ = (uint)NUD_PlazaY.Value;
DialogResult = DialogResult.OK;
SAV.Buildings = Manager.Buildings;
Close();
}
private int Index;
private bool Loading;
private void DrawMap(in int index)
{
var font = B_Save.Font;
Manager.PlazaX = (ushort) NUD_PlazaX.Value;
Manager.PlazaY = (ushort) NUD_PlazaY.Value;
PB_Map.Image = TerrainSprite.GetMapWithBuildings(Manager, font, Scale1, ScaleX, Map, scale, index);
}
private void LB_Items_SelectedIndexChanged(object sender, EventArgs e)
{
if (LB_Items.SelectedIndex < 0)
return;
LoadIndex(LB_Items.SelectedIndex);
DrawMap(Index);
}
private void LoadIndex(int index)
{
Loading = true;
Index = index;
var b = 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 = Buildings[Index];
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[Index] = Buildings[Index].ToString();
DrawMap(Index);
}
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;
}
private void NUD_PlazaCoordinate_ValueChanged(object sender, EventArgs e) => DrawMap(Index);
private void B_DumpAll_Click(object sender, EventArgs e) => MapDumpHelper.DumpBuildings(Buildings);
private void B_ImportAll_Click(object sender, EventArgs e)
{
if (!MapDumpHelper.ImportBuildings(Buildings))
return;
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();
}
}
}

View File

@@ -1,120 +0,0 @@
<?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>

View File

@@ -1,369 +0,0 @@
namespace NHSE.WinForms
{
partial class TerrainEditor
{
/// <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();
Map.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.components = new System.ComponentModel.Container();
this.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.FLP_Tile = new System.Windows.Forms.FlowLayoutPanel();
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_ZeroElevation = new System.Windows.Forms.Button();
this.B_SetAll = new System.Windows.Forms.Button();
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();
this.Menu_Reset = new System.Windows.Forms.ToolStripMenuItem();
this.B_Up = new System.Windows.Forms.Button();
this.B_Left = new System.Windows.Forms.Button();
this.B_Right = new System.Windows.Forms.Button();
this.B_Down = new System.Windows.Forms.Button();
this.PB_Map = new System.Windows.Forms.PictureBox();
this.CM_Picture = new System.Windows.Forms.ContextMenuStrip(this.components);
this.Menu_SavePNG = new System.Windows.Forms.ToolStripMenuItem();
this.CHK_SnapToAcre = new System.Windows.Forms.CheckBox();
this.L_Coordinates = new System.Windows.Forms.Label();
this.CM_Click.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).BeginInit();
this.CM_Picture.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(899, 787);
this.B_Cancel.Name = "B_Cancel";
this.B_Cancel.Size = new System.Drawing.Size(72, 23);
this.B_Cancel.TabIndex = 7;
this.B_Cancel.Text = "Cancel";
this.B_Cancel.UseVisualStyleBackColor = true;
this.B_Cancel.Click += new System.EventHandler(this.B_Cancel_Click);
//
// 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(977, 787);
this.B_Save.Name = "B_Save";
this.B_Save.Size = new System.Drawing.Size(72, 23);
this.B_Save.TabIndex = 6;
this.B_Save.Text = "Save";
this.B_Save.UseVisualStyleBackColor = true;
this.B_Save.Click += new System.EventHandler(this.B_Save_Click);
//
// FLP_Tile
//
this.FLP_Tile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.FLP_Tile.Location = new System.Drawing.Point(12, 12);
this.FLP_Tile.Name = "FLP_Tile";
this.FLP_Tile.Size = new System.Drawing.Size(802, 802);
this.FLP_Tile.TabIndex = 8;
//
// PG_Tile
//
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.Location = new System.Drawing.Point(820, 12);
this.PG_Tile.Name = "PG_Tile";
this.PG_Tile.PropertySort = System.Windows.Forms.PropertySort.Categorized;
this.PG_Tile.Size = new System.Drawing.Size(229, 244);
this.PG_Tile.TabIndex = 9;
this.PG_Tile.ToolbarVisible = false;
//
// CB_Acre
//
this.CB_Acre.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.CB_Acre.FormattingEnabled = true;
this.CB_Acre.Location = new System.Drawing.Point(978, 598);
this.CB_Acre.Name = "CB_Acre";
this.CB_Acre.Size = new System.Drawing.Size(49, 21);
this.CB_Acre.TabIndex = 10;
this.CB_Acre.SelectedIndexChanged += new System.EventHandler(this.ChangeAcre);
//
// L_Acre
//
this.L_Acre.AutoSize = true;
this.L_Acre.Location = new System.Drawing.Point(940, 601);
this.L_Acre.Name = "L_Acre";
this.L_Acre.Size = new System.Drawing.Size(32, 13);
this.L_Acre.TabIndex = 11;
this.L_Acre.Text = "Acre:";
//
// B_ZeroElevation
//
this.B_ZeroElevation.Location = new System.Drawing.Point(820, 262);
this.B_ZeroElevation.Name = "B_ZeroElevation";
this.B_ZeroElevation.Size = new System.Drawing.Size(112, 40);
this.B_ZeroElevation.TabIndex = 12;
this.B_ZeroElevation.Text = "Zero All Elevation";
this.B_ZeroElevation.UseVisualStyleBackColor = true;
this.B_ZeroElevation.Click += new System.EventHandler(this.B_ZeroElevation_Click);
//
// B_SetAll
//
this.B_SetAll.Location = new System.Drawing.Point(937, 262);
this.B_SetAll.Name = "B_SetAll";
this.B_SetAll.Size = new System.Drawing.Size(112, 40);
this.B_SetAll.TabIndex = 13;
this.B_SetAll.Text = "Set All Tiles using Tile from Editor";
this.B_SetAll.UseVisualStyleBackColor = true;
this.B_SetAll.Click += new System.EventHandler(this.B_SetAll_Click);
//
// B_DumpAcre
//
this.B_DumpAcre.Location = new System.Drawing.Point(820, 672);
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(820, 718);
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(937, 718);
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(937, 672);
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);
//
// CM_Click
//
this.CM_Click.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Menu_View,
this.Menu_Set,
this.Menu_Reset});
this.CM_Click.Name = "CM_Click";
this.CM_Click.Size = new System.Drawing.Size(103, 70);
//
// Menu_View
//
this.Menu_View.Name = "Menu_View";
this.Menu_View.Size = new System.Drawing.Size(102, 22);
this.Menu_View.Text = "View";
this.Menu_View.Click += new System.EventHandler(this.Menu_View_Click);
//
// Menu_Set
//
this.Menu_Set.Name = "Menu_Set";
this.Menu_Set.Size = new System.Drawing.Size(102, 22);
this.Menu_Set.Text = "Set";
this.Menu_Set.Click += new System.EventHandler(this.Menu_Set_Click);
//
// Menu_Reset
//
this.Menu_Reset.Name = "Menu_Reset";
this.Menu_Reset.Size = new System.Drawing.Size(102, 22);
this.Menu_Reset.Text = "Reset";
this.Menu_Reset.Click += new System.EventHandler(this.Menu_Reset_Click);
//
// B_Up
//
this.B_Up.Location = new System.Drawing.Point(868, 561);
this.B_Up.Name = "B_Up";
this.B_Up.Size = new System.Drawing.Size(32, 32);
this.B_Up.TabIndex = 18;
this.B_Up.Text = "↑";
this.B_Up.UseVisualStyleBackColor = true;
this.B_Up.Click += new System.EventHandler(this.B_Up_Click);
//
// B_Left
//
this.B_Left.Location = new System.Drawing.Point(838, 591);
this.B_Left.Name = "B_Left";
this.B_Left.Size = new System.Drawing.Size(32, 32);
this.B_Left.TabIndex = 19;
this.B_Left.Text = "←";
this.B_Left.UseVisualStyleBackColor = true;
this.B_Left.Click += new System.EventHandler(this.B_Left_Click);
//
// B_Right
//
this.B_Right.Location = new System.Drawing.Point(898, 591);
this.B_Right.Name = "B_Right";
this.B_Right.Size = new System.Drawing.Size(32, 32);
this.B_Right.TabIndex = 20;
this.B_Right.Text = "→";
this.B_Right.UseVisualStyleBackColor = true;
this.B_Right.Click += new System.EventHandler(this.B_Right_Click);
//
// B_Down
//
this.B_Down.Location = new System.Drawing.Point(868, 621);
this.B_Down.Name = "B_Down";
this.B_Down.Size = new System.Drawing.Size(32, 32);
this.B_Down.TabIndex = 22;
this.B_Down.Text = "↓";
this.B_Down.UseVisualStyleBackColor = true;
this.B_Down.Click += new System.EventHandler(this.B_Down_Click);
//
// PB_Map
//
this.PB_Map.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.PB_Map.ContextMenuStrip = this.CM_Picture;
this.PB_Map.Location = new System.Drawing.Point(821, 343);
this.PB_Map.Name = "PB_Map";
this.PB_Map.Size = new System.Drawing.Size(226, 194);
this.PB_Map.TabIndex = 23;
this.PB_Map.TabStop = false;
this.PB_Map.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PB_Map_MouseDown);
this.PB_Map.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PB_Map_MouseMove);
//
// CM_Picture
//
this.CM_Picture.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.Menu_SavePNG});
this.CM_Picture.Name = "CM_Picture";
this.CM_Picture.ShowImageMargin = false;
this.CM_Picture.Size = new System.Drawing.Size(101, 26);
//
// Menu_SavePNG
//
this.Menu_SavePNG.Name = "Menu_SavePNG";
this.Menu_SavePNG.Size = new System.Drawing.Size(100, 22);
this.Menu_SavePNG.Text = "Save .png";
this.Menu_SavePNG.Click += new System.EventHandler(this.Menu_SavePNG_Click);
//
// CHK_SnapToAcre
//
this.CHK_SnapToAcre.AutoSize = true;
this.CHK_SnapToAcre.Checked = true;
this.CHK_SnapToAcre.CheckState = System.Windows.Forms.CheckState.Checked;
this.CHK_SnapToAcre.Location = new System.Drawing.Point(820, 320);
this.CHK_SnapToAcre.Name = "CHK_SnapToAcre";
this.CHK_SnapToAcre.Size = new System.Drawing.Size(167, 17);
this.CHK_SnapToAcre.TabIndex = 24;
this.CHK_SnapToAcre.Text = "Snap to nearest Acre on Click";
this.CHK_SnapToAcre.UseVisualStyleBackColor = true;
//
// L_Coordinates
//
this.L_Coordinates.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.L_Coordinates.Location = new System.Drawing.Point(876, 540);
this.L_Coordinates.Name = "L_Coordinates";
this.L_Coordinates.Size = new System.Drawing.Size(173, 15);
this.L_Coordinates.TabIndex = 25;
this.L_Coordinates.Text = "(000,000) = (0x00,0x00)";
this.L_Coordinates.TextAlign = System.Drawing.ContentAlignment.TopRight;
//
// TerrainEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1061, 822);
this.Controls.Add(this.L_Coordinates);
this.Controls.Add(this.CHK_SnapToAcre);
this.Controls.Add(this.PB_Map);
this.Controls.Add(this.B_Down);
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.B_SetAll);
this.Controls.Add(this.B_ZeroElevation);
this.Controls.Add(this.L_Acre);
this.Controls.Add(this.CB_Acre);
this.Controls.Add(this.PG_Tile);
this.Controls.Add(this.FLP_Tile);
this.Controls.Add(this.B_Cancel);
this.Controls.Add(this.B_Save);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = global::NHSE.WinForms.Properties.Resources.icon;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "TerrainEditor";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Terrain Editor";
this.CM_Click.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.PB_Map)).EndInit();
this.CM_Picture.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.FlowLayoutPanel FLP_Tile;
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_ZeroElevation;
private System.Windows.Forms.Button B_SetAll;
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;
private System.Windows.Forms.ToolStripMenuItem Menu_Reset;
private System.Windows.Forms.Button B_Up;
private System.Windows.Forms.Button B_Left;
private System.Windows.Forms.Button B_Right;
private System.Windows.Forms.Button B_Down;
private System.Windows.Forms.PictureBox PB_Map;
private System.Windows.Forms.ContextMenuStrip CM_Picture;
private System.Windows.Forms.ToolStripMenuItem Menu_SavePNG;
private System.Windows.Forms.CheckBox CHK_SnapToAcre;
private System.Windows.Forms.Label L_Coordinates;
}
}

View File

@@ -1,341 +0,0 @@
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using NHSE.Core;
using NHSE.Sprites;
namespace NHSE.WinForms
{
public partial class TerrainEditor : Form
{
private readonly MainSave SAV;
private readonly Button[] Grid;
private readonly TerrainManager Terrain;
private int GridWidth => Terrain.GridWidth;
private int GridHeight => Terrain.GridHeight;
private const int SquareSize = 50;
private const int MapScale = 2;
private readonly int[] Scale1;
private readonly int[] ScaleX;
private readonly Bitmap Map;
public TerrainEditor(MainSave sav)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
SAV = sav;
Terrain = new TerrainManager(SAV.GetTerrainTiles(), sav.GetAcreBytes());
Grid = GenerateGrid(GridWidth, GridHeight);
foreach (var acre in MapGrid.Acres)
CB_Acre.Items.Add(acre.Name);
Scale1 = new int[Terrain.MapWidth * Terrain.MapHeight];
ScaleX = new int[Scale1.Length * MapScale * MapScale];
Map = new Bitmap(Terrain.MapWidth * MapScale, Terrain.MapHeight * MapScale);
PG_Tile.SelectedObject = new TerrainTile();
CB_Acre.SelectedIndex = 0;
ReloadMap();
}
private int X;
private int Y;
private int AcreIndex => CB_Acre.SelectedIndex;
private void ChangeAcre(object sender, EventArgs e) => ChangeViewToAcre(AcreIndex);
private void ChangeViewToAcre(int acre)
{
Terrain.GetViewAnchorCoordinates(acre, out X, out Y);
LoadGrid(X, Y);
UpdateArrowVisibility(acre);
}
private void ReloadMap() => PB_Map.Image = TerrainSprite.CreateMap(Terrain, MapScale, X, Y, Scale1, ScaleX, Map);
private void LoadGrid(int topX, int topY)
{
for (int x = 0; x < GridWidth; x++)
{
for (int y = 0; y < GridHeight; y++)
{
var controlIndex = (y * GridWidth) + x;
var b = Grid[controlIndex];
var rx = topX + x;
var ry = topY + y;
var tile = Terrain.GetTile(rx, ry);
RefreshTile(b, tile);
}
}
ReloadMap();
}
private void UpdateArrowVisibility(int index)
{
B_Up.Enabled = index >= MapGrid.AcreWidth;
B_Down.Enabled = index < MapGrid.AcreWidth * (MapGrid.AcreHeight - 1);
B_Left.Enabled = index % MapGrid.AcreWidth != 0;
B_Right.Enabled = index % MapGrid.AcreWidth != MapGrid.AcreWidth - 1;
}
private Button[] GenerateGrid(int w, int h)
{
var grid = new Button[w * h];
int i = 0;
for (int y = 0; y < h; y++)
{
for (int x = 0; x < w; x++)
{
var item = CreateGridItem(index: i, x, y);
FLP_Tile.Controls.Add(item);
grid[i++] = item;
}
var last = grid[i - 1];
FLP_Tile.SetFlowBreak(last, true);
}
return grid;
}
private Button CreateGridItem(int index, int x, int y)
{
var button = new Button
{
Name = index.ToString(),
Text = $"{index:000} ({x},{y})",
Size = new Size(SquareSize, SquareSize),
Padding = Padding.Empty,
Margin = Padding.Empty,
ContextMenuStrip = CM_Click,
FlatStyle = FlatStyle.Flat,
};
button.Click += (sender, args) =>
{
var tile = GetTile(index);
switch (ModifierKeys)
{
default: ViewTile(tile); return;
case Keys.Shift: SetTile(tile, button); return;
case Keys.Alt: DeleteTile(tile, button); return;
}
};
return button;
}
private void ViewTile(TerrainTile tile)
{
var pgt = (TerrainTile)PG_Tile.SelectedObject;
pgt.CopyFrom(tile);
PG_Tile.SelectedObject = pgt;
}
private void SetTile(TerrainTile tile, Control obj)
{
var pgt = (TerrainTile)PG_Tile.SelectedObject;
tile.CopyFrom(pgt);
RefreshTile(obj, tile);
ReloadMap();
}
private void DeleteTile(TerrainTile tile, Control obj)
{
tile.Clear();
RefreshTile(obj, tile);
ReloadMap();
}
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void B_Save_Click(object sender, EventArgs e)
{
SAV.SetTerrainTiles(Terrain.Tiles);
Close();
}
private void Menu_View_Click(object sender, EventArgs e)
{
GetTile(sender, out var tile, out _);
ViewTile(tile);
}
private void Menu_Set_Click(object sender, EventArgs e)
{
GetTile(sender, out var tile, out var obj);
SetTile(tile, obj);
}
private void Menu_Reset_Click(object sender, EventArgs e)
{
GetTile(sender, out var tile, out var obj);
DeleteTile(tile, obj);
}
private void GetTile(object sender, out TerrainTile tile, out Button obj)
{
obj = WinFormsUtil.GetUnderlyingControl<Button>(sender) ?? throw new ArgumentNullException(nameof(sender));
var index = Array.IndexOf(Grid, obj);
if (index < 0)
throw new ArgumentException(nameof(Button));
tile = GetTile(index);
}
private TerrainTile GetTile(int index)
{
var x = X + (index % GridWidth);
var y = Y + (index / GridWidth);
return Terrain.GetTile(x, y);
}
private static void RefreshTile(Control button, TerrainTile tile)
{
button.Text = TerrainTileColor.GetTileName(tile);
button.BackColor = TerrainTileColor.GetTileColor(tile);
}
private void B_Up_Click(object sender, EventArgs e) => CB_Acre.SelectedIndex -= MapGrid.AcreWidth;
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)
{
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetElevation0))
return;
foreach (var t in Terrain.Tiles)
t.Elevation = 0;
LoadGrid(X=0, Y=0);
System.Media.SystemSounds.Asterisk.Play();
}
private void B_SetAll_Click(object sender, EventArgs e)
{
if (DialogResult.Yes != WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAll))
return;
var pgt = (TerrainTile)PG_Tile.SelectedObject;
bool interiorOnly = DialogResult.Yes == WinFormsUtil.Prompt(MessageBoxButtons.YesNo, MessageStrings.MsgTerrainSetAllSkipExterior);
Terrain.SetAll(pgt, interiorOnly);
LoadGrid(X, Y);
System.Media.SystemSounds.Asterisk.Play();
}
private void B_ImportAcre_Click(object sender, EventArgs e)
{
if (!MapDumpHelper.ImportTerrainAcre(Terrain, AcreIndex, CB_Acre.Text))
return;
ChangeViewToAcre(AcreIndex);
System.Media.SystemSounds.Asterisk.Play();
}
private void B_ImportAllAcres_Click(object sender, EventArgs e)
{
if (!MapDumpHelper.ImportTerrainAll(Terrain))
return;
ChangeViewToAcre(AcreIndex);
System.Media.SystemSounds.Asterisk.Play();
}
private void Menu_SavePNG_Click(object sender, EventArgs e)
{
var pb = WinFormsUtil.GetUnderlyingControl<PictureBox>(sender);
if (pb?.Image == null)
{
WinFormsUtil.Alert(MessageStrings.MsgNoPictureLoaded);
return;
}
const string name = "map";
using var sfd = new SaveFileDialog
{
Filter = "png file (*.png)|*.png|All files (*.*)|*.*",
FileName = $"{name}.png",
};
if (sfd.ShowDialog() != DialogResult.OK)
return;
var bmp = new Bitmap(Terrain.MapWidth, Terrain.MapHeight);
ImageUtil.SetBitmapData(bmp, Scale1);
bmp.Save(sfd.FileName, ImageFormat.Png);
}
private void PB_Map_MouseDown(object sender, MouseEventArgs e) => ClickMapAt(e, true);
private void ClickMapAt(MouseEventArgs e, bool skipLagCheck)
{
int mX = e.X;
int mY = e.Y;
bool centerReticle = CHK_SnapToAcre.Checked;
GetViewAnchorCoordinates(mX, mY, out var x, out var y, centerReticle);
var acre = Terrain.GetAcre(x, y);
bool sameAcre = AcreIndex == acre;
if (!skipLagCheck)
{
if (CHK_SnapToAcre.Checked)
{
if (sameAcre)
return;
}
else
{
const int delta = 0; // disabled = 0
var dx = Math.Abs(X - x);
var dy = Math.Abs(Y - y);
if (dx <= delta && dy <= delta && !sameAcre)
return;
}
}
if (!CHK_SnapToAcre.Checked)
{
LoadGrid(X = x, Y = y);
return;
}
if (!sameAcre)
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)
{
GetCursorCoordinates(mX, mY, out x, out y);
Terrain.GetViewAnchorCoordinates(ref x, ref y, centerReticle);
}
private void PB_Map_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
ClickMapAt(e, false);
}
else
{
int mX = e.X;
int mY = e.Y;
GetCursorCoordinates(mX, mY, out var x, out var y);
L_Coordinates.Text = $"({x:000},{y:000}) = (0x{x:X2},0x{y:X2})";
}
}
}
}

View File

@@ -1,126 +0,0 @@
<?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>
<metadata name="CM_Click.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="CM_Picture.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>250, 17</value>
</metadata>
</root>