16 return EMono.screen.tileSelector.summary;
23 DropdownRecipe.colorCost = this.colorCost;
24 DropdownRecipe.colorPredict = this.colorPredict;
29 public void SetArea(
Area a)
38 this.goInfo.SetActive(
true);
39 this.goIngredients.SetActive(
false);
47 this.textName.text = a.Name;
48 this.textDetail.SetActive(
true);
49 this.textDetail.SetText(a.source.GetDetail());
54 this.listIngredients.SetActive(
false);
59 this.imageArea.SetActive(
true);
61 if (this.listVariations)
63 this.listVariations.SetActive(
false);
66 this.RebuildLayout(
true);
70 public void SetRecipe(
Recipe r)
74 this.imageArea.SetActive(
false);
79 this.textDetail.SetActive(
false);
85 this.goInfo.SetActive(
true);
86 this.goIngredients.SetActive(r.ingredients.Count > 0 && !r.UseStock);
103 this.goIngredients.SetActive(
false);
104 this.goInfo.SetActive(
false);
105 if (this.listVariations)
107 this.listVariations.SetActive(
false);
110 if (this.textName.text !=
"")
112 this.textName.text = (this.textDetail.text =
"");
114 this.RefreshBalance();
117 this.imageArea.SetActive(
false);
121 this.RebuildLayout(
true);
126 public void RefreshBalance()
132 string text = Lang._Number(
EMono.pc.GetCurrency(
"money"));
133 if (this.summary.money != 0)
135 text =
string.Concat(
new string[]
139 this.colorCost.ToHex(),
141 this.summary.money.ToString(),
145 this.textCost.SetText(text);
148 dropdownRecipe.RefreshLabel();
152 this.ddList.Redraw();
156 int countValid = this.summary.countValid;
157 int num = (countValid == 0) ? -1 : (this.recipe.source.GetSPCost(this.summary.factory) * countValid);
158 text = ((num == -1) ?
"-" : (num.ToString() ??
""));
159 DOTweenAnimation component = this.textCostSP.GetComponent<DOTweenAnimation>();
160 Transform transform = this.textCostSP.Find(
"nerun");
161 bool flag = num >=
EMono.pc.stamina.value;
162 if (component && !flag)
166 this.textCostSP.SetText(text, (num == -1) ? FontColor.Bad : ((num <
EMono.pc.stamina.value) ? FontColor.Good : FontColor.Warning));
167 if (component && flag)
169 component.tween.Restart(
true, -1f);
173 transform.SetActive(flag);
179 public void RefreshImages()
181 Recipe recipe = this.recipe;
182 if (this.listVariations)
184 this.listVariations.Redraw();
188 if (recipe.UseStock && !recipe.VirtualBlock)
190 recipe.ingredients[0].thing.SetImage(this.imageIcon, recipe._dir, recipe.ingredients[0].thing.idSkin);
193 recipe.renderRow.SetImage(this.imageIcon,
null, recipe.renderRow.GetColorInt(recipe.GetColorMaterial()),
true, recipe._dir, recipe.idSkin);
198 public void Refresh()
200 if (this.recipe ==
null)
204 if (this.recipe.UseStock ||
this.recipe.IngAsProduct)
206 Thing thing = this.recipe.ingredients[0].thing;
207 if (thing ==
null || thing.isDestroyed || thing.ExistsOnMap)
215 this.RefreshBalance();
216 if (r.UseStock && r.ingredients[0].thing ==
null)
220 this.textName.text = r.GetName();
222 int[] tiles = this.recipe.renderRow.tiles;
223 if (
EMono.debug.showExtra)
225 text =
string.Concat(
new string[]
231 this.recipe.renderRow.idRenderData,
233 ((tiles.Length != 0) ? tiles[0] : -1).ToString(),
238 this.textDetail.SetActive(
true);
243 EMono.pc.things.GetThingStack(r.GetIdThing(), r.GetRefVal());
244 int num =
EMono.player.recipes.knownRecipes.TryGetValue(r.id, 0);
245 this.textInfo.SetText(
"recipe_lv".lang(num.ToString() ??
"",
null,
null,
null,
null));
246 text += r.GetDetail();
250 text += r.GetDetail();
251 r.WriteNote(this.note);
256 string detail = r.GetDetail();
257 if (!detail.IsEmpty())
259 text = text + detail +
"\n\n";
261 text =
string.Concat(
new string[]
265 r.tileType.LangPlaceType.lang(),
267 (r.tileType.LangPlaceType +
"_hint").lang()
269 if (r.UseStock && r.ingredients[0].thing !=
null)
271 r.ingredients[0].thing.WriteNote(this.note,
null,
IInspect.NoteMode.Recipe,
null);
275 r.WriteNote(this.note);
277 if (!r.UseStock && r.source.NeedFactory)
279 PropSet propSet =
EMono._map.Installed.cardMap.TryGetValue(r.source.idFactory,
null);
280 if (propSet ==
null || propSet.Count == 0)
282 this.note.Space(8, 1);
283 this.note.AddText(
"noFactory".lang(r.source.NameFactory,
null,
null,
null,
null), FontColor.Bad);
288 this.textDetail.SetText(text);
291 this.goMoney.transform.SetAsLastSibling();
295 if (this.listVariations)
297 UIList uilist = this.listVariations;
298 bool flag = r.CanRotate && r.renderRow !=
null;
299 int[] array = flag ? r.renderRow._tiles :
null;
300 if (flag && array.Length <= 1)
304 uilist.SetActive(flag);
308 BaseList baseList = uilist;
316 b.SetRecipeVariation(a);
320 b.SetRecipeVariation(a);
322 baseList.callbacks = callback;
323 for (
int j = 0; j < array.Length; j++)
331 uilist.Refresh(
false);
332 uilist.group.Init(r._dir,
null,
false);
337 this.goMoney.SetActive(!this.CraftMode);
342 this.listIngredients.SetActive(!this.recipe.UseStock ||
this.recipe.VirtualBlock);
345 this.goMoney.SetActive(r.CostMoney != 0);
348 this.RefreshImages();
349 this.SetActive(
true);
350 this.RebuildLayout(
true);
354 public void OnRotate()
356 if (this.listVariations.gameObject.activeSelf)
358 this.listVariations.group.Select(this.recipe._dir);
360 this.RefreshImages();
364 public void RefreshQuality()
366 if (!this.textQuality)
370 this.recipe.SetTextDifficulty(this.textQuality);
374 public void RefreshList()
376 if (this.textReqSkill)
379 FontColor c = FontColor.Good;
380 if (this.recipe !=
null)
382 Element reqSkill = this.recipe.source.GetReqSkill();
383 int value =
EMono.pc.elements.GetOrCreateElement(reqSkill).Value;
384 reqSkill.Name +
" " + reqSkill.Value.ToString();
385 str =
"reqSkill2".lang(reqSkill.Name, reqSkill.Value.ToString() ??
"", value.ToString() ??
"",
null,
null);
386 if (value < reqSkill.Value)
388 c = FontColor.Warning;
391 this.textReqSkill.SetText(str.IsEmpty(
"noReqSkill".lang()), c);
395 List<GridItem> list =
new List<GridItem>();
396 if (this.recipe.source.NeedFactory)
400 source =
EMono.sources.cards.map[this.recipe.source.idFactory]
402 if (this.factory !=
null && this.recipe.source.idFactory ==
this.factory.id)
404 gridItemCardSource.thing = this.factory;
406 list.Add(gridItemCardSource);
408 this.ddFactory.Build(list);
410 this.RefreshQuality();
413 this.ddList.SetActive(this.recipe !=
null && !this.recipe.UseStock);
414 if (this.recipe ==
null || this.recipe.UseStock)
418 this.ddList.recipeInfo =
this;
419 this.ddList.lastMats = this.lastMats;
420 this.ddList.BuildIngredients(this.recipe, this.imageIcon,
new Action(this.RefreshQuality), this.searchMode);
426 UIList uilist = this.listIngredients;
429 if (r ==
null || r.UseStock)
433 BaseList baseList = uilist;
441 dropdownRecipe.recipe = r;
442 this.dds.Add(dropdownRecipe);
443 ThingStack thingStack =
EMono._map.Stocked.ListThingStack(ingredient, this.searchMode);
444 int num = thingStack.count;
445 Color color = (num >= ingredient.req) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad;
446 List<string> list2 =
new List<string>();
447 list2.Add(ingredient.id);
448 dropdownRecipe.SetList<
string>(0, list2, (
string n,
int i) =>
string.Concat(
new string[]
453 ingredient.GetName(),
455 ingredient.req.ToString(),
459 }), delegate(
int i,
string v)
462 dropdownRecipe.textLabel.text = dropdownRecipe.orgLabel.text;
465 this.textCost.text = (r.CostMoney.ToString() ??
"");
468 baseList.callbacks = callback;
473 uilist.Refresh(
false);
479 public UIText textName;
482 public UIText textDetail;
485 public UIText textCost;
488 public UIText textInfo;
491 public UIText textQuality;
494 public UIText textReqSkill;
497 public UIText textCostSP;
500 public Thing factory;
509 public UIList listIngredients;
512 public UIList listVariations;
515 public Image imageArea;
518 public Image imageIcon;
524 public Color colorCost;
527 public Color colorPredict;
530 public GameObject goMoney;
533 public GameObject goIngredients;
536 public GameObject goInfo;
542 public bool CraftMode;
545 public StockSearchMode searchMode;
558 public Dictionary<string, int> lastMats =
new Dictionary<string, int>();
562 public bool hideMode =
true;
566 public List<DropdownRecipe> dds =
new List<DropdownRecipe>();