mirror of
https://github.com/kwsch/NHSE.git
synced 2026-04-24 23:27:14 -05:00
de-generic the item grid editor
no need to have it generic; it only handles Item[] (ignoring VillagerItem[], which should be a separate editor or something)
This commit is contained in:
parent
eccc762998
commit
918c97eeaa
|
|
@ -155,7 +155,7 @@ private void B_EditWear_Click(object sender, EventArgs e)
|
|||
{
|
||||
var v = Villagers[VillagerIndex];
|
||||
var items = v.WearStockList;
|
||||
using var editor = new PlayerItemEditor<VillagerItem>(items, 8, 3);
|
||||
using var editor = new PlayerItemEditor(items, 8, 3);
|
||||
if (editor.ShowDialog() == DialogResult.OK)
|
||||
v.WearStockList = items;
|
||||
}
|
||||
|
|
@ -164,7 +164,7 @@ private void B_EditFurniture_Click(object sender, EventArgs e)
|
|||
{
|
||||
var v = Villagers[VillagerIndex];
|
||||
var items = v.FtrStockList;
|
||||
using var editor = new PlayerItemEditor<VillagerItem>(items, 8, 4);
|
||||
using var editor = new PlayerItemEditor(items, 8, 4);
|
||||
if (editor.ShowDialog() == DialogResult.OK)
|
||||
v.FtrStockList = items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,7 +212,7 @@ private void B_EditPlayerItems_Click(object sender, EventArgs e)
|
|||
var bag = pers.Bag;
|
||||
var pocket = pers.Pocket;
|
||||
var items = pocket.Concat(bag).ToArray();
|
||||
using var editor = new PlayerItemEditor<Item>(items, 10, 4, sysbot: true);
|
||||
using var editor = new PlayerItemEditor(items, 10, 4, sysbot: true);
|
||||
if (editor.ShowDialog() != DialogResult.OK)
|
||||
return;
|
||||
|
||||
|
|
@ -226,7 +226,7 @@ private void B_Storage_Click(object sender, EventArgs e)
|
|||
var player = SAV.Players[PlayerIndex];
|
||||
var pers = player.Personal;
|
||||
var p1 = pers.ItemChest;
|
||||
using var editor = new PlayerItemEditor<Item>(p1, 10, 5);
|
||||
using var editor = new PlayerItemEditor(p1, 10, 5);
|
||||
if (editor.ShowDialog() == DialogResult.OK)
|
||||
pers.ItemChest = p1;
|
||||
}
|
||||
|
|
@ -234,7 +234,7 @@ private void B_Storage_Click(object sender, EventArgs e)
|
|||
private void B_RecycleBin_Click(object sender, EventArgs e)
|
||||
{
|
||||
var items = SAV.Main.RecycleBin;
|
||||
using var editor = new PlayerItemEditor<Item>(items, 10, 4);
|
||||
using var editor = new PlayerItemEditor(items, 10, 4);
|
||||
if (editor.ShowDialog() == DialogResult.OK)
|
||||
SAV.Main.RecycleBin = items;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ private void Main_KeyDown(object sender, KeyEventArgs e)
|
|||
var items = new Item[40];
|
||||
for (int i = 0; i < items.Length; i++)
|
||||
items[i] = new Item(Item.NONE);
|
||||
using var editor = new PlayerItemEditor<Item>(items, 10, 4, true);
|
||||
using var editor = new PlayerItemEditor(items, 10, 4, true);
|
||||
editor.ShowDialog();
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace NHSE.WinForms
|
||||
{
|
||||
partial class PlayerItemEditor<T>
|
||||
partial class PlayerItemEditor
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@
|
|||
|
||||
namespace NHSE.WinForms
|
||||
{
|
||||
public partial class PlayerItemEditor<T> : Form where T : Item
|
||||
public partial class PlayerItemEditor : Form
|
||||
{
|
||||
private readonly Action LoadItems;
|
||||
private readonly ItemGridEditor ItemGrid;
|
||||
private readonly ItemArrayEditor<T> ItemArray;
|
||||
private readonly ItemArrayEditor<Item> ItemArray;
|
||||
|
||||
public PlayerItemEditor(IReadOnlyList<T> array, int width, int height, bool sysbot = false)
|
||||
public PlayerItemEditor(IReadOnlyList<Item> array, int width, int height, bool sysbot = false)
|
||||
{
|
||||
InitializeComponent();
|
||||
this.TranslateInterface(GameInfo.CurrentLanguage);
|
||||
ItemArray = new ItemArrayEditor<T>(array);
|
||||
ItemArray = new ItemArrayEditor<Item>(array);
|
||||
|
||||
var Editor = ItemGrid = new ItemGridEditor(ItemEditor, array) {Dock = DockStyle.Fill};
|
||||
Editor.InitializeGrid(width, height, 64, 64);
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ private static void LoadSpecialForms()
|
|||
var path = Settings.Default.LastFilePath;
|
||||
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, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user