2using System.Collections.Generic;
39 public Dictionary<string, int>
lastMats =
new Dictionary<string, int>();
51 public void Build(List<GridItem> items)
69 for (
int j = 0; j <
slots; j++)
104 if (ingredient.id.IsEmpty())
113 if (num != -1 &&
list !=
null &&
list.Count > num)
121 ingredient.SetThing(thing);
129 if (things.Count == 0)
135 ingredient.SetThing(thing2);
139 ingredient.SetThing();
140 things.Insert(0,
null);
143 else if (!ingredient.optional)
145 if (ingredient.thing ==
null)
152 if (
item.material.id == num2 &&
item.Num >= ingredient.req)
154 ingredient.SetThing(
item);
159 if (ingredient.thing ==
null)
162 foreach (
Thing item2
in things)
164 if (item2.
material.id == defaultMaterial.id && item2.
Num >= ingredient.req)
166 ingredient.SetThing(item2);
174 ingredient.SetThing(thing3);
177 if (ingredient.thing ==
null)
179 ingredient.SetThing(FindMax());
185 foreach (
Thing item3
in things)
187 if (ingredient.thing == item3)
193 if (flag2 && ingredient.thing ==
null)
195 ingredient.SetThing(FindMax());
201 b.onClick.RemoveAllListeners();
202 b.onClick.AddListener(delegate
205 if (list2.Count == 0 || list2[0] ==
null)
217 if (things.Count == 0)
223 foreach (
Thing item4
in things)
225 if (item4.
Num > num3)
239 for (
int j = 0; j <
slots; j++)
265 rectDrop.sizeDelta =
new Vector2(0f, 0f);
266 rectDrop.anchoredPosition = Vector3.zero;
272 ingredient.SetThing(a);
288 b.SetOnClick(delegate
291 b.onRightClick = delegate
297 foreach (
Thing thing
in things)
302 rectDropContent.position = list.transform.position +
fixPos;
343 UnityEngine.Object.DestroyImmediate(
rectDrop.gameObject);
349 if (!componentOf || componentOf.
ing ==
null)
364 if (num >=
list.Count)
366 num = list.Count - 1;
SourceMaterial.Row material
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)
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)