Merge pull request #65 from JDrocks450/item-villager-selection
Add Item and Villager Selection Dialogs
This commit is contained in:
commit
d7c0bd6041
17 changed files with 14008 additions and 62 deletions
|
@ -98,6 +98,12 @@
|
|||
<Compile Include="Controls\HouseControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ItemDisplay.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ItemDisplay.Designer.cs">
|
||||
<DependentUpon>ItemDisplay.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controls\ItemEditor.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
@ -137,7 +143,25 @@
|
|||
<Compile Include="Controls\VillagerControl.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\VillagerDisplay.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\VillagerDisplay.Designer.cs">
|
||||
<DependentUpon>VillagerDisplay.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Extensions\ControlExtensions.cs" />
|
||||
<Compile Include="Forms\ItemSelectionDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ItemSelectionDialog.Designer.cs">
|
||||
<DependentUpon>ItemSelectionDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\VillagerSelectionDialog.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\VillagerSelectionDialog.Designer.cs">
|
||||
<DependentUpon>VillagerSelectionDialog.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Imaging\ImageGeneration.cs" />
|
||||
<Compile Include="ItemColorEditor\ItemColorEditor.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -189,9 +213,21 @@
|
|||
<EmbeddedResource Include="AboutBox\AboutBox.resx">
|
||||
<DependentUpon>AboutBox.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\ItemDisplay.resx">
|
||||
<DependentUpon>ItemDisplay.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\MessageEditor.resx">
|
||||
<DependentUpon>MessageEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Controls\VillagerDisplay.resx">
|
||||
<DependentUpon>VillagerDisplay.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ItemSelectionDialog.resx">
|
||||
<DependentUpon>ItemSelectionDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\VillagerSelectionDialog.resx">
|
||||
<DependentUpon>VillagerSelectionDialog.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="ItemColorEditor\ItemColorEditor.resx">
|
||||
<DependentUpon>ItemColorEditor.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
92
ACSE.WinForms/Controls/ItemDisplay.Designer.cs
generated
Normal file
92
ACSE.WinForms/Controls/ItemDisplay.Designer.cs
generated
Normal file
|
@ -0,0 +1,92 @@
|
|||
namespace ACSE.WinForms.Controls
|
||||
{
|
||||
partial class ItemDisplay
|
||||
{
|
||||
/// <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 Component 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.nameLabel = new System.Windows.Forms.Label();
|
||||
this.IDlabel = new System.Windows.Forms.Label();
|
||||
this.categoryLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoEllipsis = true;
|
||||
this.nameLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.nameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
|
||||
this.nameLabel.Location = new System.Drawing.Point(10, 10);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(150, 20);
|
||||
this.nameLabel.TabIndex = 3;
|
||||
this.nameLabel.Text = "Item Name";
|
||||
this.nameLabel.Click += new System.EventHandler(this.nameLabel_Click);
|
||||
//
|
||||
// IDlabel
|
||||
//
|
||||
this.IDlabel.AutoSize = true;
|
||||
this.IDlabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.IDlabel.Location = new System.Drawing.Point(11, 30);
|
||||
this.IDlabel.Name = "IDlabel";
|
||||
this.IDlabel.Size = new System.Drawing.Size(18, 13);
|
||||
this.IDlabel.TabIndex = 4;
|
||||
this.IDlabel.Text = "ID";
|
||||
//
|
||||
// categoryLabel
|
||||
//
|
||||
this.categoryLabel.AutoSize = true;
|
||||
this.categoryLabel.BackColor = System.Drawing.Color.Transparent;
|
||||
this.categoryLabel.Location = new System.Drawing.Point(11, 45);
|
||||
this.categoryLabel.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.categoryLabel.Name = "categoryLabel";
|
||||
this.categoryLabel.Padding = new System.Windows.Forms.Padding(0, 0, 10, 0);
|
||||
this.categoryLabel.Size = new System.Drawing.Size(59, 13);
|
||||
this.categoryLabel.TabIndex = 5;
|
||||
this.categoryLabel.Text = "Category";
|
||||
//
|
||||
// ItemDisplay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Control;
|
||||
this.Controls.Add(this.categoryLabel);
|
||||
this.Controls.Add(this.IDlabel);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.Name = "ItemDisplay";
|
||||
this.Size = new System.Drawing.Size(173, 69);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Label IDlabel;
|
||||
private System.Windows.Forms.Label categoryLabel;
|
||||
}
|
||||
}
|
40
ACSE.WinForms/Controls/ItemDisplay.cs
Normal file
40
ACSE.WinForms/Controls/ItemDisplay.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ACSE.Core.Items;
|
||||
using ACSE.Core.Saves;
|
||||
|
||||
namespace ACSE.WinForms.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// A simple control that displays a user-selectable item
|
||||
/// </summary>
|
||||
public partial class ItemDisplay : UserControl
|
||||
{
|
||||
public Item Item
|
||||
{
|
||||
get;
|
||||
}
|
||||
public ItemDisplay(Core.Items.Item item)
|
||||
{
|
||||
InitializeComponent();
|
||||
//preview.Image = Inventory.GetItemPic(70, item, Save.SaveInstance.SaveType);
|
||||
BackColor = Color.FromArgb((int)ItemData.GetItemColor(item.Type));
|
||||
nameLabel.Text = item.Name;
|
||||
IDlabel.Text = "ID: " + item.ItemId.ToString("X4");
|
||||
categoryLabel.Text = Enum.GetName(typeof(ItemType), item.Type);
|
||||
Item = item;
|
||||
}
|
||||
|
||||
private void nameLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
base.OnClick(e);
|
||||
}
|
||||
}
|
||||
}
|
120
ACSE.WinForms/Controls/ItemDisplay.resx
Normal file
120
ACSE.WinForms/Controls/ItemDisplay.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>
|
|
@ -8,6 +8,7 @@
|
|||
using ACSE.Core.Saves;
|
||||
using ACSE.Core.Utilities;
|
||||
using ACSE.Core.Villagers;
|
||||
using ACSE.WinForms.Forms;
|
||||
using ItemChangedEventArgs = ACSE.Core.Items.ItemChangedEventArgs;
|
||||
|
||||
namespace ACSE.WinForms.Controls
|
||||
|
@ -19,7 +20,7 @@ namespace ACSE.WinForms.Controls
|
|||
public sealed class VillagerControl : FlowLayoutPanel
|
||||
{
|
||||
private readonly Label _indexLabel;
|
||||
private readonly ComboBox _villagerSelectionBox;
|
||||
private readonly Button _villagerSelectionButton; //opens villager gallery
|
||||
private readonly ComboBox _personalityBox;
|
||||
private readonly OffsetablePictureBox _villagerPreviewBox;
|
||||
private readonly TextBox _catchphraseBox;
|
||||
|
@ -90,24 +91,31 @@ public VillagerControl(MainForm mainFormReference, int index, Save saveFile, Vil
|
|||
var margin = CalculateControlVerticalMargin(_indexLabel);
|
||||
_indexLabel.Margin = new Padding(0, margin, 0, margin);
|
||||
|
||||
_villagerSelectionBox = new ComboBox
|
||||
_villagerSelectionButton = new Button
|
||||
{
|
||||
Size = new Size(120, 32),
|
||||
DropDownStyle = ComboBoxStyle.DropDownList
|
||||
Size = new Size(120, 32)
|
||||
};
|
||||
|
||||
margin = CalculateControlVerticalMargin(_villagerSelectionBox);
|
||||
_villagerSelectionBox.Margin = new Padding(0, margin, 10, margin);
|
||||
_villagerSelectionBox.Items.AddRange(_villagerNames);
|
||||
//_villagerSelectionBox = new ComboBox
|
||||
//{
|
||||
// Size = new Size(120, 32),
|
||||
// DropDownStyle = ComboBoxStyle.DropDownList
|
||||
//};
|
||||
|
||||
margin = CalculateControlVerticalMargin(_villagerSelectionButton);
|
||||
_villagerSelectionButton.Margin = new Padding(0, margin, 10, margin);
|
||||
//_villagerSelectionBox.Items.AddRange(_villagerNames);
|
||||
|
||||
for (var i = 0; i < _villagers.Count; i++)
|
||||
{
|
||||
if (villagers.ElementAt(i).Key != _villager.Data.VillagerId) continue;
|
||||
_villagerSelectionBox.SelectedIndex = i;
|
||||
//_villagerSelectionBox.SelectedIndex = i;
|
||||
_villagerSelectionButton.Text = villagerNames[i];
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
_villagerSelectionBox.SelectedIndexChanged += (s, e) => VillagerSelectionBoxChanged();
|
||||
_villagerSelectionButton.Click += (s, e) => VillagerSelectionBoxChanged();
|
||||
|
||||
_personalityBox = new ComboBox
|
||||
{
|
||||
|
@ -150,7 +158,7 @@ public VillagerControl(MainForm mainFormReference, int index, Save saveFile, Vil
|
|||
// Add controls to flow panel
|
||||
|
||||
Controls.Add(_indexLabel);
|
||||
Controls.Add(_villagerSelectionBox);
|
||||
Controls.Add(_villagerSelectionButton);
|
||||
Controls.Add(_personalityBox);
|
||||
Controls.Add(_catchphraseBox);
|
||||
Controls.Add(_shirtEditor);
|
||||
|
@ -253,12 +261,21 @@ public VillagerControl(MainForm mainFormReference, int index, Save saveFile, Vil
|
|||
|
||||
private void VillagerSelectionBoxChanged(bool fireChangedEvent = true)
|
||||
{
|
||||
if (_villagerSelectionBox.SelectedIndex < 0) return;
|
||||
//opens villager gallery
|
||||
VillagerSelectionDialog dialog = new VillagerSelectionDialog(_villagers.Values);
|
||||
if (_villager.Data.VillagerId != 0 && _villagers.TryGetValue(_villager.Data.VillagerId, out var current))
|
||||
dialog.SelectedVillager = current; //set selected villager if applicable
|
||||
|
||||
var kvPair = _villagers.ElementAt(_villagerSelectionBox.SelectedIndex);
|
||||
if (dialog.ShowDialog() == DialogResult.Cancel)
|
||||
return;
|
||||
|
||||
int selectedIndex = dialog.SelectedIndex;
|
||||
if (selectedIndex < 0) return;
|
||||
|
||||
var kvPair = _villagers.ElementAt(selectedIndex);
|
||||
if (_saveFile.SaveType != SaveType.DoubutsuNoMoriEPlus && _saveFile.SaveType != SaveType.AnimalForestEPlus)
|
||||
{
|
||||
_villager.Name = _villagerNames[_villagerSelectionBox.SelectedIndex];
|
||||
_villager.Name = _villagerNames[selectedIndex];
|
||||
}
|
||||
|
||||
_villager.Data.VillagerId = kvPair.Value.VillagerId;
|
||||
|
@ -327,6 +344,7 @@ private void VillagerSelectionBoxChanged(bool fireChangedEvent = true)
|
|||
: new Point(64 * ((_villager.Data.VillagerId & 0xFF) % 10),
|
||||
64 * ((_villager.Data.VillagerId & 0xFF) / 10));
|
||||
}
|
||||
_villagerSelectionButton.Text = _villager.Name;
|
||||
|
||||
if (fireChangedEvent)
|
||||
VillagerChanged?.Invoke(this, _villager);
|
||||
|
|
89
ACSE.WinForms/Controls/VillagerDisplay.Designer.cs
generated
Normal file
89
ACSE.WinForms/Controls/VillagerDisplay.Designer.cs
generated
Normal file
|
@ -0,0 +1,89 @@
|
|||
namespace ACSE.WinForms.Controls
|
||||
{
|
||||
partial class VillagerDisplay
|
||||
{
|
||||
/// <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 Component 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.nameLabel = new System.Windows.Forms.Label();
|
||||
this.wikiButton = new System.Windows.Forms.Button();
|
||||
this.villagerPreview = new ACSE.WinForms.Controls.OffsetablePictureBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameLabel
|
||||
//
|
||||
this.nameLabel.AutoSize = true;
|
||||
this.nameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F);
|
||||
this.nameLabel.Location = new System.Drawing.Point(80, 21);
|
||||
this.nameLabel.Name = "nameLabel";
|
||||
this.nameLabel.Size = new System.Drawing.Size(107, 20);
|
||||
this.nameLabel.TabIndex = 1;
|
||||
this.nameLabel.Text = "Villager Name";
|
||||
this.nameLabel.Click += new System.EventHandler(this.nameLabel_Click);
|
||||
//
|
||||
// wikiButton
|
||||
//
|
||||
this.wikiButton.Location = new System.Drawing.Point(84, 44);
|
||||
this.wikiButton.Name = "wikiButton";
|
||||
this.wikiButton.Size = new System.Drawing.Size(143, 23);
|
||||
this.wikiButton.TabIndex = 2;
|
||||
this.wikiButton.Text = "More Information";
|
||||
this.wikiButton.UseVisualStyleBackColor = true;
|
||||
this.wikiButton.Click += new System.EventHandler(this.wikiButton_Click);
|
||||
//
|
||||
// villagerPreview
|
||||
//
|
||||
this.villagerPreview.Image = null;
|
||||
this.villagerPreview.Location = new System.Drawing.Point(10, 10);
|
||||
this.villagerPreview.Name = "villagerPreview";
|
||||
this.villagerPreview.Offset = new System.Drawing.Point(0, 0);
|
||||
this.villagerPreview.Size = new System.Drawing.Size(64, 64);
|
||||
this.villagerPreview.TabIndex = 0;
|
||||
this.villagerPreview.Click += new System.EventHandler(this.villagerPreview_Click_1);
|
||||
//
|
||||
// VillagerDisplay
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.White;
|
||||
this.Controls.Add(this.wikiButton);
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.villagerPreview);
|
||||
this.Cursor = System.Windows.Forms.Cursors.Hand;
|
||||
this.Name = "VillagerDisplay";
|
||||
this.Size = new System.Drawing.Size(244, 83);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private OffsetablePictureBox villagerPreview;
|
||||
private System.Windows.Forms.Label nameLabel;
|
||||
private System.Windows.Forms.Button wikiButton;
|
||||
}
|
||||
}
|
64
ACSE.WinForms/Controls/VillagerDisplay.cs
Normal file
64
ACSE.WinForms/Controls/VillagerDisplay.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ACSE.Core.Villagers;
|
||||
|
||||
namespace ACSE.WinForms.Controls
|
||||
{
|
||||
public partial class VillagerDisplay : UserControl
|
||||
{
|
||||
private static Image villagerImage;
|
||||
public VillagerDisplay()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public VillagerDisplay(SimpleVillager villager)
|
||||
{
|
||||
InitializeComponent();
|
||||
if (villagerImage == null)
|
||||
villagerImage = Image.FromFile("Resources/Images/Villagers.jpg");
|
||||
RestoreFromVillager(villager);
|
||||
}
|
||||
|
||||
public SimpleVillager Villager { get; internal set; }
|
||||
|
||||
public static VillagerDisplay CreateFromVillagerObject(SimpleVillager villager)
|
||||
{
|
||||
return new VillagerDisplay(villager);
|
||||
}
|
||||
|
||||
public void RestoreFromVillager(SimpleVillager villager)
|
||||
{
|
||||
villagerPreview.Image = villagerImage;
|
||||
villagerPreview.Offset =
|
||||
(villager.VillagerId < 0xE000 || villager.VillagerId > 0xE0EB)
|
||||
? new Point(64 * 6, 64 * 23)
|
||||
: new Point(64 * ((villager.VillagerId & 0xFF) % 10),
|
||||
64 * ((villager.VillagerId & 0xFF) / 10));
|
||||
nameLabel.Text = villager.Name;
|
||||
Villager = villager;
|
||||
}
|
||||
|
||||
private void wikiButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
System.Diagnostics.Process.Start("https://animalcrossing.fandom.com/wiki/" + Villager.Name);
|
||||
}
|
||||
|
||||
private void nameLabel_Click(object sender, EventArgs e)
|
||||
{
|
||||
OnClick(e);
|
||||
}
|
||||
|
||||
private void villagerPreview_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
OnClick(e);
|
||||
}
|
||||
}
|
||||
}
|
120
ACSE.WinForms/Controls/VillagerDisplay.resx
Normal file
120
ACSE.WinForms/Controls/VillagerDisplay.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>
|
200
ACSE.WinForms/Forms/ItemSelectionDialog.Designer.cs
generated
Normal file
200
ACSE.WinForms/Forms/ItemSelectionDialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,200 @@
|
|||
namespace ACSE.WinForms.Forms
|
||||
{
|
||||
partial class ItemSelectionDialog
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ItemSelectionDialog));
|
||||
this.selectionLabel = new System.Windows.Forms.Label();
|
||||
this._label1 = new System.Windows.Forms.Label();
|
||||
this.CancelButton = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.searchBox = new System.Windows.Forms.TextBox();
|
||||
this.categorySwitcher = new System.Windows.Forms.TabControl();
|
||||
this.pageFlow = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.searchButton = new System.Windows.Forms.Button();
|
||||
this.loadingPanel = new System.Windows.Forms.Panel();
|
||||
this.loadingProgress = new System.Windows.Forms.ProgressBar();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.loadingPanel.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// selectionLabel
|
||||
//
|
||||
this.selectionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectionLabel.AutoSize = true;
|
||||
this.selectionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.selectionLabel.Location = new System.Drawing.Point(70, 418);
|
||||
this.selectionLabel.Name = "selectionLabel";
|
||||
this.selectionLabel.Size = new System.Drawing.Size(50, 15);
|
||||
this.selectionLabel.TabIndex = 13;
|
||||
this.selectionLabel.Text = "Nothing";
|
||||
//
|
||||
// _label1
|
||||
//
|
||||
this._label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._label1.AutoSize = true;
|
||||
this._label1.Location = new System.Drawing.Point(12, 420);
|
||||
this._label1.Name = "_label1";
|
||||
this._label1.Size = new System.Drawing.Size(52, 13);
|
||||
this._label1.TabIndex = 12;
|
||||
this._label1.Text = "Selected:";
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelButton.Location = new System.Drawing.Point(697, 415);
|
||||
this.CancelButton.Name = "CancelButton";
|
||||
this.CancelButton.Size = new System.Drawing.Size(91, 23);
|
||||
this.CancelButton.TabIndex = 11;
|
||||
this.CancelButton.Text = "Cancel";
|
||||
this.CancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(512, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(61, 13);
|
||||
this.label1.TabIndex = 8;
|
||||
this.label1.Text = "Item Name:";
|
||||
//
|
||||
// searchBox
|
||||
//
|
||||
this.searchBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.searchBox.Location = new System.Drawing.Point(573, 12);
|
||||
this.searchBox.Name = "searchBox";
|
||||
this.searchBox.Size = new System.Drawing.Size(146, 20);
|
||||
this.searchBox.TabIndex = 7;
|
||||
this.searchBox.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.searchBox_KeyPress);
|
||||
//
|
||||
// categorySwitcher
|
||||
//
|
||||
this.categorySwitcher.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.categorySwitcher.Location = new System.Drawing.Point(12, 38);
|
||||
this.categorySwitcher.Name = "categorySwitcher";
|
||||
this.categorySwitcher.SelectedIndex = 0;
|
||||
this.categorySwitcher.Size = new System.Drawing.Size(776, 371);
|
||||
this.categorySwitcher.TabIndex = 14;
|
||||
this.categorySwitcher.Selected += new System.Windows.Forms.TabControlEventHandler(this.categorySwitcher_Selected);
|
||||
this.categorySwitcher.TabIndexChanged += new System.EventHandler(this.categorySwitcher_TabIndexChanged);
|
||||
//
|
||||
// pageFlow
|
||||
//
|
||||
this.pageFlow.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pageFlow.AutoScroll = true;
|
||||
this.pageFlow.Location = new System.Drawing.Point(13, 5);
|
||||
this.pageFlow.Name = "pageFlow";
|
||||
this.pageFlow.Size = new System.Drawing.Size(493, 32);
|
||||
this.pageFlow.TabIndex = 15;
|
||||
this.pageFlow.WrapContents = false;
|
||||
//
|
||||
// searchButton
|
||||
//
|
||||
this.searchButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.searchButton.Location = new System.Drawing.Point(725, 10);
|
||||
this.searchButton.Name = "searchButton";
|
||||
this.searchButton.Size = new System.Drawing.Size(63, 23);
|
||||
this.searchButton.TabIndex = 16;
|
||||
this.searchButton.Text = "Search";
|
||||
this.searchButton.UseVisualStyleBackColor = true;
|
||||
this.searchButton.Click += new System.EventHandler(this.searchButton_Click);
|
||||
//
|
||||
// loadingPanel
|
||||
//
|
||||
this.loadingPanel.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.loadingPanel.Controls.Add(this.loadingProgress);
|
||||
this.loadingPanel.Controls.Add(this.label2);
|
||||
this.loadingPanel.Location = new System.Drawing.Point(14, 41);
|
||||
this.loadingPanel.Name = "loadingPanel";
|
||||
this.loadingPanel.Size = new System.Drawing.Size(774, 368);
|
||||
this.loadingPanel.TabIndex = 17;
|
||||
this.loadingPanel.Visible = false;
|
||||
//
|
||||
// loadingProgress
|
||||
//
|
||||
this.loadingProgress.Location = new System.Drawing.Point(338, 185);
|
||||
this.loadingProgress.Name = "loadingProgress";
|
||||
this.loadingProgress.Size = new System.Drawing.Size(111, 23);
|
||||
this.loadingProgress.TabIndex = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.label2.Location = new System.Drawing.Point(354, 161);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(88, 20);
|
||||
this.label2.TabIndex = 0;
|
||||
this.label2.Text = "Loading...";
|
||||
//
|
||||
// ItemSelectionDialog
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.loadingPanel);
|
||||
this.Controls.Add(this.searchButton);
|
||||
this.Controls.Add(this.pageFlow);
|
||||
this.Controls.Add(this.categorySwitcher);
|
||||
this.Controls.Add(this.selectionLabel);
|
||||
this.Controls.Add(this._label1);
|
||||
this.Controls.Add(this.CancelButton);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.searchBox);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "ItemSelectionDialog";
|
||||
this.Text = "Item Selection";
|
||||
this.loadingPanel.ResumeLayout(false);
|
||||
this.loadingPanel.PerformLayout();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Label selectionLabel;
|
||||
private System.Windows.Forms.Label _label1;
|
||||
private System.Windows.Forms.Button CancelButton;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.TextBox searchBox;
|
||||
private System.Windows.Forms.TabControl categorySwitcher;
|
||||
private System.Windows.Forms.FlowLayoutPanel pageFlow;
|
||||
private System.Windows.Forms.Button searchButton;
|
||||
private System.Windows.Forms.Panel loadingPanel;
|
||||
private System.Windows.Forms.ProgressBar loadingProgress;
|
||||
private System.Windows.Forms.Label label2;
|
||||
}
|
||||
}
|
284
ACSE.WinForms/Forms/ItemSelectionDialog.cs
Normal file
284
ACSE.WinForms/Forms/ItemSelectionDialog.cs
Normal file
|
@ -0,0 +1,284 @@
|
|||
using ACSE.Core.Items;
|
||||
using ACSE.WinForms.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ACSE.WinForms.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// A gallery of all the selectable items in the game
|
||||
/// </summary>
|
||||
public partial class ItemSelectionDialog : Form
|
||||
{
|
||||
public enum ItemCategory
|
||||
{
|
||||
Buildings,
|
||||
Furniture,
|
||||
Gyroids,
|
||||
WallpaperFloor,
|
||||
Nature,
|
||||
Clothes,
|
||||
Catchable,
|
||||
Items,
|
||||
Misc,
|
||||
System,
|
||||
}
|
||||
|
||||
public Item SelectedItem
|
||||
{
|
||||
get; set;
|
||||
} = new Item(0);
|
||||
|
||||
List<KeyValuePair<ItemCategory, Item>> CategoryItems = new List<KeyValuePair<ItemCategory, Item>>();
|
||||
List<KeyValuePair<string, Item>> ItemCache = new List<KeyValuePair<string, Item>>();
|
||||
string[] categoryNames =
|
||||
{
|
||||
null, null, null, "Wallpapers/Flooring", null, "Clothing", null, null, null, null
|
||||
};
|
||||
|
||||
public ItemSelectionDialog(List<KeyValuePair<ushort, string>> database)
|
||||
{
|
||||
InitializeComponent();
|
||||
foreach (var item in database)
|
||||
{
|
||||
var _item = new Item(item.Key);
|
||||
CategoryItems.Add(new KeyValuePair<ItemCategory, Item>(GetCategory(_item.Type), _item));
|
||||
ItemCache.Add(new KeyValuePair<string, Item>(_item.Name, _item));
|
||||
}
|
||||
Populate();
|
||||
Display();
|
||||
}
|
||||
|
||||
private void Display(int page = 0)
|
||||
{
|
||||
var tab = categorySwitcher.SelectedTab;
|
||||
tab.Controls.DisposeChildren();
|
||||
var category = (ItemCategory)tab.Tag;
|
||||
var flowLayout = new FlowLayoutPanel()
|
||||
{
|
||||
BackColor = Color.White,
|
||||
WrapContents = true,
|
||||
AutoScroll = true,
|
||||
Dock = DockStyle.Fill,
|
||||
};
|
||||
EventHandler d = null;
|
||||
d = delegate
|
||||
{
|
||||
DisplaySource(flowLayout, CategoryItems.Where(x => x.Key == category).Select(x => x.Value), page);
|
||||
flowLayout.HandleCreated -= d;
|
||||
};
|
||||
flowLayout.HandleCreated += d;
|
||||
tab.Controls.Add(flowLayout);
|
||||
}
|
||||
|
||||
private void DisplaySource(Panel Destination, IEnumerable<Item> source, int page = 0)
|
||||
{
|
||||
Panel flowLayout = Destination;
|
||||
int sourceCount = 0;
|
||||
pageFlow.Enabled = false;
|
||||
loadingPanel.Visible = true;
|
||||
loadingProgress.Value = 0;
|
||||
loadingProgress.Maximum = 200;
|
||||
Destination.Controls.DisposeChildren();
|
||||
Task.Run(() =>
|
||||
{
|
||||
sourceCount = source.Count();
|
||||
foreach (var item in source.Skip(page * 200).Take(200))
|
||||
{
|
||||
ItemDisplay display = null;
|
||||
Action a = delegate
|
||||
{
|
||||
display = new ItemDisplay(item);
|
||||
display.Click += ItemSelected;
|
||||
flowLayout.Controls.Add(display);
|
||||
loadingProgress.Value++;
|
||||
};
|
||||
if (!flowLayout.IsDisposed)
|
||||
{
|
||||
if (flowLayout.InvokeRequired)
|
||||
flowLayout.Invoke(a);
|
||||
else
|
||||
a.Invoke();
|
||||
}
|
||||
}
|
||||
}).ContinueWith(delegate
|
||||
{
|
||||
pageFlow.Invoke((Action)delegate
|
||||
{
|
||||
int pages = (sourceCount / 200) + 1;
|
||||
pageFlow.Controls.DisposeChildren();
|
||||
Label label = new Label()
|
||||
{
|
||||
Text = sourceCount + " Items. Page: (" + (page + 1) + "/" + pages + ")",
|
||||
Margin = new Padding(20, 5, 10, 0),
|
||||
AutoSize = true
|
||||
};
|
||||
pageFlow.Controls.Add(label);
|
||||
if (pages > 1)
|
||||
{
|
||||
for (int i = 0; i < pages; i++)
|
||||
{
|
||||
Button button = new Button()
|
||||
{
|
||||
Text = (i + 1).ToString(),
|
||||
Tag = i
|
||||
};
|
||||
button.Enabled = i != page;
|
||||
button.Click += (object sender, EventArgs e) =>
|
||||
{
|
||||
pageFlow.Enabled = false;
|
||||
DisplaySource(Destination, source, (int)(sender as Button).Tag);
|
||||
};
|
||||
pageFlow.Controls.Add(button);
|
||||
}
|
||||
}
|
||||
pageFlow.Enabled = true;
|
||||
loadingPanel.Visible = false;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void ItemSelected(object sender, EventArgs e)
|
||||
{
|
||||
SelectedItem = (sender as ItemDisplay).Item;
|
||||
selectionLabel.Text = SelectedItem.Name;
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void Populate()
|
||||
{
|
||||
var enumNames = Enum.GetNames(typeof(ItemCategory));
|
||||
for (int i = 0; i < categoryNames.Length; i++)
|
||||
{
|
||||
string name = categoryNames[i];
|
||||
if (categoryNames[i] == null)
|
||||
name = enumNames[i];
|
||||
categorySwitcher.TabPages.Add(new TabPage(name)
|
||||
{
|
||||
Tag = (ItemCategory)i
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private ItemCategory GetCategory(ItemType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ItemType.Building:
|
||||
case ItemType.Signboard:
|
||||
return ItemCategory.Buildings;
|
||||
case ItemType.Catchable:
|
||||
return ItemCategory.Catchable;
|
||||
case ItemType.Clothes:
|
||||
return ItemCategory.Clothes;
|
||||
case ItemType.Empty:
|
||||
return ItemCategory.System;
|
||||
case ItemType.Fossil:
|
||||
case ItemType.Fruit:
|
||||
case ItemType.ParchedFlower:
|
||||
case ItemType.Rock:
|
||||
case ItemType.Tree:
|
||||
case ItemType.WiltedFlower:
|
||||
case ItemType.Weed:
|
||||
case ItemType.WateredFlower:
|
||||
case ItemType.MoneyRock:
|
||||
case ItemType.Flower:
|
||||
case ItemType.Shell:
|
||||
return ItemCategory.Nature;
|
||||
case ItemType.Money:
|
||||
case ItemType.Tool:
|
||||
case ItemType.Item:
|
||||
case ItemType.QuestItem:
|
||||
case ItemType.RaffleTicket:
|
||||
case ItemType.Turnip:
|
||||
case ItemType.Paper:
|
||||
case ItemType.Diary:
|
||||
return ItemCategory.Items;
|
||||
case ItemType.HouseObject:
|
||||
case ItemType.Furniture:
|
||||
case ItemType.Trash:
|
||||
return ItemCategory.Furniture;
|
||||
case ItemType.Gyroid:
|
||||
return ItemCategory.Gyroids;
|
||||
case ItemType.WallpaperCarpet:
|
||||
return ItemCategory.WallpaperFloor;
|
||||
case ItemType.Song:
|
||||
case ItemType.Pattern:
|
||||
default:
|
||||
return ItemCategory.Misc;
|
||||
}
|
||||
}
|
||||
|
||||
private void categorySwitcher_TabIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Display();
|
||||
}
|
||||
|
||||
private void categorySwitcher_Selected(object sender, TabControlEventArgs e)
|
||||
{
|
||||
Display();
|
||||
}
|
||||
|
||||
private void Search()
|
||||
{
|
||||
IEnumerable<Item> query = null;
|
||||
string searchTerm = searchBox.Text;
|
||||
if (string.IsNullOrWhiteSpace(searchTerm))
|
||||
{
|
||||
Display();
|
||||
return;
|
||||
}
|
||||
Task.Run(delegate
|
||||
{
|
||||
query = ItemCache.Where(x => x.Key.Contains(searchTerm)).Select(x => x.Value);
|
||||
}).ContinueWith(delegate
|
||||
{
|
||||
Invoke((Action)delegate
|
||||
{
|
||||
var flowLayout = new FlowLayoutPanel()
|
||||
{
|
||||
BackColor = Color.White,
|
||||
WrapContents = true,
|
||||
AutoScroll = true,
|
||||
Dock = DockStyle.Fill,
|
||||
};
|
||||
EventHandler handler = null;
|
||||
handler = delegate
|
||||
{
|
||||
DisplaySource(flowLayout, query, 0);
|
||||
categorySwitcher.SelectedTab.Controls.DisposeChildren();
|
||||
categorySwitcher.SelectedTab.Controls.Add(flowLayout);
|
||||
flowLayout.HandleCreated -= handler;
|
||||
};
|
||||
flowLayout.HandleCreated += handler;
|
||||
_ = flowLayout.Handle; // force the handle to be created
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
private void searchButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
Search();
|
||||
}
|
||||
|
||||
private void OKButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void searchBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
if (e.KeyChar == (char)Keys.Enter)
|
||||
Search();
|
||||
}
|
||||
}
|
||||
}
|
6293
ACSE.WinForms/Forms/ItemSelectionDialog.resx
Normal file
6293
ACSE.WinForms/Forms/ItemSelectionDialog.resx
Normal file
File diff suppressed because it is too large
Load diff
145
ACSE.WinForms/Forms/VillagerSelectionDialog.Designer.cs
generated
Normal file
145
ACSE.WinForms/Forms/VillagerSelectionDialog.Designer.cs
generated
Normal file
|
@ -0,0 +1,145 @@
|
|||
namespace ACSE.WinForms.Forms
|
||||
{
|
||||
partial class VillagerSelectionDialog
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VillagerSelectionDialog));
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.villagerSelectionPanel = new System.Windows.Forms.FlowLayoutPanel();
|
||||
this.OKButton = new System.Windows.Forms.Button();
|
||||
this.CancelButton = new System.Windows.Forms.Button();
|
||||
this._label1 = new System.Windows.Forms.Label();
|
||||
this.selectionLabel = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox1.Location = new System.Drawing.Point(573, 12);
|
||||
this.textBox1.Name = "textBox1";
|
||||
this.textBox1.Size = new System.Drawing.Size(215, 20);
|
||||
this.textBox1.TabIndex = 0;
|
||||
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(527, 15);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(44, 13);
|
||||
this.label1.TabIndex = 1;
|
||||
this.label1.Text = "Search:";
|
||||
//
|
||||
// villagerSelectionPanel
|
||||
//
|
||||
this.villagerSelectionPanel.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.villagerSelectionPanel.AutoScroll = true;
|
||||
this.villagerSelectionPanel.BackColor = System.Drawing.SystemColors.ControlLight;
|
||||
this.villagerSelectionPanel.Location = new System.Drawing.Point(12, 39);
|
||||
this.villagerSelectionPanel.Name = "villagerSelectionPanel";
|
||||
this.villagerSelectionPanel.Size = new System.Drawing.Size(776, 363);
|
||||
this.villagerSelectionPanel.TabIndex = 2;
|
||||
//
|
||||
// OKButton
|
||||
//
|
||||
this.OKButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.OKButton.Location = new System.Drawing.Point(697, 415);
|
||||
this.OKButton.Name = "OKButton";
|
||||
this.OKButton.Size = new System.Drawing.Size(91, 23);
|
||||
this.OKButton.TabIndex = 3;
|
||||
this.OKButton.Text = "OK";
|
||||
this.OKButton.UseVisualStyleBackColor = true;
|
||||
this.OKButton.Click += new System.EventHandler(this.OKButton_Click);
|
||||
//
|
||||
// CancelButton
|
||||
//
|
||||
this.CancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.CancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.CancelButton.Location = new System.Drawing.Point(600, 415);
|
||||
this.CancelButton.Name = "CancelButton";
|
||||
this.CancelButton.Size = new System.Drawing.Size(91, 23);
|
||||
this.CancelButton.TabIndex = 4;
|
||||
this.CancelButton.Text = "Cancel";
|
||||
this.CancelButton.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// _label1
|
||||
//
|
||||
this._label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this._label1.AutoSize = true;
|
||||
this._label1.Location = new System.Drawing.Point(487, 420);
|
||||
this._label1.Name = "_label1";
|
||||
this._label1.Size = new System.Drawing.Size(52, 13);
|
||||
this._label1.TabIndex = 5;
|
||||
this._label1.Text = "Selected:";
|
||||
//
|
||||
// selectionLabel
|
||||
//
|
||||
this.selectionLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.selectionLabel.AutoSize = true;
|
||||
this.selectionLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.selectionLabel.Location = new System.Drawing.Point(545, 418);
|
||||
this.selectionLabel.Name = "selectionLabel";
|
||||
this.selectionLabel.Size = new System.Drawing.Size(49, 15);
|
||||
this.selectionLabel.TabIndex = 6;
|
||||
this.selectionLabel.Text = "Nobody";
|
||||
//
|
||||
// VillagerSelectionDialog
|
||||
//
|
||||
this.AcceptButton = this.OKButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.selectionLabel);
|
||||
this.Controls.Add(this._label1);
|
||||
this.Controls.Add(this.CancelButton);
|
||||
this.Controls.Add(this.OKButton);
|
||||
this.Controls.Add(this.villagerSelectionPanel);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.Name = "VillagerSelectionDialog";
|
||||
this.Text = "Villager Gallery";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.FlowLayoutPanel villagerSelectionPanel;
|
||||
private System.Windows.Forms.Button OKButton;
|
||||
private System.Windows.Forms.Button CancelButton;
|
||||
private System.Windows.Forms.Label _label1;
|
||||
private System.Windows.Forms.Label selectionLabel;
|
||||
}
|
||||
}
|
132
ACSE.WinForms/Forms/VillagerSelectionDialog.cs
Normal file
132
ACSE.WinForms/Forms/VillagerSelectionDialog.cs
Normal file
|
@ -0,0 +1,132 @@
|
|||
using ACSE.Core.Villagers;
|
||||
using ACSE.WinForms.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ACSE.WinForms.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// A gallery of all the selectable Villagers in the game
|
||||
/// </summary>
|
||||
public partial class VillagerSelectionDialog : Form
|
||||
{
|
||||
/// <summary>
|
||||
/// The currently selected Villager
|
||||
/// </summary>
|
||||
public SimpleVillager SelectedVillager
|
||||
{
|
||||
get => _villager;
|
||||
set
|
||||
{
|
||||
_villager = value;
|
||||
selectionLabel.Text = SelectedVillager.Name;
|
||||
SelectedIndex = VillagerIndices.First(x => x.Value == value).Key;
|
||||
selectedControl = DisplayCache[value.Name];
|
||||
}
|
||||
}
|
||||
public ushort SelectedIndex //the id of the selected Villager
|
||||
{
|
||||
get; private set;
|
||||
}
|
||||
/// <summary>
|
||||
/// The currently selected VillagerControl
|
||||
/// </summary>
|
||||
private VillagerDisplay selectedControl
|
||||
{
|
||||
get => _control;
|
||||
set
|
||||
{
|
||||
if (_control != null)
|
||||
_control.BackColor = Color.White;
|
||||
value.BackColor = Color.LightBlue;
|
||||
_control = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, VillagerDisplay> DisplayCache = new Dictionary<string, VillagerDisplay>();
|
||||
private Dictionary<ushort, SimpleVillager> VillagerIndices = new Dictionary<ushort, SimpleVillager>();
|
||||
private VillagerDisplay _control;
|
||||
private SimpleVillager _villager;
|
||||
|
||||
public VillagerSelectionDialog(IEnumerable<SimpleVillager> DisplayVillagers)
|
||||
{
|
||||
InitializeComponent();
|
||||
ushort index = 0;
|
||||
foreach (var villager in DisplayVillagers)
|
||||
{
|
||||
if (villager.VillagerId == 0) { index++; continue; }
|
||||
VillagerIndices.Add(index, villager);
|
||||
index++;
|
||||
}
|
||||
Display();
|
||||
}
|
||||
|
||||
private void Display()
|
||||
{
|
||||
villagerSelectionPanel.Controls.DisposeChildren();
|
||||
DisplayCache.Clear();
|
||||
foreach(var villager in VillagerIndices)
|
||||
{
|
||||
var display = new VillagerDisplay(villager.Value)
|
||||
{
|
||||
Tag = villager.Key
|
||||
};
|
||||
display.Click += VillagerSelected;
|
||||
DisplayCache.Add(villager.Value.Name, display);
|
||||
villagerSelectionPanel.Controls.Add(display);
|
||||
}
|
||||
}
|
||||
|
||||
private void VillagerSelected(object sender, EventArgs e)
|
||||
{
|
||||
VillagerDisplay selected = sender as VillagerDisplay;
|
||||
SelectedVillager = selected.Villager;
|
||||
}
|
||||
|
||||
private void OKButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void textBox1_TextChanged(object sender, EventArgs e) //search feature
|
||||
{
|
||||
villagerSelectionPanel.Controls.Clear();
|
||||
string searchterm = ((TextBox)sender).Text;
|
||||
IEnumerable<VillagerDisplay> result = DisplayCache.Values;
|
||||
if (!string.IsNullOrWhiteSpace(searchterm))
|
||||
{
|
||||
Task.Run(() => // async search so the program won't lock up on slower pcs
|
||||
{
|
||||
result = DisplayCache.Where(x => x.Key.Contains(searchterm)).Select(x => x.Value);
|
||||
Action a = delegate
|
||||
{
|
||||
if (result.Any())
|
||||
foreach (var display in result)
|
||||
villagerSelectionPanel.Controls.Add(display);
|
||||
else villagerSelectionPanel.Controls.Add(new Label()
|
||||
{
|
||||
Text = $"Couldn't find anything for: {searchterm}",
|
||||
AutoSize = true,
|
||||
Font = new Font(new FontFamily("Microsoft Sans Serif"), 12.0f, FontStyle.Regular),
|
||||
Margin = new Padding(20)
|
||||
});
|
||||
};
|
||||
Invoke(a); // thread-safe call
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var display in result)
|
||||
villagerSelectionPanel.Controls.Add(display);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
6293
ACSE.WinForms/Forms/VillagerSelectionDialog.resx
Normal file
6293
ACSE.WinForms/Forms/VillagerSelectionDialog.resx
Normal file
File diff suppressed because it is too large
Load diff
99
ACSE.WinForms/MainForm/MainForm.Designer.cs
generated
99
ACSE.WinForms/MainForm/MainForm.Designer.cs
generated
|
@ -34,7 +34,6 @@ private void InitializeComponent()
|
|||
System.Windows.Forms.TabPage patternsTab;
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.patternNameTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.paletteColorSelectedPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.paletteIndexLabel = new System.Windows.Forms.Label();
|
||||
this.palettePreviousButton = new System.Windows.Forms.Button();
|
||||
this.paletteNextButton = new System.Windows.Forms.Button();
|
||||
|
@ -46,6 +45,7 @@ private void InitializeComponent()
|
|||
this.player2Tab = new System.Windows.Forms.TabPage();
|
||||
this.player3Tab = new System.Windows.Forms.TabPage();
|
||||
this.player4Tab = new System.Windows.Forms.TabPage();
|
||||
this.paletteColorSelectedPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.paletteSelectionPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
|
@ -92,6 +92,7 @@ private void InitializeComponent()
|
|||
this.unlockHHDItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tabControl1 = new System.Windows.Forms.TabControl();
|
||||
this.playersTab = new System.Windows.Forms.TabPage();
|
||||
this.PartTimeJobCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.badgeGroupBox = new System.Windows.Forms.GroupBox();
|
||||
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
||||
this.clearEmotionsButton = new System.Windows.Forms.Button();
|
||||
|
@ -183,7 +184,6 @@ private void InitializeComponent()
|
|||
this.townMisc = new System.Windows.Forms.TabPage();
|
||||
this.townGateComboBox = new System.Windows.Forms.ComboBox();
|
||||
this.label25 = new System.Windows.Forms.Label();
|
||||
this.townGatePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.groupBox2 = new System.Windows.Forms.GroupBox();
|
||||
this.keepTownBeautifulCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.bellBoomCheckBox = new System.Windows.Forms.CheckBox();
|
||||
|
@ -199,6 +199,7 @@ private void InitializeComponent()
|
|||
this.grassTypeBox = new System.Windows.Forms.ComboBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.townNameBox = new System.Windows.Forms.TextBox();
|
||||
this.townGatePictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.stationPictureBox = new System.Windows.Forms.PictureBox();
|
||||
this.villagerTab = new System.Windows.Forms.TabPage();
|
||||
this.caravan2ComboBox = new System.Windows.Forms.ComboBox();
|
||||
|
@ -276,13 +277,13 @@ private void InitializeComponent()
|
|||
this.itemIdTextBox = new System.Windows.Forms.PlaceholderTextBox();
|
||||
this.itemIdLabel = new System.Windows.Forms.Label();
|
||||
this.StatusLabel = new System.Windows.Forms.TextBox();
|
||||
this.PartTimeJobCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.itemSelection = new System.Windows.Forms.Button();
|
||||
patternsTab = new System.Windows.Forms.TabPage();
|
||||
patternsTab.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).BeginInit();
|
||||
this.patternEditorPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).BeginInit();
|
||||
this.patternGroupTabControl.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteSelectionPictureBox)).BeginInit();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.tabControl1.SuspendLayout();
|
||||
|
@ -304,8 +305,8 @@ private void InitializeComponent()
|
|||
this.acresTab.SuspendLayout();
|
||||
this.townTab.SuspendLayout();
|
||||
this.townMisc.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.townGatePictureBox)).BeginInit();
|
||||
this.groupBox2.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.townGatePictureBox)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.stationPictureBox)).BeginInit();
|
||||
this.villagerTab.SuspendLayout();
|
||||
this.villagerPanel.SuspendLayout();
|
||||
|
@ -323,13 +324,13 @@ private void InitializeComponent()
|
|||
// patternsTab
|
||||
//
|
||||
patternsTab.Controls.Add(this.patternNameTextBox);
|
||||
patternsTab.Controls.Add(this.paletteColorSelectedPictureBox);
|
||||
patternsTab.Controls.Add(this.paletteIndexLabel);
|
||||
patternsTab.Controls.Add(this.palettePreviousButton);
|
||||
patternsTab.Controls.Add(this.paletteNextButton);
|
||||
patternsTab.Controls.Add(this.patternEditorPanel);
|
||||
patternsTab.Controls.Add(this.patternEditorPreviewPanel);
|
||||
patternsTab.Controls.Add(this.patternGroupTabControl);
|
||||
patternsTab.Controls.Add(this.paletteColorSelectedPictureBox);
|
||||
patternsTab.Controls.Add(this.paletteSelectionPictureBox);
|
||||
patternsTab.Location = new System.Drawing.Point(4, 22);
|
||||
patternsTab.Name = "patternsTab";
|
||||
|
@ -350,17 +351,6 @@ private void InitializeComponent()
|
|||
this.patternNameTextBox.TabIndex = 0;
|
||||
this.patternNameTextBox.TextChanged += new System.EventHandler(this.PatternEditorNameBox_TextChanged);
|
||||
//
|
||||
// paletteColorSelectedPictureBox
|
||||
//
|
||||
this.paletteColorSelectedPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.paletteColorSelectedPictureBox.Image = global::ACSE.WinForms.Properties.Resources.PaletteArrow;
|
||||
this.paletteColorSelectedPictureBox.Location = new System.Drawing.Point(114, 21);
|
||||
this.paletteColorSelectedPictureBox.Name = "paletteColorSelectedPictureBox";
|
||||
this.paletteColorSelectedPictureBox.Size = new System.Drawing.Size(16, 32);
|
||||
this.paletteColorSelectedPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
|
||||
this.paletteColorSelectedPictureBox.TabIndex = 21;
|
||||
this.paletteColorSelectedPictureBox.TabStop = false;
|
||||
//
|
||||
// paletteIndexLabel
|
||||
//
|
||||
this.paletteIndexLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
|
@ -485,6 +475,17 @@ private void InitializeComponent()
|
|||
this.player4Tab.Text = "Player4";
|
||||
this.player4Tab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// paletteColorSelectedPictureBox
|
||||
//
|
||||
this.paletteColorSelectedPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
this.paletteColorSelectedPictureBox.Image = global::ACSE.WinForms.Properties.Resources.PaletteArrow;
|
||||
this.paletteColorSelectedPictureBox.Location = new System.Drawing.Point(114, 21);
|
||||
this.paletteColorSelectedPictureBox.Name = "paletteColorSelectedPictureBox";
|
||||
this.paletteColorSelectedPictureBox.Size = new System.Drawing.Size(16, 32);
|
||||
this.paletteColorSelectedPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
|
||||
this.paletteColorSelectedPictureBox.TabIndex = 21;
|
||||
this.paletteColorSelectedPictureBox.TabStop = false;
|
||||
//
|
||||
// paletteSelectionPictureBox
|
||||
//
|
||||
this.paletteSelectionPictureBox.Anchor = System.Windows.Forms.AnchorStyles.None;
|
||||
|
@ -725,7 +726,7 @@ private void InitializeComponent()
|
|||
this.exportTownToolStripMenuItem,
|
||||
this.generateRandomTownToolStripMenuItem});
|
||||
this.tasksToolStripMenuItem.Name = "tasksToolStripMenuItem";
|
||||
this.tasksToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
|
||||
this.tasksToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
|
||||
this.tasksToolStripMenuItem.Text = "Tasks";
|
||||
//
|
||||
// clearWeedsToolStripMenuItem
|
||||
|
@ -816,7 +817,7 @@ private void InitializeComponent()
|
|||
this.unlockAllPublicWorkProjectsToolStripMenuItem,
|
||||
this.unlockHHDItemsToolStripMenuItem});
|
||||
this.extrasToolStripMenuItem.Name = "extrasToolStripMenuItem";
|
||||
this.extrasToolStripMenuItem.Size = new System.Drawing.Size(49, 20);
|
||||
this.extrasToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
|
||||
this.extrasToolStripMenuItem.Text = "Extras";
|
||||
//
|
||||
// fillMuseumToolStripMenuItem
|
||||
|
@ -947,6 +948,20 @@ private void InitializeComponent()
|
|||
this.playersTab.Text = "Players";
|
||||
this.playersTab.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// PartTimeJobCheckBox
|
||||
//
|
||||
this.PartTimeJobCheckBox.AutoSize = true;
|
||||
this.PartTimeJobCheckBox.Enabled = false;
|
||||
this.PartTimeJobCheckBox.Location = new System.Drawing.Point(772, 38);
|
||||
this.PartTimeJobCheckBox.Name = "PartTimeJobCheckBox";
|
||||
this.PartTimeJobCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.PartTimeJobCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.PartTimeJobCheckBox.TabIndex = 80;
|
||||
this.PartTimeJobCheckBox.Text = ":Doing Part Time Job";
|
||||
this.infoTip.SetToolTip(this.PartTimeJobCheckBox, "Toggles whether or not the Player is doing Nook\'s part time job.");
|
||||
this.PartTimeJobCheckBox.UseVisualStyleBackColor = true;
|
||||
this.PartTimeJobCheckBox.CheckedChanged += new System.EventHandler(this.PartTimeJobCheckBoxCheckChanged);
|
||||
//
|
||||
// badgeGroupBox
|
||||
//
|
||||
this.badgeGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -1884,7 +1899,6 @@ private void InitializeComponent()
|
|||
//
|
||||
this.townMisc.Controls.Add(this.townGateComboBox);
|
||||
this.townMisc.Controls.Add(this.label25);
|
||||
this.townMisc.Controls.Add(this.townGatePictureBox);
|
||||
this.townMisc.Controls.Add(this.groupBox2);
|
||||
this.townMisc.Controls.Add(this.stationTypeComboBox);
|
||||
this.townMisc.Controls.Add(this.label47);
|
||||
|
@ -1896,6 +1910,7 @@ private void InitializeComponent()
|
|||
this.townMisc.Controls.Add(this.grassTypeBox);
|
||||
this.townMisc.Controls.Add(this.label1);
|
||||
this.townMisc.Controls.Add(this.townNameBox);
|
||||
this.townMisc.Controls.Add(this.townGatePictureBox);
|
||||
this.townMisc.Controls.Add(this.stationPictureBox);
|
||||
this.townMisc.Location = new System.Drawing.Point(4, 22);
|
||||
this.townMisc.Name = "townMisc";
|
||||
|
@ -1926,14 +1941,6 @@ private void InitializeComponent()
|
|||
this.label25.TabIndex = 33;
|
||||
this.label25.Text = "Gate Type:";
|
||||
//
|
||||
// townGatePictureBox
|
||||
//
|
||||
this.townGatePictureBox.Location = new System.Drawing.Point(390, 43);
|
||||
this.townGatePictureBox.Name = "townGatePictureBox";
|
||||
this.townGatePictureBox.Size = new System.Drawing.Size(32, 32);
|
||||
this.townGatePictureBox.TabIndex = 32;
|
||||
this.townGatePictureBox.TabStop = false;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
this.groupBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -2109,6 +2116,14 @@ private void InitializeComponent()
|
|||
this.townNameBox.Size = new System.Drawing.Size(92, 20);
|
||||
this.townNameBox.TabIndex = 20;
|
||||
//
|
||||
// townGatePictureBox
|
||||
//
|
||||
this.townGatePictureBox.Location = new System.Drawing.Point(390, 43);
|
||||
this.townGatePictureBox.Name = "townGatePictureBox";
|
||||
this.townGatePictureBox.Size = new System.Drawing.Size(32, 32);
|
||||
this.townGatePictureBox.TabIndex = 32;
|
||||
this.townGatePictureBox.TabStop = false;
|
||||
//
|
||||
// stationPictureBox
|
||||
//
|
||||
this.stationPictureBox.Location = new System.Drawing.Point(390, 5);
|
||||
|
@ -2854,25 +2869,24 @@ private void InitializeComponent()
|
|||
this.StatusLabel.TabIndex = 16;
|
||||
this.StatusLabel.TabStop = false;
|
||||
//
|
||||
// PartTimeJobCheckBox
|
||||
// itemSelection
|
||||
//
|
||||
this.PartTimeJobCheckBox.AutoSize = true;
|
||||
this.PartTimeJobCheckBox.Enabled = false;
|
||||
this.PartTimeJobCheckBox.Location = new System.Drawing.Point(772, 38);
|
||||
this.PartTimeJobCheckBox.Name = "PartTimeJobCheckBox";
|
||||
this.PartTimeJobCheckBox.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
|
||||
this.PartTimeJobCheckBox.Size = new System.Drawing.Size(125, 17);
|
||||
this.PartTimeJobCheckBox.TabIndex = 80;
|
||||
this.PartTimeJobCheckBox.Text = ":Doing Part Time Job";
|
||||
this.infoTip.SetToolTip(this.PartTimeJobCheckBox, "Toggles whether or not the Player is doing Nook\'s part time job.");
|
||||
this.PartTimeJobCheckBox.UseVisualStyleBackColor = true;
|
||||
this.PartTimeJobCheckBox.CheckedChanged += new System.EventHandler(this.PartTimeJobCheckBoxCheckChanged);
|
||||
this.itemSelection.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.itemSelection.Enabled = false;
|
||||
this.itemSelection.Location = new System.Drawing.Point(237, 643);
|
||||
this.itemSelection.Name = "itemSelection";
|
||||
this.itemSelection.Size = new System.Drawing.Size(113, 23);
|
||||
this.itemSelection.TabIndex = 81;
|
||||
this.itemSelection.Text = "Item Selection";
|
||||
this.itemSelection.UseVisualStyleBackColor = true;
|
||||
this.itemSelection.Click += new System.EventHandler(this.itemSelection_Click_1);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(963, 695);
|
||||
this.Controls.Add(this.itemSelection);
|
||||
this.Controls.Add(this.itemIdTextBox);
|
||||
this.Controls.Add(this.itemIdLabel);
|
||||
this.Controls.Add(this.label43);
|
||||
|
@ -2897,10 +2911,10 @@ private void InitializeComponent()
|
|||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormFormClosing);
|
||||
patternsTab.ResumeLayout(false);
|
||||
patternsTab.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).EndInit();
|
||||
this.patternEditorPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.patternEditorPictureBox)).EndInit();
|
||||
this.patternGroupTabControl.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteColorSelectedPictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.paletteSelectionPictureBox)).EndInit();
|
||||
this.menuStrip1.ResumeLayout(false);
|
||||
this.menuStrip1.PerformLayout();
|
||||
|
@ -2927,9 +2941,9 @@ private void InitializeComponent()
|
|||
this.townTab.PerformLayout();
|
||||
this.townMisc.ResumeLayout(false);
|
||||
this.townMisc.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.townGatePictureBox)).EndInit();
|
||||
this.groupBox2.ResumeLayout(false);
|
||||
this.groupBox2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.townGatePictureBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.stationPictureBox)).EndInit();
|
||||
this.villagerTab.ResumeLayout(false);
|
||||
this.villagerTab.PerformLayout();
|
||||
|
@ -3198,5 +3212,6 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripMenuItem openDolphinSaveFileToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.CheckBox PartTimeJobCheckBox;
|
||||
private System.Windows.Forms.Button itemSelection;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
using ACSE.WinForms.Utilities;
|
||||
using ContentAlignment = System.Drawing.ContentAlignment;
|
||||
using ItemChangedEventArgs = ACSE.Core.Items.ItemChangedEventArgs;
|
||||
using ACSE.WinForms.Forms;
|
||||
|
||||
namespace ACSE.WinForms
|
||||
{
|
||||
|
@ -122,6 +123,7 @@ public sealed partial class MainForm : Form
|
|||
private List<AcreItemEditor> _acreItemEditors = new List<AcreItemEditor>();
|
||||
private List<AcreItemEditor> _islandItemEditors = new List<AcreItemEditor>();
|
||||
private bool _loading;
|
||||
private ItemSelectionDialog _itemSelectionDialog;
|
||||
|
||||
#region MapSizeVariables
|
||||
|
||||
|
@ -305,7 +307,7 @@ public MainForm()
|
|||
"ACSE Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
System.Diagnostics.Process.Start(updater.UpdateUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region Settings Changing Functions
|
||||
|
@ -604,6 +606,7 @@ private void EnableEditorControls(Save save)
|
|||
clearEmotionsButton.Enabled = fillEmotionsButton.Enabled;
|
||||
townGateComboBox.Enabled = SaveFile.SaveGeneration == SaveGeneration.NDS ||
|
||||
SaveFile.SaveGeneration == SaveGeneration.Wii;
|
||||
itemSelection.Enabled = true;
|
||||
}
|
||||
|
||||
private void LoadAcres(Save save)
|
||||
|
@ -5096,6 +5099,14 @@ private void SetOrdinanceCheckBoxes()
|
|||
keepTownBeautifulCheckBox.Checked = (ordinanceFlags & 0x10) == 0x10;
|
||||
}
|
||||
|
||||
private void itemSelection_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (_itemSelectionDialog == null) // Setup ItemSelector on-demand
|
||||
_itemSelectionDialog = new ItemSelectionDialog(ItemData.ItemDatabase);
|
||||
if (_itemSelectionDialog.ShowDialog() == DialogResult.OK)
|
||||
SetCurrentItem(_itemSelectionDialog.SelectedItem);
|
||||
}
|
||||
|
||||
private void UpdateNewLeafOrdinances()
|
||||
{
|
||||
if (SaveFile == null || _loading || SaveFile.SaveGeneration != SaveGeneration.N3DS) return;
|
||||
|
|
|
@ -156,18 +156,12 @@
|
|||
<metadata name="exportPatternFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>946, 17</value>
|
||||
</metadata>
|
||||
<metadata name="townToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1090, 17</value>
|
||||
</metadata>
|
||||
<metadata name="acreToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1210, 17</value>
|
||||
</metadata>
|
||||
<metadata name="villagerToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>1325, 17</value>
|
||||
</metadata>
|
||||
<metadata name="houseToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 41</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
|
|
Loading…
Reference in a new issue