Categorize stalk market properties

update other usages so we can turn off the help box at the bottom of the propertygrid
This commit is contained in:
Kurt 2020-05-03 19:43:10 -07:00
parent d78b0e0e1f
commit 0ec40f3b55
4 changed files with 28 additions and 22 deletions

View File

@ -1,4 +1,5 @@
using System.Runtime.InteropServices;
using System.ComponentModel;
using System.Runtime.InteropServices;
namespace NHSE.Core
{
@ -7,31 +8,35 @@ public class TurnipStonk // GSaveShopKabu
{
public const int SIZE = 0x44;
public uint BuyPrice { get; set; } // KaburibaKabuka
private const string Buy = nameof(Buy);
private const string Sell = nameof(Sell);
private const string Info = nameof(Info);
public uint SellSundayAM { get; set; }
public uint SellSundayPM { get; set; }
[Category(Buy)] public uint BuyPrice { get; set; } // KaburibaKabuka
public uint SellMondayAM { get; set; }
public uint SellMondayPM { get; set; }
[Category(Sell)] public uint SellSundayAM { get; set; }
[Category(Sell)] public uint SellSundayPM { get; set; }
public uint SellTuesdayAM { get; set; }
public uint SellTuesdayPM { get; set; }
[Category(Sell)] public uint SellMondayAM { get; set; }
[Category(Sell)] public uint SellMondayPM { get; set; }
public uint SellWednesdayAM { get; set; }
public uint SellWednesdayPM { get; set; }
[Category(Sell)] public uint SellTuesdayAM { get; set; }
[Category(Sell)] public uint SellTuesdayPM { get; set; }
public uint SellThursdayAM { get; set; }
public uint SellThursdayPM { get; set; }
[Category(Sell)] public uint SellWednesdayAM { get; set; }
[Category(Sell)] public uint SellWednesdayPM { get; set; }
public uint SellFridayAM { get; set; }
public uint SellFridayPM { get; set; }
[Category(Sell)] public uint SellThursdayAM { get; set; }
[Category(Sell)] public uint SellThursdayPM { get; set; }
public uint SellSaturdayAM { get; set; }
public uint SellSaturdayPM { get; set; }
[Category(Sell)] public uint SellFridayAM { get; set; }
[Category(Sell)] public uint SellFridayPM { get; set; }
public TurnipPattern Pattern { get; set; } // KabukaPattern
public uint FeverStart { get; set; }
[Category(Sell)] public uint SellSaturdayAM { get; set; }
[Category(Sell)] public uint SellSaturdayPM { get; set; }
[Category(Info)] public TurnipPattern Pattern { get; set; } // KabukaPattern
[Category(Info)] public uint FeverStart { get; set; }
}
public enum TurnipPattern : uint

View File

@ -357,7 +357,7 @@ private void B_EditBuildings_Click(object sender, EventArgs e)
private void B_EditTurnipExchange_Click(object sender, EventArgs e)
{
var turnips = SAV.Main.Turnips;
using var editor = new SingleObjectEditor<TurnipStonk>(turnips, PropertySort.NoSort);
using var editor = new SingleObjectEditor<TurnipStonk>(turnips, PropertySort.Categorized, false);
if (editor.ShowDialog() == DialogResult.OK)
SAV.Main.Turnips = turnips;
}
@ -419,7 +419,7 @@ private void B_EditPlayerHouses_Click(object sender, EventArgs e)
private void B_EditBulletin_Click(object sender, EventArgs e)
{
var boxed = SAV.Main.Bulletin;
using var editor = new SingleObjectEditor<object>(boxed, PropertySort.NoSort);
using var editor = new SingleObjectEditor<object>(boxed, PropertySort.NoSort, false);
if (editor.ShowDialog() == DialogResult.OK)
SAV.Main.Bulletin = boxed;
}

View File

@ -6,11 +6,12 @@ namespace NHSE.WinForms
{
public partial class SingleObjectEditor<T> : Form where T : class
{
public SingleObjectEditor(T obj, PropertySort sort)
public SingleObjectEditor(T obj, PropertySort sort, bool showHelp)
{
InitializeComponent();
this.TranslateInterface(GameInfo.CurrentLanguage);
DialogResult = DialogResult.Cancel;
PG_Item.HelpVisible = showHelp;
PG_Item.PropertySort = sort;
PG_Item.SelectedObject = obj;
}

View File

@ -68,7 +68,7 @@ private static void LoadSpecialForms()
var sav = new HorizonSave(path);
using var editor = new Editor(sav);
using var items = new PlayerItemEditor<Item>(new[] {new Item()}, 1, 1);
using var so = new SingleObjectEditor<object>(new object(), PropertySort.NoSort);
using var so = new SingleObjectEditor<object>(new object(), PropertySort.NoSort, false);
}
private static readonly string[] LoadBanlist =