Add CraftAll

Closes #279
This commit is contained in:
Kurt
2020-05-31 18:12:46 -07:00
parent b893941e7d
commit 491bae480e
12 changed files with 53 additions and 29 deletions

View File

@@ -51,5 +51,17 @@ public void ClearAll()
SetIsFavorite(i, false);
}
}
public void CraftAll()
{
for (int i = 0; i < RecipeCount; i++)
{
bool alreadyHave = GetIsKnown(i);
if (!alreadyHave)
continue;
SetIsMade(i);
SetIsNew(i, false);
}
}
}
}
}

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -370,6 +370,7 @@ ReactionEditor.B_Save=Salva
RecipeListEditor.B_All=Impara Tutto
RecipeListEditor.B_Cancel=Indietro
RecipeListEditor.B_ClearAll=Elimina Tutto
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Salva
RecipeListEditor.CHK_Favorite=Favorito
RecipeListEditor.CHK_Known=Conosciuto

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=Days:
ReactionEditor.B_Cancel=Cancel
ReactionEditor.B_GiveAll=Give All
ReactionEditor.B_Save=Save
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=天数:
ReactionEditor.B_Cancel=取消
ReactionEditor.B_GiveAll=获得全部
ReactionEditor.B_Save=保存
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -367,9 +367,10 @@ PlayerItemEditor.L_WaterDays=天數:
ReactionEditor.B_Cancel=取消
ReactionEditor.B_GiveAll=獲得全部
ReactionEditor.B_Save=儲存
RecipeListEditor.B_All=Give All
RecipeListEditor.B_All=Learn All
RecipeListEditor.B_Cancel=Cancel
RecipeListEditor.B_ClearAll=Clear All
RecipeListEditor.B_CraftAll=Craft All
RecipeListEditor.B_Save=Save
RecipeListEditor.CHK_Favorite=Favorite
RecipeListEditor.CHK_Known=Known

View File

@@ -39,6 +39,7 @@ private void InitializeComponent()
this.CHK_Favorite = new System.Windows.Forms.CheckBox();
this.CHK_New = new System.Windows.Forms.CheckBox();
this.B_ClearAll = new System.Windows.Forms.Button();
this.B_CraftAll = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// B_Cancel
@@ -66,11 +67,11 @@ private void InitializeComponent()
// B_All
//
this.B_All.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_All.Location = new System.Drawing.Point(12, 347);
this.B_All.Location = new System.Drawing.Point(290, 200);
this.B_All.Name = "B_All";
this.B_All.Size = new System.Drawing.Size(82, 23);
this.B_All.TabIndex = 10;
this.B_All.Text = "Give All";
this.B_All.Text = "Learn All";
this.B_All.UseVisualStyleBackColor = true;
this.B_All.Click += new System.EventHandler(this.B_All_Click);
//
@@ -154,7 +155,7 @@ private void InitializeComponent()
// B_ClearAll
//
this.B_ClearAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_ClearAll.Location = new System.Drawing.Point(100, 347);
this.B_ClearAll.Location = new System.Drawing.Point(290, 275);
this.B_ClearAll.Name = "B_ClearAll";
this.B_ClearAll.Size = new System.Drawing.Size(82, 23);
this.B_ClearAll.TabIndex = 18;
@@ -162,11 +163,23 @@ private void InitializeComponent()
this.B_ClearAll.UseVisualStyleBackColor = true;
this.B_ClearAll.Click += new System.EventHandler(this.B_ClearAll_Click);
//
// B_CraftAll
//
this.B_CraftAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.B_CraftAll.Location = new System.Drawing.Point(290, 229);
this.B_CraftAll.Name = "B_CraftAll";
this.B_CraftAll.Size = new System.Drawing.Size(82, 23);
this.B_CraftAll.TabIndex = 19;
this.B_CraftAll.Text = "Craft All";
this.B_CraftAll.UseVisualStyleBackColor = true;
this.B_CraftAll.Click += new System.EventHandler(this.B_CraftAll_Click);
//
// RecipeListEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(404, 381);
this.Controls.Add(this.B_CraftAll);
this.Controls.Add(this.B_ClearAll);
this.Controls.Add(this.CHK_New);
this.Controls.Add(this.CHK_Favorite);
@@ -201,5 +214,6 @@ private void InitializeComponent()
private System.Windows.Forms.CheckBox CHK_Favorite;
private System.Windows.Forms.CheckBox CHK_New;
private System.Windows.Forms.Button B_ClearAll;
private System.Windows.Forms.Button B_CraftAll;
}
}

View File

@@ -76,7 +76,11 @@ private static object GetEntryText(RecipeBook recipeBook, ushort index, string i
return $"0x{index:X3} - {known} {item}";
}
private void B_All_Click(object sender, EventArgs e)
private void B_All_Click(object sender, EventArgs e) => DoAll(() => Book.GiveAll(RecipeList.Recipes));
private void B_ClearAll_Click(object sender, EventArgs e) => DoAll(Book.ClearAll);
private void B_CraftAll_Click(object sender, EventArgs e) => DoAll(Book.CraftAll);
private void DoAll(Action action)
{
var index = LB_Recipes.SelectedIndex;
var book = Book;
@@ -84,22 +88,7 @@ private void B_All_Click(object sender, EventArgs e)
var strings = GameInfo.Strings.itemlist;
const ushort max = RecipeBook.RecipeCount;
book.GiveAll(recipes);
LB_Recipes.Items.Clear();
FillListBox(max, recipes, strings, book);
LoadIndex(index);
LB_Recipes.SelectedIndex = index;
}
private void B_ClearAll_Click(object sender, EventArgs e)
{
var index = LB_Recipes.SelectedIndex;
var book = Book;
var recipes = RecipeList.Recipes;
var strings = GameInfo.Strings.itemlist;
const ushort max = RecipeBook.RecipeCount;
book.ClearAll();
action();
LB_Recipes.Items.Clear();
FillListBox(max, recipes, strings, book);
LoadIndex(index);