1.More rewrites.

2,Give detailed message when mod's assemblies can't load.
This commit is contained in:
yangzhi 2020-02-14 17:49:37 +08:00 committed by ZaneYork
parent e5fb317220
commit e753f87626
3 changed files with 70 additions and 0 deletions

View File

@ -0,0 +1,12 @@
using StardewValley.Menus;
namespace StardewModdingAPI.Framework.RewriteFacades
{
public class DialogueBoxMethods : DialogueBox
{
public DialogueBoxMethods(string dialogue)
: base(dialogue)
{
}
}
}

View File

@ -18,5 +18,51 @@ namespace StardewModdingAPI.Framework.RewriteFacades
{
return base.rightClick(x, y, toAddTo, playSound);
}
public List<ClickableComponent> GetBorder(BorderSide side)
{
List<ClickableComponent> clickableComponentList = new List<ClickableComponent>();
int num = this.capacity / this.rows;
switch (side)
{
case BorderSide.Top:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index < num)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Left:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index % num == 0)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Right:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index % num == num - 1)
clickableComponentList.Add(this.inventory[index]);
}
break;
case BorderSide.Bottom:
for (int index = 0; index < this.inventory.Count; ++index)
{
if (index >= this.actualInventory.Count - num)
clickableComponentList.Add(this.inventory[index]);
}
break;
}
return clickableComponentList;
}
public enum BorderSide
{
Top,
Left,
Right,
Bottom,
}
}
}

View File

@ -63,6 +63,18 @@ namespace StardewModdingAPI.Framework.RewriteFacades
typeof(ShopMenu).GetField("categoriesToSellHere", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public Dictionary<ISalable, int[]> ItemPriceAndStockProp
{
get
{
return (Dictionary<ISalable, int[]>)typeof(ShopMenu).GetField("itemPriceAndStock", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).GetValue(this);
}
set
{
typeof(ShopMenu).GetField("itemPriceAndStock", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public).SetValue(this, value);
}
}
public ShopMenuMethods(Dictionary<ISalable, int[]> itemPriceAndStock, int currency = 0, string who = null, Func<ISalable, Farmer, int, bool> on_purchase = null, Func<ISalable, bool> on_sell = null, string context = null) : base(itemPriceAndStock, currency, who, on_purchase, on_sell, context)
{
}