2using System.Collections.Generic;
39 public Dictionary<string, int>
lastMats =
new Dictionary<string, int>();
51 public void Build(List<GridItem> items)
69 for (
int num = 0; num <
slots; num++)
71 if (num < items.Count)
106 if (ingredient.id.IsEmpty())
115 if (num2 != -1 &&
list !=
null &&
list.Count > num2)
117 int uid =
list[num2];
123 ingredient.SetThing(thing);
131 if (things.Count == 0)
137 ingredient.SetThing(thing2);
141 ingredient.SetThing();
142 things.Insert(0,
null);
145 else if (!ingredient.optional)
147 if (ingredient.thing ==
null)
154 if (
item.material.id == num3 &&
item.Num >= ingredient.req)
156 ingredient.SetThing(
item);
164 ingredient.SetThing(thing3);
167 if (ingredient.thing ==
null)
170 foreach (
Thing item2
in things)
172 if (item2.
material.id == defaultMaterial.id && item2.
Num >= ingredient.req)
174 ingredient.SetThing(item2);
182 ingredient.SetThing(thing4);
185 if (ingredient.thing ==
null)
187 ingredient.SetThing(FindMax());
193 foreach (
Thing item3
in things)
195 if (ingredient.thing == item3)
201 if (flag2 && ingredient.thing ==
null)
203 ingredient.SetThing(FindMax());
209 b.onClick.RemoveAllListeners();
210 b.onClick.AddListener(delegate
213 if (list2.Count == 0 || list2[0] ==
null)
225 if (things.Count == 0)
231 foreach (
Thing item4
in things)
233 if (item4.
Num > num4)
247 for (
int num = 0; num <
slots; num++)
273 rectDrop.sizeDelta =
new Vector2(0f, 0f);
274 rectDrop.anchoredPosition = Vector3.zero;
280 ingredient.SetThing(a);
296 b.SetOnClick(delegate
299 b.onRightClick = delegate
305 foreach (
Thing thing
in things)
310 rectDropContent.position = list.transform.position +
fixPos;
351 UnityEngine.Object.DestroyImmediate(
rectDrop.gameObject);
357 if (!componentOf || componentOf.
ing ==
null)
372 if (num >=
list.Count)
374 num = list.Count - 1;
SourceMaterial.Row material
Thing AddThing(string id, int lv=-1)
Thing Add(string id, int num=1, int lv=1)
void BuildIngredients(Recipe _recipe, Image _icon, Action _onValueChange, StockSearchMode _searchMode)
List< Thing > ListIngredients(Recipe.Ingredient ingredient, StockSearchMode searchMode)
void Build(List< GridItem > items)
void OnChangeIngredient()
StockSearchMode searchMode
void Activate(Recipe.Ingredient ingredient, List< Thing > things)
Dictionary< string, int > lastMats
static DropdownGrid Instance
RectTransform rectDropContent
virtual void SetButton(ButtonGrid b)
virtual void OnClick(ButtonGrid b)
void OnChangeIngredient()
static LayerCraft Instance
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Dictionary< string, List< int > > lastIngredients
void SetThing(Thing t=null)
SourceMaterial.Row DefaultMaterial
virtual RenderRow renderRow
void SaveLastIngredients()
List< Ingredient > ingredients
virtual void OnChangeIngredient()
virtual SourceMaterial.Row GetColorMaterial()
int GetColorInt(SourceMaterial.Row mat)
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0, Card card=null)
static Thing CreateFromCategory(string idCat, int lv=-1)
static Thing Create(string id, int idMat=-1, int lv=-1)
bool IsValidIngredient(Recipe.Ingredient ing)
override void Add(object item)
virtual void Refresh(bool highlightLast=false)