Add player detail / fg

fg = field goods? probably not, but a good enough guess for now

kinda overflowing on player editables; get chucked to a sub-editor.

Closes #164
This commit is contained in:
Kurt 2020-05-08 20:52:32 -07:00
parent 86da243405
commit d566eb9972
6 changed files with 359 additions and 24 deletions

View File

@ -56,7 +56,6 @@ private void InitializeComponent()
this.B_EditBulletin = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPRODesigns = new System.Windows.Forms.Button();
this.B_EditPatterns = new System.Windows.Forms.Button();
this.B_EditLandFlags = new System.Windows.Forms.Button();
this.B_EditTurnipExchange = new System.Windows.Forms.Button();
this.B_RecycleBin = new System.Windows.Forms.Button();
this.Tab_Villagers = new System.Windows.Forms.TabPage();
@ -76,6 +75,7 @@ private void InitializeComponent()
this.B_EditAchievements = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPlayerRecipes = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPlayerFlags = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPlayerReactions = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPlayerItems = new System.Windows.Forms.Button();
this.L_Wallet = new System.Windows.Forms.Label();
this.NUD_Wallet = new System.Windows.Forms.NumericUpDown();
@ -90,7 +90,9 @@ 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_EditPlayerReactions = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditFieldGoods = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditLandFlags = new System.Windows.Forms.ToolStripMenuItem();
this.B_EditPlayerMisc = new System.Windows.Forms.ToolStripMenuItem();
this.Menu_Editor.SuspendLayout();
this.CM_Picture.SuspendLayout();
this.Tab_Map.SuspendLayout();
@ -237,7 +239,6 @@ private void InitializeComponent()
this.Tab_Map.Controls.Add(this.B_EditMap);
this.Tab_Map.Controls.Add(this.B_EditPRODesigns);
this.Tab_Map.Controls.Add(this.B_EditPatterns);
this.Tab_Map.Controls.Add(this.B_EditLandFlags);
this.Tab_Map.Controls.Add(this.B_EditTurnipExchange);
this.Tab_Map.Controls.Add(this.B_RecycleBin);
this.Tab_Map.Location = new System.Drawing.Point(4, 22);
@ -268,6 +269,7 @@ private void InitializeComponent()
//
// B_EditPlayerHouses
//
this.B_EditPlayerHouses.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_EditPlayerHouses.Location = new System.Drawing.Point(6, 168);
this.B_EditPlayerHouses.Name = "B_EditPlayerHouses";
this.B_EditPlayerHouses.Size = new System.Drawing.Size(92, 40);
@ -290,13 +292,15 @@ private void InitializeComponent()
// CM_EditMap
//
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_EditFieldItems,
this.B_EditBulletin});
this.B_EditBulletin,
this.B_EditFieldGoods});
this.CM_EditMap.Name = "CM_EditMap";
this.CM_EditMap.Size = new System.Drawing.Size(172, 114);
this.CM_EditMap.Size = new System.Drawing.Size(172, 158);
//
// B_EditTerrain
//
@ -353,16 +357,6 @@ private void InitializeComponent()
this.B_EditPatterns.UseVisualStyleBackColor = true;
this.B_EditPatterns.Click += new System.EventHandler(this.B_EditPatterns_Click);
//
// B_EditLandFlags
//
this.B_EditLandFlags.Location = new System.Drawing.Point(300, 122);
this.B_EditLandFlags.Name = "B_EditLandFlags";
this.B_EditLandFlags.Size = new System.Drawing.Size(92, 40);
this.B_EditLandFlags.TabIndex = 53;
this.B_EditLandFlags.Text = "Edit Flags";
this.B_EditLandFlags.UseVisualStyleBackColor = true;
this.B_EditLandFlags.Click += new System.EventHandler(this.B_EditLandFlags_Click);
//
// B_EditTurnipExchange
//
this.B_EditTurnipExchange.Location = new System.Drawing.Point(6, 6);
@ -546,9 +540,10 @@ private void InitializeComponent()
this.B_EditAchievements,
this.B_EditPlayerRecipes,
this.B_EditPlayerFlags,
this.B_EditPlayerReactions});
this.B_EditPlayerReactions,
this.B_EditPlayerMisc});
this.CM_EditPlayer.Name = "CM_EditPlayer";
this.CM_EditPlayer.Size = new System.Drawing.Size(181, 158);
this.CM_EditPlayer.Size = new System.Drawing.Size(181, 180);
//
// B_EditPlayerStorage
//
@ -585,6 +580,13 @@ private void InitializeComponent()
this.B_EditPlayerFlags.Text = "Edit Flags";
this.B_EditPlayerFlags.Click += new System.EventHandler(this.B_EditPlayerFlags_Click);
//
// B_EditPlayerReactions
//
this.B_EditPlayerReactions.Name = "B_EditPlayerReactions";
this.B_EditPlayerReactions.Size = new System.Drawing.Size(180, 22);
this.B_EditPlayerReactions.Text = "Edit Reactions";
this.B_EditPlayerReactions.Click += new System.EventHandler(this.B_EditPlayerReactions_Click);
//
// B_EditPlayerItems
//
this.B_EditPlayerItems.Location = new System.Drawing.Point(6, 168);
@ -723,12 +725,26 @@ private void InitializeComponent()
this.TC_Editors.Size = new System.Drawing.Size(404, 237);
this.TC_Editors.TabIndex = 1;
//
// B_EditPlayerReactions
// B_EditFieldGoods
//
this.B_EditPlayerReactions.Name = "B_EditPlayerReactions";
this.B_EditPlayerReactions.Size = new System.Drawing.Size(180, 22);
this.B_EditPlayerReactions.Text = "Edit Reactions";
this.B_EditPlayerReactions.Click += new System.EventHandler(this.B_EditPlayerReactions_Click);
this.B_EditFieldGoods.Name = "B_EditFieldGoods";
this.B_EditFieldGoods.Size = new System.Drawing.Size(171, 22);
this.B_EditFieldGoods.Text = "Edit Field Goods";
this.B_EditFieldGoods.Click += new System.EventHandler(this.B_EditFieldGoods_Click);
//
// B_EditLandFlags
//
this.B_EditLandFlags.Name = "B_EditLandFlags";
this.B_EditLandFlags.Size = new System.Drawing.Size(171, 22);
this.B_EditLandFlags.Text = "Edit Flags";
this.B_EditLandFlags.Click += new System.EventHandler(this.B_EditLandFlags_Click);
//
// B_EditPlayerMisc
//
this.B_EditPlayerMisc.Name = "B_EditPlayerMisc";
this.B_EditPlayerMisc.Size = new System.Drawing.Size(180, 22);
this.B_EditPlayerMisc.Text = "Edit Misc";
this.B_EditPlayerMisc.Click += new System.EventHandler(this.B_EditPlayerMisc_Click);
//
// Editor
//
@ -782,7 +798,6 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripComboBox Menu_Language;
private System.Windows.Forms.ToolStripMenuItem Menu_Settings;
private System.Windows.Forms.TabPage Tab_Map;
private System.Windows.Forms.Button B_EditLandFlags;
private System.Windows.Forms.Button B_EditTurnipExchange;
private System.Windows.Forms.Button B_RecycleBin;
private System.Windows.Forms.TabPage Tab_Villagers;
@ -829,6 +844,9 @@ private void InitializeComponent()
private System.Windows.Forms.Label L_Hemisphere;
private System.Windows.Forms.ComboBox CB_Hemisphere;
private System.Windows.Forms.ToolStripMenuItem B_EditPlayerReactions;
private System.Windows.Forms.ToolStripMenuItem B_EditFieldGoods;
private System.Windows.Forms.ToolStripMenuItem B_EditLandFlags;
private System.Windows.Forms.ToolStripMenuItem B_EditPlayerMisc;
}
}

View File

@ -252,6 +252,13 @@ private void B_EditPlayerReactions_Click(object sender, EventArgs e)
editor.ShowDialog();
}
private void B_EditPlayerMisc_Click(object sender, EventArgs e)
{
var player = SAV.Players[PlayerIndex];
using var editor = new MiscPlayerEditor(player);
editor.ShowDialog();
}
private void LoadPlayer(int index)
{
if (PlayerIndex >= 0)
@ -453,5 +460,13 @@ private void B_EditBulletin_Click(object sender, EventArgs e)
if (editor.ShowDialog() == DialogResult.OK)
SAV.Main.Bulletin = boxed;
}
private void B_EditFieldGoods_Click(object sender, EventArgs e)
{
var boxed = SAV.Main.SaveFg;
using var editor = new SingleObjectEditor<object>(boxed, PropertySort.NoSort, false);
if (editor.ShowDialog() == DialogResult.OK)
SAV.Main.SaveFg = boxed;
}
}
}

View File

@ -58,6 +58,9 @@
<Compile Update="Subforms\Map\VillagerHouseEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Subforms\Player\MiscPlayerEditor.cs">
<SubType>Form</SubType>
</Compile>
<Compile Update="Subforms\Player\ReactionEditor.cs">
<SubType>Form</SubType>
</Compile>

View File

@ -0,0 +1,127 @@
namespace NHSE.WinForms
{
partial class MiscPlayerEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.B_Cancel = new System.Windows.Forms.Button();
this.B_Save = new System.Windows.Forms.Button();
this.L_Birthday = new System.Windows.Forms.Label();
this.NUD_BirthMonth = new System.Windows.Forms.NumericUpDown();
this.NUD_BirthDay = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthMonth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthDay)).BeginInit();
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(272, 11);
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(350, 11);
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);
//
// L_Birthday
//
this.L_Birthday.Location = new System.Drawing.Point(12, 9);
this.L_Birthday.Name = "L_Birthday";
this.L_Birthday.Size = new System.Drawing.Size(104, 23);
this.L_Birthday.TabIndex = 8;
this.L_Birthday.Text = "Birthday (M/D):";
this.L_Birthday.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_BirthMonth
//
this.NUD_BirthMonth.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.NUD_BirthMonth.Location = new System.Drawing.Point(122, 12);
this.NUD_BirthMonth.Name = "NUD_BirthMonth";
this.NUD_BirthMonth.Size = new System.Drawing.Size(37, 20);
this.NUD_BirthMonth.TabIndex = 9;
this.NUD_BirthMonth.Value = new decimal(new int[] {
12,
0,
0,
0});
//
// NUD_BirthDay
//
this.NUD_BirthDay.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.NUD_BirthDay.Location = new System.Drawing.Point(165, 12);
this.NUD_BirthDay.Name = "NUD_BirthDay";
this.NUD_BirthDay.Size = new System.Drawing.Size(37, 20);
this.NUD_BirthDay.TabIndex = 10;
this.NUD_BirthDay.Value = new decimal(new int[] {
30,
0,
0,
0});
//
// MiscPlayerEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(434, 46);
this.Controls.Add(this.NUD_BirthDay);
this.Controls.Add(this.NUD_BirthMonth);
this.Controls.Add(this.L_Birthday);
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 = "MiscPlayerEditor";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Misc Player Detail Editor";
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthMonth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_BirthDay)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button B_Cancel;
private System.Windows.Forms.Button B_Save;
private System.Windows.Forms.Label L_Birthday;
private System.Windows.Forms.NumericUpDown NUD_BirthMonth;
private System.Windows.Forms.NumericUpDown NUD_BirthDay;
}
}

View File

@ -0,0 +1,52 @@
using System;
using System.Windows.Forms;
using NHSE.Core;
namespace NHSE.WinForms
{
public partial class MiscPlayerEditor : Form
{
private readonly Player Player;
public MiscPlayerEditor(Player p)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
Player = p;
LoadPlayer();
}
private void LoadPlayer()
{
var p = Player;
var pers = p.Personal;
var bd = pers.Birthday;
NUD_BirthDay.Value = bd.Day;
NUD_BirthMonth.Value = bd.Month;
pers.Birthday = bd;
}
private void B_Cancel_Click(object sender, EventArgs e) => Close();
private void B_Save_Click(object sender, EventArgs e)
{
SavePlayer();
Close();
}
private void SavePlayer()
{
var p = Player;
var pers = p.Personal;
var bd = pers.Birthday;
bd.Day = (byte) NUD_BirthDay.Value;
bd.Month = (byte) NUD_BirthMonth.Value;
pers.Birthday = bd;
}
}
}

View 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>