Elin Modding Docs Doc
Loading...
Searching...
No Matches
ButtonGrid.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4using UnityEngine.UI;
5
6// Token: 0x02000503 RID: 1283
7public class ButtonGrid : UIButton, IMouseHint, IPrefImage
8{
9 // Token: 0x17000B0A RID: 2826
10 // (get) Token: 0x0600224C RID: 8780 RVA: 0x000BECE6 File Offset: 0x000BCEE6
11 public ColorProfile Colors
12 {
13 get
14 {
15 return Core.Instance.Colors;
16 }
17 }
18
19 // Token: 0x17000B0B RID: 2827
20 // (get) Token: 0x0600224D RID: 8781 RVA: 0x000BECF2 File Offset: 0x000BCEF2
21 public Card Card
22 {
23 get
24 {
25 if (this.card == null || this.card.isDestroyed)
26 {
27 return null;
28 }
29 return this.card;
30 }
31 }
32
33 // Token: 0x17000B0C RID: 2828
34 // (get) Token: 0x0600224E RID: 8782 RVA: 0x000BED11 File Offset: 0x000BCF11
35 public virtual float extFixY
36 {
37 get
38 {
39 return 0f;
40 }
41 }
42
43 // Token: 0x0600224F RID: 8783 RVA: 0x000BED18 File Offset: 0x000BCF18
44 public override string ToString()
45 {
46 Card card = this.card;
47 if (card == null)
48 {
49 return null;
50 }
51 return card.ToString();
52 }
53
54 // Token: 0x06002250 RID: 8784 RVA: 0x000BED2B File Offset: 0x000BCF2B
55 public T Attach<T>(string id, bool rightAttach = true) where T : Component
56 {
57 return this.Attach(id, rightAttach).GetComponent<T>();
58 }
59
60 // Token: 0x06002251 RID: 8785 RVA: 0x000BED3C File Offset: 0x000BCF3C
61 public Transform Attach(string id, bool rightAttach = true)
62 {
63 Transform transform = PoolManager.Spawn<Transform>("attach_" + id, "UI/Element/Grid/Attach/" + id, base.transform);
64 this.listAttach.Add(transform);
65 if (rightAttach)
66 {
67 RectTransform rectTransform = transform.Rect();
68 rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, (float)(-8 - 8 * this.rightAttachCount));
69 transform.tag = "RightAttach";
70 this.rightAttachCount++;
71 }
72 transform.name = id;
73 return transform;
74 }
75
76 // Token: 0x06002252 RID: 8786 RVA: 0x000BEDC4 File Offset: 0x000BCFC4
77 public void Dettach(string id)
78 {
79 this.listAttach.ForeachReverse(delegate(Transform t)
80 {
81 if (t.name == id)
82 {
83 if (t.tag.Contains("RightAttach"))
84 {
85 this.rightAttachCount--;
86 }
87 this.listAttach.Remove(t);
88 PoolManager.Despawn(t);
89 }
90 });
91 }
92
93 // Token: 0x06002253 RID: 8787 RVA: 0x000BEDFC File Offset: 0x000BCFFC
94 public void Reset()
95 {
96 base.image.color = Color.white;
97 if (this.listAttach.Count > 0)
98 {
99 foreach (Transform c in this.listAttach)
100 {
101 PoolManager.Despawn(c);
102 }
103 this.listAttach.Clear();
104 }
105 if (this.icon)
106 {
107 this.icon.enabled = true;
108 }
109 this.rightAttachCount = 0;
110 }
111
112 // Token: 0x06002254 RID: 8788 RVA: 0x000BEE98 File Offset: 0x000BD098
113 protected override void OnDestroy()
114 {
115 if (this.listAttach.Count > 0)
116 {
117 this.Reset();
118 }
119 this.rightAttachCount = 0;
120 }
121
122 // Token: 0x06002255 RID: 8789 RVA: 0x000BEEB8 File Offset: 0x000BD0B8
123 public void SetBodySlot(BodySlot b, InvOwner owner)
124 {
125 this.SetCardGrid(b.thing, owner);
126 this.imageCheck.sprite = SpriteSheet.Get("Media/Graphics/Icon/Element/", "eq_" + b.element.alias);
127 this.imageCheck.SetNativeSize();
128 this.imageCheck.SetAlpha((b.thing == null) ? 1f : 0.4f);
129 }
130
131 // Token: 0x06002256 RID: 8790 RVA: 0x000BEF26 File Offset: 0x000BD126
132 public void Redraw()
133 {
134 this.SetCardGrid(this.card, this.invOwner);
135 }
136
137 // Token: 0x06002257 RID: 8791 RVA: 0x000BEF3C File Offset: 0x000BD13C
138 public void SetCardGrid(Card c, InvOwner owner = null)
139 {
140 if (owner != null)
141 {
142 this.invOwner = owner;
143 }
144 if (c != null && !c.isDestroyed)
145 {
146 base.interactable = true;
147 }
148 this.SetCard(c, ButtonGrid.Mode.Grid, delegate(UINote n)
149 {
150 InvOwner invOwner = this.invOwner;
151 if (invOwner == null)
152 {
153 return;
154 }
155 invOwner.OnWriteNote(this, n);
156 });
157 this.onRightClick = delegate()
158 {
159 if (!EClass.ui.AllowInventoryInteractions)
160 {
161 return;
162 }
163 if (this.invOwner == null)
164 {
165 return;
166 }
167 InvOwner.clickTimer = 0f;
168 this.invOwner.OnRightClick(this);
169 UIButton.onPressed = delegate()
170 {
171 this.invOwner.OnRightPressed(this);
172 };
173 EInput.Consume(false, 1);
174 UIButton.TryShowTip(null, true, true);
175 };
176 this.SetOnClick(delegate
177 {
178 if (!EClass.ui.AllowInventoryInteractions)
179 {
180 return;
181 }
182 InvOwner invOwner = this.invOwner;
183 if (invOwner != null)
184 {
185 invOwner.OnClick(this);
186 }
187 EInput.Consume(false, 1);
188 UIButton.TryShowTip(null, true, true);
189 });
190 }
191
192 // Token: 0x06002258 RID: 8792 RVA: 0x000BEFA0 File Offset: 0x000BD1A0
193 public void SetCard(Card c, ButtonGrid.Mode mode = ButtonGrid.Mode.Default, Action<UINote> onWriteNote = null)
194 {
195 ButtonGrid.<>c__DisplayClass25_0 CS$<>8__locals1 = new ButtonGrid.<>c__DisplayClass25_0();
196 CS$<>8__locals1.<>4__this = this;
197 CS$<>8__locals1.c = c;
198 CS$<>8__locals1.onWriteNote = onWriteNote;
199 this.Reset();
200 CS$<>8__locals1.refs = EClass.core.refs.buttonAssets;
201 this.card = CS$<>8__locals1.c;
202 ButtonGrid.<>c__DisplayClass25_0 CS$<>8__locals2 = CS$<>8__locals1;
203 InvOwner invOwner = this.invOwner;
204 CS$<>8__locals2.showNew = (invOwner != null && invOwner.ShowNew);
205 if (CS$<>8__locals1.c != null && !CS$<>8__locals1.c.isDestroyed)
206 {
207 base.SetTooltip("note", delegate(UITooltip t)
208 {
209 if (CS$<>8__locals1.c.isNew)
210 {
211 CS$<>8__locals1.c.isNew = false;
212 base.<SetCard>g__RefreshBG|0();
213 }
214 CS$<>8__locals1.c.WriteNote(t.note, CS$<>8__locals1.onWriteNote, IInspect.NoteMode.Default, null);
215 if (CS$<>8__locals1.<>4__this.ing != null)
216 {
217 t.note.Space(0, 1);
218 t.note.AddText("mark_ing".lang() + (CS$<>8__locals1.<>4__this.ing.optional ? "opIngredient" : "reqIng").lang(CS$<>8__locals1.<>4__this.ing.GetName(), null, null, null, null), FontColor.DontChange);
219 }
220 }, true);
221 CS$<>8__locals1.c.SetImage(this.icon);
222 if (CS$<>8__locals1.c == EClass.pc.held && CS$<>8__locals1.c.invY != 1)
223 {
224 this.Attach("held", true);
225 }
226 if (CS$<>8__locals1.c.trait is TraitAbility && (CS$<>8__locals1.c.trait as TraitAbility).CanUse(EClass.pc))
227 {
228 this.Attach<Image>("target_self", true).sprite = (CS$<>8__locals1.c.trait as TraitAbility).act.TargetType.IconType;
229 }
230 if (EClass.core.config.test.showRefIcon && CS$<>8__locals1.c.IsIdentified)
231 {
232 SourceElement.Row refElement = CS$<>8__locals1.c.trait.GetRefElement();
233 if (refElement != null)
234 {
235 if (refElement.GetSprite())
236 {
237 Image image = this.Attach<Image>("reficon", false);
238 refElement.SetImage(image);
239 }
240 }
241 else
242 {
243 Sprite refSprite = CS$<>8__locals1.c.trait.GetRefSprite();
244 if (refSprite)
245 {
246 Image image2 = this.Attach<Image>("reficon", false);
247 image2.sprite = refSprite;
248 image2.color = Color.white;
249 }
250 }
251 }
252 if (CS$<>8__locals1.c.qualityTier > 0)
253 {
254 this.Attach<Image>("quality", false).sprite = EClass.core.refs.icons.quality[Mathf.Clamp(CS$<>8__locals1.c.qualityTier - 1, 0, EClass.core.refs.icons.quality.Count - 1)];
255 }
256 if (CS$<>8__locals1.c.c_equippedSlot != 0 && this.invOwner != null && this.invOwner.owner.isChara && !this.invOwner.owner.IsPC)
257 {
258 this.Attach("equip", false);
259 }
260 if (CS$<>8__locals1.c.isNPCProperty || CS$<>8__locals1.c.isGifted)
261 {
262 this.Attach("npcProperty", true);
263 }
264 if (mode != ButtonGrid.Mode.Search)
265 {
266 CS$<>8__locals1.c.trait.OnSetCardGrid(this);
267 }
268 switch (mode)
269 {
270 case ButtonGrid.Mode.Default:
271 {
272 Color c2 = this.Colors.Skin.textUnidentified;
273 if (CS$<>8__locals1.c.IsIdentified)
274 {
275 switch (CS$<>8__locals1.c.blessedState)
276 {
277 case BlessedState.Doomed:
278 c2 = this.Colors.Skin.textDoomed;
279 goto IL_544;
280 case BlessedState.Cursed:
281 c2 = this.Colors.Skin.textCursed;
282 goto IL_544;
283 case BlessedState.Blessed:
284 c2 = this.Colors.Skin.textBlessed;
285 goto IL_544;
286 }
287 c2 = this.Colors.Skin.textIdentified;
288 }
289 IL_544:
290 this.mainText.SetText(CS$<>8__locals1.c.Name, c2);
291 if (this.subText)
292 {
293 this.subText.SetText(Lang._weight(CS$<>8__locals1.c.ChildrenAndSelfWeight, true, 0));
294 }
295 break;
296 }
297 case ButtonGrid.Mode.Grid:
298 case ButtonGrid.Mode.Search:
299 CS$<>8__locals1.<SetCard>g__RefreshBG|0();
300 if (CS$<>8__locals1.c.IsContainer && CS$<>8__locals1.c.c_indexContainerIcon != 0)
301 {
302 this.Attach("icon_container", false).GetComponent<Image>().sprite = EClass.core.refs.spritesContainerIcon[CS$<>8__locals1.c.c_indexContainerIcon];
303 }
304 if (CS$<>8__locals1.c.IsIdentified)
305 {
306 BlessedState blessedState = CS$<>8__locals1.c.blessedState;
307 if (blessedState != BlessedState.Normal)
308 {
309 this.Attach("status_" + blessedState.ToString(), true);
310 }
311 }
312 else
313 {
314 this.Attach("status_unidentified", true);
315 }
316 if (CS$<>8__locals1.c.IsDecayed)
317 {
318 this.Attach("rotten", true);
319 }
320 else if (CS$<>8__locals1.c.IsRotting)
321 {
322 this.Attach("rotting", true);
323 }
324 CS$<>8__locals1.c.trait.SetMainText(this.mainText, false);
325 if (mode == ButtonGrid.Mode.Search)
326 {
327 Card rootCard = CS$<>8__locals1.c.GetRootCard();
328 if (rootCard != EClass.pc)
329 {
330 this.Attach((rootCard == CS$<>8__locals1.c) ? "searched" : "searched_container", false);
331 }
332 }
333 break;
334 case ButtonGrid.Mode.Ingredient:
335 if (CS$<>8__locals1.c.IsIdentified)
336 {
337 BlessedState blessedState2 = CS$<>8__locals1.c.blessedState;
338 if (blessedState2 != BlessedState.Normal)
339 {
340 this.Attach("status_" + blessedState2.ToString(), true);
341 }
342 }
343 else
344 {
345 this.Attach("status_unidentified", true);
346 }
347 if (CS$<>8__locals1.c.IsDecayed)
348 {
349 this.Attach("rotten", true);
350 }
351 else if (CS$<>8__locals1.c.IsRotting)
352 {
353 this.Attach("rotting", true);
354 }
355 break;
356 }
357 if (CS$<>8__locals1.c.c_isImportant)
358 {
359 this.Attach("important", true);
360 }
361 return;
362 }
363 if (mode != ButtonGrid.Mode.Ingredient)
364 {
365 CS$<>8__locals1.<SetCard>g__RefreshBG|0();
366 this.icon.sprite = EClass.core.refs.icons.trans;
367 this.mainText.text = "";
368 if (this.subText)
369 {
370 this.subText.text = "";
371 }
372 }
373 else
374 {
375 this.icon.sprite = Core.Instance.refs.spriteNoIng;
376 }
377 this.icon.SetNativeSize();
378 if (this.invOwner == null || !this.invOwner.AlwaysShowTooltip || CS$<>8__locals1.onWriteNote == null)
379 {
380 base.SetTooltip(null, false);
381 return;
382 }
383 base.SetTooltip("note", delegate(UITooltip t)
384 {
385 CS$<>8__locals1.onWriteNote(t.note);
386 }, true);
387 }
388
389 // Token: 0x06002259 RID: 8793 RVA: 0x000BF5D7 File Offset: 0x000BD7D7
390 public void SetArea(Area a)
391 {
392 this.Reset();
393 this.icon.sprite = SpriteSheet.Get("icon_area");
394 this.icon.SetNativeSize();
395 this.mainText.SetActive(false);
396 }
397
398 // Token: 0x0600225A RID: 8794 RVA: 0x000BF60B File Offset: 0x000BD80B
399 public void SetItem(GridItem i)
400 {
401 this.Reset();
402 this.mainText.SetActive(true);
403 i.SetButton(this);
404 }
405
406 // Token: 0x0600225B RID: 8795 RVA: 0x000BF626 File Offset: 0x000BD826
407 public void SetObject(object o)
408 {
409 if (o is Area)
410 {
411 this.SetArea(o as Area);
412 return;
413 }
414 if (o is Card)
415 {
416 this.SetCard(o as Card, ButtonGrid.Mode.Default, null);
417 }
418 }
419
420 // Token: 0x0600225C RID: 8796 RVA: 0x000BF654 File Offset: 0x000BD854
421 public void SetDummy()
422 {
423 this.Reset();
424 this.icon.enabled = false;
425 this.mainText.SetActive(false);
426 base.onClick.RemoveAllListeners();
427 base.onClick.AddListener(delegate()
428 {
429 SE.BeepSmall();
430 });
431 this.tooltip.enable = false;
432 base.image.color = new Color(1f, 1f, 1f, 0.3f);
433 }
434
435 // Token: 0x0600225D RID: 8797 RVA: 0x000BF6E4 File Offset: 0x000BD8E4
436 public virtual void SetDragParent(IDragParent p)
437 {
438 }
439
440 // Token: 0x0600225E RID: 8798 RVA: 0x000BF6E8 File Offset: 0x000BD8E8
441 public void SetIngredient(Recipe r, Recipe.Ingredient _ing)
442 {
443 if (_ing.id.IsEmpty())
444 {
445 this.SetDummy();
446 return;
447 }
448 this.mainText.SetActive(true);
449 base.image.color = Color.white;
450 this.ing = _ing;
451 if (this.ing.thing != null && (this.ing.thing.isDestroyed || this.ing.thing.Num == 0))
452 {
453 this.ing.thing = null;
454 }
455 Thing thing = this.ing.thing;
456 this.SetCard(thing, ButtonGrid.Mode.Ingredient, null);
457 if (r != null && r.source.colorIng != 0 && r.ingredients != null && r.ingredients.Count > 0 && r.ingredients.IndexOf(_ing) == r.source.colorIng)
458 {
459 this.Attach("ing_color", false);
460 }
461 if (this.ing.optional)
462 {
463 UIButton componentInChildren = this.Attach("ing_option", false).GetComponentInChildren<UIButton>(true);
464 componentInChildren.SetActive(this.ing.thing != null);
465 componentInChildren.SetOnClick(delegate
466 {
467 SE.Trash();
468 this.ing.thing = null;
469 this.SetIngredient(r, _ing);
470 r.OnChangeIngredient();
471 if (LayerCraft.Instance)
472 {
473 LayerCraft.Instance.OnChangeIngredient();
474 }
475 });
476 }
477 HitSummary summary = Core.Instance.screen.tileSelector.summary;
478 int num = (thing == null) ? 0 : thing.Num;
479 int num2 = summary.countValid;
480 if (num2 == 0)
481 {
482 num2 = 1;
483 }
484 num2 *= this.ing.req;
485 if (this.ing.optional && num == 0)
486 {
487 num2 = 0;
488 }
489 bool flag = num < num2 && !this.ing.optional;
490 string text = (num.ToString() ?? "").TagColor(this.Colors.colorIngPredict) + (" -" + num2.ToString()).TagColor(flag ? this.Colors.colorIngCost : this.Colors.colorIngReq);
491 this.mainText.text = text;
492 if (thing == null)
493 {
494 base.SetTooltip("note", delegate(UITooltip tt)
495 {
496 tt.note.Clear();
497 tt.note.Space(16, 1);
498 tt.note.AddText("mark_ing".lang() + (this.ing.optional ? "opIngredient" : "noIngredient").lang(_ing.GetName(), null, null, null, null), this.ing.optional ? FontColor.Good : FontColor.Bad);
499 tt.note.Build();
500 }, true);
501 EClass.sources.cards.map[this.ing.IdThing].SetImage(this.icon, null, 0, true, 0, 0);
502 this.icon.SetAlpha(0.5f);
503 return;
504 }
505 if (thing.GetRootCard() != EClass.pc)
506 {
507 this.Attach("pcInv", false);
508 }
509 }
510
511 // Token: 0x0600225F RID: 8799 RVA: 0x000BF994 File Offset: 0x000BDB94
512 public void SetIngredient(Recipe r, Thing t)
513 {
514 this.SetCard(t, ButtonGrid.Mode.Ingredient, null);
515 int num = t.Num;
516 this.mainText.text = (num.ToString() ?? "");
517 this.mainText.SetActive(true);
518 if (t.GetRootCard() != EClass.pc)
519 {
520 this.Attach("pcInv", false);
521 }
522 }
523
524 // Token: 0x06002260 RID: 8800 RVA: 0x000BF9F4 File Offset: 0x000BDBF4
525 public void SetRecipeVariation(UIRecipeInfo.RecipeVariation a)
526 {
527 this.Reset();
528 Recipe recipe = a.recipe;
529 if (recipe.UseStock && !recipe.VirtualBlock && recipe.ingredients[0].thing != null)
530 {
531 recipe.ingredients[0].thing.SetImage(this.icon, a.dir, recipe.ingredients[0].thing.idSkin);
532 }
533 else
534 {
535 recipe.renderRow.SetImage(this.icon, null, recipe.renderRow.GetColorInt(recipe.GetColorMaterial()), true, a.dir, recipe.idSkin);
536 }
537 this.mainText.SetActive(false);
538 }
539
540 // Token: 0x06002261 RID: 8801 RVA: 0x000BFAA7 File Offset: 0x000BDCA7
541 public void SetRecipe()
542 {
543 this.SetRecipe(this.recipe);
544 }
545
546 // Token: 0x06002262 RID: 8802 RVA: 0x000BFAB5 File Offset: 0x000BDCB5
547 public void SetRecipe(Area a)
548 {
549 this.Reset();
550 this.area = a;
551 this.icon.sprite = Core.Instance.refs.spriteArea;
552 this.icon.SetNativeSize();
553 this.mainText.SetActive(false);
554 }
555
556 // Token: 0x06002263 RID: 8803 RVA: 0x000BFAF8 File Offset: 0x000BDCF8
557 public void SetRecipe(Recipe r)
558 {
559 this.Reset();
560 this.recipe = r;
561 if (r.UseStock)
562 {
563 this.recipe.ingredients[0].RefreshThing();
564 Thing thing = this.recipe.ingredients[0].thing;
565 this.mainText.SetText(thing.Num.ToString() ?? "", SkinManager.CurrentColors.buttonGrid);
566 if (r.VirtualBlock)
567 {
568 r.renderRow.SetImage(this.icon, null, r.GetDefaultColor(), true, 0, thing.idSkin);
569 }
570 else
571 {
572 thing.SetImage(this.icon);
573 }
574 }
575 else
576 {
577 r.renderRow.SetImage(this.icon, null, r.GetDefaultColor(), true, 0, r.idSkin);
578 }
579 this.mainText.SetActive(r.UseStock);
580 if (r.UseStock)
581 {
582 Thing thing2 = r.ingredients[0].thing;
583 if (((thing2 != null) ? thing2.GetRootCard() : null) != EClass.pc)
584 {
585 this.Attach("pcInv", false);
586 }
587 }
588 }
589
590 // Token: 0x06002264 RID: 8804 RVA: 0x000BFC1C File Offset: 0x000BDE1C
591 public void RefreshCraftable()
592 {
593 ThingStack thingStack = EClass.pc.things.GetThingStack(this.recipe.GetIdThing(), this.recipe.GetRefVal());
594 bool flag = this.recipe.IsCraftable();
595 this.mainText.SetText(this.recipe.Name, flag ? FontColor.Good : FontColor.Bad);
596 this.subText.text = (thingStack.count.ToString() ?? "");
597 this.recipe.SetTextDifficulty(this.subText2);
598 }
599
600 // Token: 0x06002265 RID: 8805 RVA: 0x000BFCA8 File Offset: 0x000BDEA8
601 public void SetCraftRecipe(Recipe r, ButtonGrid.Mode mode, bool tooltip = false)
602 {
603 this.Reset();
604 this.recipe = r;
605 if (mode == ButtonGrid.Mode.Recipe)
606 {
607 this.RefreshCraftable();
608 }
609 else
610 {
611 this.mainText.SetActive(false);
612 }
613 RecipeCard rCard = r as RecipeCard;
614 if (rCard != null)
615 {
616 r.SetImage(this.icon);
617 }
618 else
619 {
620 r.SetImage(this.icon);
621 }
622 if (tooltip)
623 {
624 Action<UINote> <>9__1;
625 base.SetTooltip("note", delegate(UITooltip t)
626 {
627 if (r.ingredients.Count == 0)
628 {
629 r.BuildIngredientList();
630 }
631 EClass.player.recipes.hoveredRecipes.Add(r.id);
632 this.Dettach("recipe_new");
633 if (rCard != null)
634 {
635 if (mode == ButtonGrid.Mode.RecipeGrid && rCard._mold == null)
636 {
637 CardBlueprint.SetNormalRarity(false);
638 rCard._mold = ThingGen.Create(r.id, -1, -1);
639 }
640 Card mold = rCard.Mold;
641 UINote note = t.note;
642 Action<UINote> onWriteNote;
643 if ((onWriteNote = <>9__1) == null)
644 {
645 onWriteNote = (<>9__1 = delegate(UINote n)
646 {
647 n.Space(0, 1);
648 this.WriteReqMat(n, r);
649 });
650 }
651 mold.WriteNote(note, onWriteNote, IInspect.NoteMode.Product, r);
652 return;
653 }
654 UINote note2 = t.note;
655 note2.Clear();
656 note2.AddHeaderCard(r.GetName(), this.icon.sprite);
657 if (!r.GetDetail().IsEmpty())
658 {
659 note2.AddText(r.GetDetail(), FontColor.DontChange);
660 }
661 this.WriteReqMat(note2, r);
662 t.note.Build();
663 }, true);
664 }
665 }
666
667 // Token: 0x06002266 RID: 8806 RVA: 0x000BFD58 File Offset: 0x000BDF58
668 public void WriteReqMat(UINote n, Recipe r)
669 {
670 r.WriteReqFactory(n, true);
671 r.WriteReqSkill(n);
672 n.AddHeaderTopic("reqMat", null);
673 foreach (Recipe.Ingredient ingredient in r.ingredients)
674 {
675 int count = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC).count;
676 Color c = (count >= ingredient.req) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad;
677 string text = string.Concat(new string[]
678 {
679 "<color=",
680 c.ToHex(),
681 ">",
682 ingredient.GetName(),
683 " x ",
684 ingredient.req.ToString(),
685 " (",
686 count.ToString(),
687 ")</color>"
688 });
689 if (ingredient.optional)
690 {
691 text = "opIngredient".lang(text, null, null, null, null);
692 }
693 n.AddText(text, FontColor.DontChange).text1.SetSize(-1);
694 }
695 }
696
697 // Token: 0x06002267 RID: 8807 RVA: 0x000BFE8C File Offset: 0x000BE08C
698 public bool ShowMouseHintLeft()
699 {
700 return this.invOwner != null && this.card != null && (this.invOwner.CanShiftClick(this, false) || this.invOwner.CanCtrlClick(this) || this.invOwner.CanAltClick(this));
701 }
702
703 // Token: 0x06002268 RID: 8808 RVA: 0x000BFECC File Offset: 0x000BE0CC
704 public string GetTextMouseHintLeft()
705 {
706 if (this.invOwner.CanShiftClick(this, false))
707 {
708 return this.invOwner.GetTextShiftClick(this);
709 }
710 if (this.invOwner.CanCtrlClick(this))
711 {
712 return this.invOwner.GetTextCtrlClick(this);
713 }
714 if (!this.invOwner.CanAltClick(this))
715 {
716 return "";
717 }
718 return this.invOwner.GetTextAltClick(this);
719 }
720
721 // Token: 0x06002269 RID: 8809 RVA: 0x000BFF30 File Offset: 0x000BE130
722 public bool ShowMouseHintRight()
723 {
724 return this.invOwner != null && this.card != null && this.invOwner.AllowAutouse;
725 }
726
727 // Token: 0x0600226A RID: 8810 RVA: 0x000BFF4F File Offset: 0x000BE14F
728 public string GetTextMouseHintRight()
729 {
730 return this.invOwner.GetAutoUseLang(this) ?? "";
731 }
732
733 // Token: 0x0600226B RID: 8811 RVA: 0x000BFF68 File Offset: 0x000BE168
734 public RenderRow GetRenderRow()
735 {
736 if (this.refObj is RenderRow)
737 {
738 return (RenderRow)this.refObj;
739 }
740 if (this.recipe != null)
741 {
742 return this.recipe.renderRow;
743 }
744 if (this.card == null)
745 {
746 return null;
747 }
748 return this.card.sourceCard;
749 }
750
751 // Token: 0x0600226C RID: 8812 RVA: 0x000BFFB8 File Offset: 0x000BE1B8
752 public void OnRefreshPref()
753 {
754 RenderRow renderRow = this.refObj as RenderRow;
755 if (renderRow != null)
756 {
757 renderRow.SetImage(this.icon, null, 0, false, 0, 0);
758 }
759 if (this.recipe != null)
760 {
761 this.SetRecipe(this.recipe);
762 return;
763 }
764 if (this.card != null)
765 {
766 this.SetCard(this.card, ButtonGrid.Mode.Default, null);
767 }
768 }
769
770 // Token: 0x0600226D RID: 8813 RVA: 0x000C0010 File Offset: 0x000BE210
771 public override bool CanMiddleClick()
772 {
773 return this.invOwner != null && this.card != null && EClass.ui.AllowInventoryInteractions;
774 }
775
776 // Token: 0x0600226E RID: 8814 RVA: 0x000C0030 File Offset: 0x000BE230
777 public override void OnMiddleClick()
778 {
779 Thing t = this.card.Thing;
780 InvOwner o = this.invOwner;
781 if (EInput.middleMouse.clicked && o.AllowContext)
782 {
783 o.ShowContextMenu(this);
784 }
785 EInput.middleMouse.pressedLongAction = delegate()
786 {
787 if (EClass.ui.AllowInventoryInteractions && EClass.core.config.game.holdMiddleButtonToHold && o.TryHold(t))
788 {
789 if (!(t.trait is TraitAbility) && t.trait.IsTool)
790 {
791 HotItemHeld.disableTool = true;
792 }
793 if (EClass.ui.contextMenu.isActive)
794 {
795 EClass.ui.contextMenu.currentMenu.Hide();
796 }
797 EInput.Consume(false, 1);
798 }
799 };
800 }
801
802 // Token: 0x040011D4 RID: 4564
803 public Area area;
804
805 // Token: 0x040011D5 RID: 4565
806 public Recipe recipe;
807
808 // Token: 0x040011D6 RID: 4566
809 public Recipe.Ingredient ing;
810
811 // Token: 0x040011D7 RID: 4567
812 public Card card;
813
814 // Token: 0x040011D8 RID: 4568
815 public int index;
816
817 // Token: 0x040011D9 RID: 4569
818 public InvOwner invOwner;
819
820 // Token: 0x040011DA RID: 4570
821 public bool keepBg;
822
823 // Token: 0x040011DB RID: 4571
824 [NonSerialized]
825 public List<Transform> listAttach = new List<Transform>();
826
827 // Token: 0x040011DC RID: 4572
828 private int rightAttachCount;
829
830 // Token: 0x02000A0B RID: 2571
831 public enum Mode
832 {
833 // Token: 0x04002974 RID: 10612
834 Default,
835 // Token: 0x04002975 RID: 10613
836 Grid,
837 // Token: 0x04002976 RID: 10614
838 Ingredient,
839 // Token: 0x04002977 RID: 10615
840 Recipe,
841 // Token: 0x04002978 RID: 10616
842 RecipeGrid,
843 // Token: 0x04002979 RID: 10617
844 Search
845 }
846}
Definition Area.cs:6
Definition Card.cs:13
Definition Thing.cs:10