Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
ButtonGrid Class Reference
Inheritance diagram for ButtonGrid:
UIButton IMouseHint IPrefImage IUISkin ButtonGridDrag ButtonHotItem

Public Types

enum  Mode {
  Default , Grid , Ingredient , Recipe ,
  RecipeGrid , Search
}
 

Public Member Functions

override string ToString ()
 
Attach< T > (string id, bool rightAttach=true)
 
Transform Attach (string id, bool rightAttach=true)
 
void Dettach (string id)
 
void Reset ()
 
void SetBodySlot (BodySlot b, InvOwner owner, bool showIndex=false)
 
void Redraw ()
 
void SetCardGrid (Card c, InvOwner owner=null)
 
void SetCard (Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
 
void SetArea (Area a)
 
void SetItem (GridItem i)
 
void SetObject (object o)
 
void SetDummy ()
 
virtual void SetDragParent (IDragParent p)
 
void SetIngredient (Recipe r, Recipe.Ingredient _ing)
 
void SetIngredient (Recipe r, Thing t)
 
void SetRecipeVariation (UIRecipeInfo.RecipeVariation a)
 
void SetRecipe ()
 
void SetRecipe (Area a)
 
void SetRecipe (Recipe r)
 
void RefreshCraftable ()
 
void SetCraftRecipe (Recipe r, Mode mode, bool tooltip=false)
 
void WriteReqMat (UINote n, Recipe r)
 
bool ShowMouseHintLeft ()
 
string GetTextMouseHintLeft ()
 
bool ShowMouseHintRight ()
 
string GetTextMouseHintRight ()
 
RenderRow GetRenderRow ()
 
void OnRefreshPref ()
 
override bool CanMiddleClick ()
 
override void OnMiddleClick (bool forceClick)
 
- Public Member Functions inherited from UIButton
virtual bool CanMiddleClick ()
 
virtual void OnMiddleClick (bool forceClick)
 
void SetItem (Item i)
 
virtual void RefreshItem ()
 
virtual void OnHover ()
 
void Toggle ()
 
void ToggleCheck ()
 
void SetCheck (bool check)
 
void SetToggle (bool isOn, Action< bool > onToggle=null)
 
void SetToggleWithScore (bool isOn, Action< bool > onToggle, int? score)
 
void SetTooltip (Action< UITooltip > onShowTooltip=null, bool enable=true)
 
void SetTooltip (string id, Action< UITooltip > onShowTooltip=null, bool enable=true)
 
void SetTooltipLang (string lang=null)
 
virtual void ShowTooltip ()
 
void ShowTooltipForced (bool ignoreWhenRightClick=true)
 
override void OnPointerDown (PointerEventData eventData)
 
override void OnPointerClick (PointerEventData eventData)
 
override void OnPointerUp (PointerEventData eventData)
 
void OnPointerUpOnDrag (PointerEventData eventData)
 
void _OnPress ()
 
void OnPress ()
 
void AddHighlight (Func< bool > killCondition)
 
void DoHighlightTransition (bool instant=false)
 
void DoNormalTransition (bool instant=true)
 
override Selectable FindSelectableOnDown ()
 
override Selectable FindSelectableOnUp ()
 
override Selectable FindSelectableOnLeft ()
 
override Selectable FindSelectableOnRight ()
 
void SetNavigation (UIButton up, UIButton down=null, UIButton left=null, UIButton right=null)
 
override bool IsActive ()
 
void SetInteractableWithAlpha (bool enable)
 
virtual void ApplySkin ()
 
void ApplySkin ()
 
bool ShowMouseHintLeft ()
 
string GetTextMouseHintLeft ()
 
bool ShowMouseHintRight ()
 
string GetTextMouseHintRight ()
 
RenderRow GetRenderRow ()
 
void OnRefreshPref ()
 

Public Attributes

Area area
 
Recipe recipe
 
Recipe.Ingredient ing
 
Card card
 
int index
 
InvOwner invOwner
 
bool keepBg
 
List< Transform > listAttach = new List<Transform>()
 
- Public Attributes inherited from UIButton
UIText mainText
 
UIText subText
 
UIText subText2
 
UIText keyText
 
Image icon
 
Image imageCheck
 
Graphic[] targetGraphics
 
float scaleIcon = 1f
 
float slideX
 
float navigationFix
 
bool isChecked
 
bool instantClick = true
 
UISelectableGroup group
 
TooltipData tooltip
 
SoundData soundClick
 
SoundData soundHighlight
 
Transform animeTarget
 
Anime animeClick
 
Anime animeHold
 
ButtonType buttonType
 
BaseSkinRoot skinRoot
 
Action onDoubleClick
 
Action onRightClick
 
Action< int > onInputWheel
 
object refObj
 
int refInt
 
string refStr
 
bool animating
 
bool selected
 
Vector3 originalIconScale = Vector3.one
 
UIButton highlightTarget
 
Item item
 

Protected Member Functions

override void OnDestroy ()
 
- Protected Member Functions inherited from UIButton
override void Awake ()
 
override void OnEnable ()
 
override void DoStateTransition (SelectionState state, bool instant)
 

Properties

ColorProfile Colors [get]
 
Card Card [get]
 
virtual float extFixY [get]
 
- Properties inherited from UIButton
List< Graphic > Graphics [get]
 
virtual bool CanDragLeftButton [get]
 

Private Attributes

int rightAttachCount
 

Additional Inherited Members

- Static Public Member Functions inherited from UIButton
static void UpdateButtons ()
 
static void TryHihlight ()
 
static void TryShowTip (Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
 
static void TryShowTip< T > (Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
 
- Static Public Attributes inherited from UIButton
static bool DoSlide
 
static bool locked
 
static UIButton lastButton
 
static UIButton lastHovered
 
static UIButton currentHighlight
 
static UIButton currentPressedButton
 
static float lastClicked
 
static float doubleClickTime = 0.4f
 
static Vector2 buttonPos
 
static Action onPressed
 
static List< UIButtonbuttons = new List<UIButton>()
 
static Action actionTooltip
 

Detailed Description

Definition at line 6 of file ButtonGrid.cs.

Member Enumeration Documentation

◆ Mode

Enumerator
Default 
Grid 
Ingredient 
Recipe 
RecipeGrid 
Search 

Definition at line 8 of file ButtonGrid.cs.

Member Function Documentation

◆ Attach()

Transform ButtonGrid.Attach ( string  id,
bool  rightAttach = true 
)
inline

Definition at line 63 of file ButtonGrid.cs.

64 {
65 Transform transform = PoolManager.Spawn<Transform>("attach_" + id, "UI/Element/Grid/Attach/" + id, base.transform);
66 listAttach.Add(transform);
67 if (rightAttach)
68 {
69 RectTransform rectTransform = transform.Rect();
70 rectTransform.anchoredPosition = new Vector2(rectTransform.anchoredPosition.x, -8 - 8 * rightAttachCount);
71 transform.tag = "RightAttach";
73 }
74 transform.name = id;
75 return transform;
76 }
int rightAttachCount
Definition: ButtonGrid.cs:35
List< Transform > listAttach
Definition: ButtonGrid.cs:33
static Transform Spawn(string id, string path, Transform parent)
Definition: PoolManager.cs:86

References listAttach, rightAttachCount, and PoolManager.Spawn().

Referenced by Attach< T >(), TraitCanvas.OnSetCardGrid(), TraitContainer.OnSetCardGrid(), TraitEquipItem.OnSetCardGrid(), TraitFigure.OnSetCardGrid(), DragItemCard.OnStartDrag(), LayerCraft.RefreshCategory(), and LayerCraftFloat.RefreshCraft().

◆ Attach< T >()

T ButtonGrid.Attach< T > ( string  id,
bool  rightAttach = true 
)
inline
Type Constraints
T :Component 

Definition at line 58 of file ButtonGrid.cs.

58 : Component
59 {
60 return Attach(id, rightAttach).GetComponent<T>();
61 }
Transform Attach(string id, bool rightAttach=true)
Definition: ButtonGrid.cs:63

References Attach().

◆ CanMiddleClick()

override bool ButtonGrid.CanMiddleClick ( )
inlinevirtual

Reimplemented from UIButton.

Definition at line 741 of file ButtonGrid.cs.

742 {
743 if (invOwner != null && card != null)
744 {
745 return EClass.ui.AllowInventoryInteractions;
746 }
747 return false;
748 }
Card card
Definition: ButtonGrid.cs:24
InvOwner invOwner
Definition: ButtonGrid.cs:28
Definition: EClass.cs:5
static UI ui
Definition: EClass.cs:16

References card, and EClass.ui.

◆ Dettach()

void ButtonGrid.Dettach ( string  id)
inline

Definition at line 78 of file ButtonGrid.cs.

79 {
80 listAttach.ForeachReverse(delegate(Transform t)
81 {
82 if (t.name == id)
83 {
84 if (t.tag.Contains("RightAttach"))
85 {
86 rightAttachCount--;
87 }
88 listAttach.Remove(t);
90 }
91 });
92 }
static void Despawn(Component c)
Definition: PoolManager.cs:128

References PoolManager.Despawn(), and listAttach.

Referenced by DragItemCard.OnEndDrag(), and LayerCraft.RefreshCategory().

◆ GetRenderRow()

RenderRow ButtonGrid.GetRenderRow ( )
inline

Implements IPrefImage.

Definition at line 708 of file ButtonGrid.cs.

709 {
710 if (refObj is RenderRow)
711 {
712 return (RenderRow)refObj;
713 }
714 if (recipe == null)
715 {
716 if (card == null)
717 {
718 return null;
719 }
720 return card.sourceCard;
721 }
722 return recipe.renderRow;
723 }
Recipe recipe
Definition: ButtonGrid.cs:20
virtual CardRow sourceCard
Definition: Card.cs:2007
virtual RenderRow renderRow
Definition: Recipe.cs:193
object refObj
Definition: UIButton.cs:151

References card.

◆ GetTextMouseHintLeft()

string ButtonGrid.GetTextMouseHintLeft ( )
inline

Implements IMouseHint.

Definition at line 677 of file ButtonGrid.cs.

678 {
679 if (!invOwner.CanShiftClick(this))
680 {
681 if (!invOwner.CanCtrlClick(this))
682 {
683 if (!invOwner.CanAltClick(this))
684 {
685 return "";
686 }
687 return invOwner.GetTextAltClick(this);
688 }
689 return invOwner.GetTextCtrlClick(this);
690 }
691 return invOwner.GetTextShiftClick(this);
692 }
virtual bool CanCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1062
virtual string GetTextAltClick(ButtonGrid b)
Definition: InvOwner.cs:1102
virtual string GetTextCtrlClick(ButtonGrid b)
Definition: InvOwner.cs:1075
virtual bool CanAltClick(ButtonGrid b)
Definition: InvOwner.cs:1085
virtual string GetTextShiftClick(ButtonGrid b)
Definition: InvOwner.cs:1052
virtual bool CanShiftClick(ButtonGrid b, bool rightMouse=false)
Definition: InvOwner.cs:981

◆ GetTextMouseHintRight()

string ButtonGrid.GetTextMouseHintRight ( )
inline

Implements IMouseHint.

Definition at line 703 of file ButtonGrid.cs.

704 {
705 return invOwner.GetAutoUseLang(this) ?? "";
706 }
virtual string GetAutoUseLang(ButtonGrid button)
Definition: InvOwner.cs:1640

◆ OnDestroy()

override void ButtonGrid.OnDestroy ( )
inlineprotected

Definition at line 112 of file ButtonGrid.cs.

113 {
114 if (listAttach.Count > 0)
115 {
116 Reset();
117 }
119 }
void Reset()
Definition: ButtonGrid.cs:94

References Reset.

◆ OnMiddleClick()

override void ButtonGrid.OnMiddleClick ( bool  forceClick)
inlinevirtual

Reimplemented from UIButton.

Definition at line 750 of file ButtonGrid.cs.

751 {
752 Thing t = card.Thing;
753 InvOwner o = invOwner;
754 if ((forceClick || EInput.middleMouse.clicked) && o.AllowContext)
755 {
756 o.ShowContextMenu(this);
757 }
758 EInput.middleMouse.pressedLongAction = delegate
759 {
760 if (EClass.ui.AllowInventoryInteractions && EClass.core.config.game.holdMiddleButtonToHold && o.TryHold(t))
761 {
762 if (!(t.trait is TraitAbility) && t.trait.IsTool)
763 {
764 HotItemHeld.disableTool = true;
765 }
766 if (EClass.ui.contextMenu.isActive)
767 {
768 EClass.ui.contextMenu.currentMenu.Hide();
769 }
770 EInput.Consume();
771 }
772 };
773 }
bool clicked
Definition: ButtonState.cs:37
Trait trait
Definition: Card.cs:49
virtual Thing Thing
Definition: Card.cs:1934
new GameConfig game
Definition: CoreConfig.cs:596
CoreConfig config
Definition: Core.cs:70
static Core core
Definition: EClass.cs:6
Definition: EInput.cs:8
static ButtonState middleMouse
Definition: EInput.cs:353
static void Consume(int _skipFrame)
Definition: EInput.cs:656
void ShowContextMenu(ButtonGrid button)
Definition: InvOwner.cs:1713
bool TryHold(Thing t)
Definition: InvOwner.cs:1481
virtual bool AllowContext
Definition: InvOwner.cs:560
Definition: Thing.cs:8
virtual bool IsTool
Definition: Trait.cs:355

References InvOwner.AllowContext, card, ButtonState.clicked, Core.config, EInput.Consume(), EClass.core, CoreConfig.game, CoreConfig.GameConfig.holdMiddleButtonToHold, Trait.IsTool, EInput.middleMouse, InvOwner.ShowContextMenu(), Card.trait, InvOwner.TryHold(), and EClass.ui.

◆ OnRefreshPref()

void ButtonGrid.OnRefreshPref ( )
inline

Implements IPrefImage.

Definition at line 725 of file ButtonGrid.cs.

726 {
727 if (refObj is RenderRow renderRow)
728 {
729 renderRow.SetImage(icon, null, 0, setNativeSize: false);
730 }
731 if (recipe != null)
732 {
734 }
735 else if (card != null)
736 {
737 SetCard(card);
738 }
739 }
void SetCard(Card c, Mode mode=Mode.Default, Action< UINote > onWriteNote=null)
Definition: ButtonGrid.cs:184
void SetRecipe()
Definition: ButtonGrid.cs:533
Image icon
Definition: UIButton.cs:110

References card.

◆ Redraw()

void ButtonGrid.Redraw ( )
inline

Definition at line 140 of file ButtonGrid.cs.

141 {
143 }
void SetCardGrid(Card c, InvOwner owner=null)
Definition: ButtonGrid.cs:145

References card.

Referenced by LayerDragGrid.Redraw().

◆ RefreshCraftable()

void ButtonGrid.RefreshCraftable ( )
inline

Definition at line 576 of file ButtonGrid.cs.

577 {
579 bool flag = recipe.IsCraftable();
580 mainText.SetText(recipe.Name, flag ? FontColor.Good : FontColor.Bad);
581 subText.text = thingStack.count.ToString() ?? "";
583 }
FontColor
Definition: FontColor.cs:2
ThingContainer things
Definition: Card.cs:34
static Chara pc
Definition: EClass.cs:14
virtual int GetRefVal()
Definition: Recipe.cs:405
void SetTextDifficulty(UIText text)
Definition: Recipe.cs:936
virtual string GetIdThing()
Definition: Recipe.cs:422
bool IsCraftable()
Definition: Recipe.cs:887
string Name
Definition: Recipe.cs:195
ThingStack GetThingStack(string id, int refVal=-1)
int count
Definition: ThingStack.cs:7
UIText subText2
Definition: UIButton.cs:106
UIText mainText
Definition: UIButton.cs:102
void SetText(string s)
Definition: UIText.cs:159

References ThingStack.count, ThingContainer.GetThingStack(), EClass.pc, and Card.things.

◆ Reset()

void ButtonGrid.Reset ( )
inline

Definition at line 94 of file ButtonGrid.cs.

95 {
96 base.image.color = Color.white;
97 if (listAttach.Count > 0)
98 {
99 foreach (Transform item in listAttach)
100 {
102 }
103 listAttach.Clear();
104 }
105 if ((bool)icon)
106 {
107 icon.enabled = true;
108 }
110 }
Item item
Definition: UIButton.cs:172

References Color, PoolManager.Despawn(), and item.

◆ SetArea()

void ButtonGrid.SetArea ( Area  a)
inline

Definition at line 390 of file ButtonGrid.cs.

391 {
392 Reset();
393 icon.sprite = SpriteSheet.Get("icon_area");
394 icon.SetNativeSize();
395 mainText.SetActive(enable: false);
396 }
static Sprite Get(string id)
Definition: SpriteSheet.cs:28

References SpriteSheet.Get(), and Reset.

◆ SetBodySlot()

void ButtonGrid.SetBodySlot ( BodySlot  b,
InvOwner  owner,
bool  showIndex = false 
)
inline

Definition at line 121 of file ButtonGrid.cs.

122 {
123 SetCardGrid(b.thing, owner);
124 imageCheck.sprite = SpriteSheet.Get("Media/Graphics/Icon/Element/", "eq_" + b.element.alias);
125 imageCheck.SetNativeSize();
126 imageCheck.SetAlpha((b.thing == null) ? 1f : 0.4f);
127 if ((bool)subText)
128 {
129 if (showIndex)
130 {
132 }
133 else
134 {
135 subText.SetActive(enable: false);
136 }
137 }
138 }
Thing thing
Definition: BodySlot.cs:8
SourceElement.Row element
Definition: BodySlot.cs:16
virtual Chara Chara
Definition: Card.cs:1946
void SetBodyIndexText(BodySlot b, UIText t)
Definition: CharaBody.cs:475
CharaBody body
Definition: Chara.cs:91
Card owner
Definition: InvOwner.cs:538
UIText subText
Definition: UIButton.cs:104
Image imageCheck
Definition: UIButton.cs:112

References Chara.body, Card.Chara, BodySlot.element, SpriteSheet.Get(), InvOwner.owner, CharaBody.SetBodyIndexText(), and BodySlot.thing.

Referenced by LayerEquip.RefreshEquipment(), and WidgetEquip.RefreshEquipment().

◆ SetCard()

void ButtonGrid.SetCard ( Card  c,
Mode  mode = Mode::Default,
Action< UINote onWriteNote = null 
)
inline

Definition at line 184 of file ButtonGrid.cs.

185 {
186 Reset();
188 card = c;
189 bool showNew = invOwner?.ShowNew ?? false;
190 if (c == null || c.isDestroyed)
191 {
192 if (mode != Mode.Ingredient)
193 {
194 RefreshBG();
195 icon.sprite = EClass.core.refs.icons.trans;
196 mainText.text = "";
197 if ((bool)subText)
198 {
199 subText.text = "";
200 }
201 }
202 else
203 {
204 icon.sprite = Core.Instance.refs.spriteNoIng;
205 }
206 icon.SetNativeSize();
207 if (invOwner == null || !invOwner.AlwaysShowTooltip || onWriteNote == null)
208 {
209 SetTooltip(null, enable: false);
210 return;
211 }
212 SetTooltip("note", delegate(UITooltip t)
213 {
214 onWriteNote(t.note);
215 });
216 return;
217 }
218 SetTooltip("note", delegate(UITooltip t)
219 {
220 if (c.isNew)
221 {
222 c.isNew = false;
223 RefreshBG();
224 }
225 c.WriteNote(t.note, onWriteNote);
226 if (ing != null)
227 {
228 t.note.Space();
229 t.note.AddText("mark_ing".lang() + (ing.optional ? "opIngredient" : "reqIng").lang(ing.GetName()));
230 }
231 });
232 c.SetImage(icon);
233 if (c == EClass.pc.held && c.invY != 1)
234 {
235 Attach("held");
236 }
237 if (c.trait is TraitAbility && (c.trait as TraitAbility).CanUse(EClass.pc))
238 {
239 Attach<Image>("target_self").sprite = (c.trait as TraitAbility).act.TargetType.IconType;
240 }
242 {
243 SourceElement.Row refElement = c.trait.GetRefElement();
244 if (refElement != null)
245 {
246 if ((bool)refElement.GetSprite())
247 {
248 Image image = Attach<Image>("reficon", rightAttach: false);
249 refElement.SetImage(image);
250 }
251 }
252 else
253 {
254 Sprite refSprite = c.trait.GetRefSprite();
255 if ((bool)refSprite)
256 {
257 Image obj = Attach<Image>("reficon", rightAttach: false);
258 obj.sprite = refSprite;
259 obj.color = Color.white;
260 }
261 }
262 }
263 if (c.qualityTier > 0)
264 {
265 Attach<Image>("quality", rightAttach: false).sprite = EClass.core.refs.icons.quality[Mathf.Clamp(c.qualityTier - 1, 0, EClass.core.refs.icons.quality.Count - 1)];
266 }
267 if (c.c_equippedSlot != 0 && invOwner != null && invOwner.owner.isChara && !invOwner.owner.IsPC)
268 {
269 Attach("equip", rightAttach: false);
270 }
271 if (c.isNPCProperty || c.isGifted)
272 {
273 Attach("npcProperty");
274 }
275 if (mode != Mode.Search)
276 {
277 c.trait.OnSetCardGrid(this);
278 }
279 switch (mode)
280 {
281 case Mode.Grid:
282 case Mode.Search:
283 RefreshBG();
284 if (c.IsContainer && c.c_indexContainerIcon != 0)
285 {
286 Attach("icon_container", rightAttach: false).GetComponent<Image>().sprite = EClass.core.refs.spritesContainerIcon[c.c_indexContainerIcon];
287 }
288 if (c.IsIdentified)
289 {
290 BlessedState blessedState2 = c.blessedState;
291 if (blessedState2 != 0)
292 {
293 Attach("status_" + blessedState2);
294 }
295 }
296 else
297 {
298 Attach("status_unidentified");
299 }
300 if (c.IsDecayed)
301 {
302 Attach("rotten");
303 }
304 else if (c.IsRotting)
305 {
306 Attach("rotting");
307 }
308 c.trait.SetMainText(mainText, hotitem: false);
309 if (mode == Mode.Search)
310 {
311 Card rootCard = c.GetRootCard();
312 if (rootCard != EClass.pc)
313 {
314 Attach((rootCard == c) ? "searched" : "searched_container", rightAttach: false);
315 }
316 }
317 break;
318 case Mode.Default:
319 {
321 if (c.IsIdentified)
322 {
323 c2 = c.blessedState switch
324 {
325 BlessedState.Blessed => Colors.Skin.textBlessed,
326 BlessedState.Doomed => Colors.Skin.textDoomed,
327 BlessedState.Cursed => Colors.Skin.textCursed,
329 };
330 }
331 mainText.SetText(c.Name, c2);
332 if ((bool)subText)
333 {
335 }
336 break;
337 }
338 case Mode.Ingredient:
339 if (c.IsIdentified)
340 {
341 BlessedState blessedState = c.blessedState;
342 if (blessedState != 0)
343 {
344 Attach("status_" + blessedState);
345 }
346 }
347 else
348 {
349 Attach("status_unidentified");
350 }
351 if (c.IsDecayed)
352 {
353 Attach("rotten");
354 }
355 else if (c.IsRotting)
356 {
357 Attach("rotting");
358 }
359 break;
360 }
361 if (c.c_isImportant)
362 {
363 Attach("important");
364 }
365 void RefreshBG()
366 {
367 if (!keepBg)
368 {
369 if (c == null)
370 {
371 base.image.sprite = refs.bgDefault;
372 }
373 else
374 {
375 Sprite sprite = refs.bgDefault;
376 if (c.rarity >= Rarity.Superior && c.IsIdentified && c.IsEquipmentOrRangedOrAmmo)
377 {
378 sprite = ((c.rarity >= Rarity.Artifact) ? refs.bgArtifact : ((c.rarity >= Rarity.Mythical) ? refs.bgMythical : ((c.rarity < Rarity.Legendary) ? refs.bgSuperior : refs.bgLegendary)));
379 }
380 else if (showNew && c.isNew && c.invY != 1)
381 {
382 sprite = refs.bgNew;
383 }
384 base.image.sprite = sprite;
385 }
386 }
387 }
388 }
BlessedState
Definition: BlessedState.cs:2
Rarity
Definition: Rarity.cs:2
if(item3.idFile==idFirstFile &&item3.id==idFirstTopic)
Definition: UIBook.cs:627
bool keepBg
Definition: ButtonGrid.cs:30
ColorProfile Colors
Definition: ButtonGrid.cs:37
Recipe.Ingredient ing
Definition: ButtonGrid.cs:22
Definition: Card.cs:11
bool isDestroyed
Definition: Card.cs:71
bool IsDecayed
Definition: Card.cs:2147
bool isNPCProperty
Definition: Card.cs:526
int c_equippedSlot
Definition: Card.cs:912
bool IsRotting
Definition: Card.cs:2149
int c_indexContainerIcon
Definition: Card.cs:1325
int qualityTier
Definition: Card.cs:394
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2090
int invY
Definition: Card.cs:1831
Rarity rarity
Definition: Card.cs:298
string Name
Definition: Card.cs:2013
bool isNew
Definition: Card.cs:454
bool c_isImportant
Definition: Card.cs:984
virtual bool IsPC
Definition: Card.cs:2019
virtual bool isChara
Definition: Card.cs:1959
Card GetRootCard()
Definition: Card.cs:3173
virtual void WriteNote(UINote n, Action< UINote > onWriteNote=null, IInspect.NoteMode mode=IInspect.NoteMode.Default, Recipe recipe=null)
Definition: Card.cs:6958
bool isGifted
Definition: Card.cs:754
BlessedState blessedState
Definition: Card.cs:262
void SetImage(Image image, int dir, int idSkin=0)
Definition: Card.cs:5355
int ChildrenAndSelfWeight
Definition: Card.cs:1917
bool IsIdentified
Definition: Card.cs:2237
bool IsContainer
Definition: Card.cs:1965
Card held
Definition: Chara.cs:67
SkinColorProfile Skin
List< Sprite > quality
Definition: CoreRef.cs:136
Sprite trans
Definition: CoreRef.cs:106
List< Sprite > spritesContainerIcon
Definition: CoreRef.cs:363
Icons icons
Definition: CoreRef.cs:339
ButtonAssets buttonAssets
Definition: CoreRef.cs:333
Sprite spriteNoIng
Definition: CoreRef.cs:379
Definition: Core.cs:14
CoreRef refs
Definition: Core.cs:51
static new Core Instance
Definition: Core.cs:15
virtual bool AlwaysShowTooltip
Definition: InvOwner.cs:574
virtual bool ShowNew
Definition: InvOwner.cs:626
Definition: Lang.cs:6
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:172
string GetName()
Definition: Recipe.cs:760
void SetImage(Image image)
override bool CanUse(Chara c)
virtual void SetMainText(UIText t, bool hotitem)
Definition: Trait.cs:1394
virtual void OnSetCardGrid(ButtonGrid b)
Definition: Trait.cs:1022
virtual Sprite GetRefSprite()
Definition: Trait.cs:577
virtual SourceElement.Row GetRefElement()
Definition: Trait.cs:572
void SetTooltip(Action< UITooltip > onShowTooltip=null, bool enable=true)
Definition: UIButton.cs:361
UIItem AddText(string text, FontColor color=FontColor.DontChange)
Definition: UINote.cs:113
void Space(int sizeY=0, int sizeX=1)
Definition: UINote.cs:62
UINote note
Definition: UITooltip.cs:21

References Lang._weight(), UINote.AddText(), CoreRef.ButtonAssets.bgArtifact, CoreRef.ButtonAssets.bgDefault, CoreRef.ButtonAssets.bgLegendary, CoreRef.ButtonAssets.bgNew, CoreRef.ButtonAssets.bgSuperior, Card.blessedState, CoreRef.buttonAssets, Card.c_equippedSlot, Card.c_indexContainerIcon, Card.c_isImportant, TraitCatalyst.CanUse(), card, Card.ChildrenAndSelfWeight, Color, Core.config, EClass.core, Trait.GetRefElement(), Trait.GetRefSprite(), Card.GetRootCard(), SourceElement.Row.GetSprite(), Chara.held, CoreRef.icons, if(), Core.Instance, Card.invY, Card.IsContainer, Card.IsDecayed, Card.isDestroyed, Card.IsEquipmentOrRangedOrAmmo, Card.isGifted, Card.IsIdentified, Card.isNew, Card.isNPCProperty, Card.IsRotting, Card.Name, UITooltip.note, Trait.OnSetCardGrid(), EClass.pc, CoreRef.Icons.quality, Card.qualityTier, Card.rarity, Core.refs, Reset, SourceElement.Row.SetImage(), Card.SetImage(), Trait.SetMainText(), CoreConfig.Test.showRefIcon, UINote.Space(), CoreRef.spriteNoIng, CoreRef.spritesContainerIcon, CoreConfig.test, Card.trait, CoreRef.Icons.trans, and Card.WriteNote().

Referenced by InvOwnerDraglet.OnClick(), UIDragGridIngredients.Refresh(), LayerGacha.RefreshCoin(), LayerCraftFloat.RefreshDisassemble(), UIInventory.RefreshList(), WidgetSearch.RefreshList(), LayerCraft.RefreshProduct(), and LayerResource.ShowThings().

◆ SetCardGrid()

void ButtonGrid.SetCardGrid ( Card  c,
InvOwner  owner = null 
)
inline

Definition at line 145 of file ButtonGrid.cs.

146 {
147 if (owner != null)
148 {
149 invOwner = owner;
150 }
151 if (c != null && !c.isDestroyed)
152 {
153 base.interactable = true;
154 }
155 SetCard(c, Mode.Grid, delegate(UINote n)
156 {
157 invOwner?.OnWriteNote(this, n);
158 });
159 onRightClick = delegate
160 {
161 if (EClass.ui.AllowInventoryInteractions && invOwner != null)
162 {
163 InvOwner.clickTimer = 0f;
165 UIButton.onPressed = delegate
166 {
168 };
169 EInput.Consume();
171 }
172 };
173 this.SetOnClick(delegate
174 {
175 if (EClass.ui.AllowInventoryInteractions)
176 {
177 invOwner?.OnClick(this);
178 EInput.Consume();
179 UIButton.TryShowTip();
180 }
181 });
182 }
virtual void OnRightClick(ButtonGrid button)
Definition: InvOwner.cs:874
virtual void OnRightPressed(ButtonGrid button)
Definition: InvOwner.cs:886
virtual void OnWriteNote(ButtonGrid button, UINote n)
Definition: InvOwner.cs:1753
Action onRightClick
Definition: UIButton.cs:146
static void TryShowTip(Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
Definition: UIButton.cs:778
Definition: UINote.cs:6

References EInput.Consume(), Card.isDestroyed, UIButton.TryShowTip(), and EClass.ui.

Referenced by InvOwner.Transaction.Process(), WidgetCurrentTool.RebuildSlots(), UIInventory.RefreshGrid(), LayerDragGrid.SetInv(), and LayerDragGrid.Validate().

◆ SetCraftRecipe()

void ButtonGrid.SetCraftRecipe ( Recipe  r,
Mode  mode,
bool  tooltip = false 
)
inline

Definition at line 585 of file ButtonGrid.cs.

586 {
587 Reset();
588 recipe = r;
589 if (mode == Mode.Recipe)
590 {
592 }
593 else
594 {
595 mainText.SetActive(enable: false);
596 }
597 RecipeCard rCard = r as RecipeCard;
598 if (rCard != null)
599 {
600 r.SetImage(icon);
601 }
602 else
603 {
604 r.SetImage(icon);
605 }
606 if (!tooltip)
607 {
608 return;
609 }
610 SetTooltip("note", delegate(UITooltip t)
611 {
612 if (r.ingredients.Count == 0)
613 {
614 r.BuildIngredientList();
615 }
617 Dettach("recipe_new");
618 if (rCard != null)
619 {
620 if (mode == Mode.RecipeGrid && rCard._mold == null)
621 {
622 CardBlueprint.SetNormalRarity();
623 rCard._mold = ThingGen.Create(r.id);
624 }
625 rCard.Mold.WriteNote(t.note, delegate(UINote n)
626 {
627 n.Space();
628 WriteReqMat(n, r);
629 }, IInspect.NoteMode.Product, r);
630 }
631 else
632 {
633 UINote note = t.note;
634 note.Clear();
635 note.AddHeaderCard(r.GetName(), icon.sprite);
636 if (!r.GetDetail().IsEmpty())
637 {
638 note.AddText(r.GetDetail());
639 }
640 WriteReqMat(note, r);
641 t.note.Build();
642 }
643 });
644 }
void WriteReqMat(UINote n, Recipe r)
Definition: ButtonGrid.cs:646
void Dettach(string id)
Definition: ButtonGrid.cs:78
void RefreshCraftable()
Definition: ButtonGrid.cs:576
static Player player
Definition: EClass.cs:12
RecipeManager recipes
Definition: Player.cs:898
override Card Mold
Definition: RecipeCard.cs:32
Card _mold
Definition: RecipeCard.cs:18
HashSet< string > hoveredRecipes
string id
Definition: Recipe.cs:161
List< Ingredient > ingredients
Definition: Recipe.cs:164
virtual string GetDetail()
Definition: Recipe.cs:782
virtual void SetImage(Image icon)
Definition: Recipe.cs:882
TooltipData tooltip
Definition: UIButton.cs:128
UIItem AddHeaderCard(string text, Sprite sprite=null)
Definition: UINote.cs:84
void Clear()
Definition: UINote.cs:35
void Build()
Definition: UINote.cs:49
NoteMode
Definition: IInspect.cs:7

References RecipeCard._mold, UINote.AddHeaderCard(), UINote.AddText(), UINote.Build(), UINote.Clear(), Recipe.GetDetail(), Recipe.GetName(), RecipeManager.hoveredRecipes, Recipe.id, Recipe.ingredients, RecipeCard.Mold, UITooltip.note, EClass.player, Player.recipes, Reset, Recipe.SetImage(), UINote.Space(), and Card.WriteNote().

Referenced by LayerCraft.RefreshCategory(), LayerCraftFloat.RefreshCraft(), and WidgetCodex.RefreshList().

◆ SetDragParent()

virtual void ButtonGrid.SetDragParent ( IDragParent  p)
inlinevirtual

Reimplemented in ButtonGridDrag.

Definition at line 431 of file ButtonGrid.cs.

432 {
433 }

◆ SetDummy()

void ButtonGrid.SetDummy ( )
inline

Definition at line 417 of file ButtonGrid.cs.

418 {
419 Reset();
420 icon.enabled = false;
421 mainText.SetActive(enable: false);
422 base.onClick.RemoveAllListeners();
423 base.onClick.AddListener(delegate
424 {
425 SE.BeepSmall();
426 });
427 tooltip.enable = false;
428 base.image.color = new Color(1f, 1f, 1f, 0.3f);
429 }

References Color, and Reset.

Referenced by GridItem.SetButton().

◆ SetIngredient() [1/2]

void ButtonGrid.SetIngredient ( Recipe  r,
Recipe::Ingredient  _ing 
)
inline

Definition at line 435 of file ButtonGrid.cs.

436 {
437 if (_ing.id.IsEmpty())
438 {
439 SetDummy();
440 return;
441 }
442 mainText.SetActive(enable: true);
443 base.image.color = Color.white;
444 ing = _ing;
445 if (ing.thing != null && (ing.thing.isDestroyed || ing.thing.Num == 0))
446 {
447 ing.thing = null;
448 }
449 Thing thing = ing.thing;
450 SetCard(thing, Mode.Ingredient);
451 if (r != null && r.source.colorIng != 0 && r.ingredients != null && r.ingredients.Count > 0 && r.ingredients.IndexOf(_ing) == r.source.colorIng)
452 {
453 Attach("ing_color", rightAttach: false);
454 }
455 if (ing.optional)
456 {
457 UIButton componentInChildren = Attach("ing_option", rightAttach: false).GetComponentInChildren<UIButton>(includeInactive: true);
458 componentInChildren.SetActive(ing.thing != null);
459 componentInChildren.SetOnClick(delegate
460 {
461 SE.Trash();
462 ing.thing = null;
463 SetIngredient(r, _ing);
466 if ((bool)LayerCraft.Instance)
467 {
469 }
470 });
471 }
473 int num = thing?.Num ?? 0;
474 int num2 = summary.countValid;
475 if (num2 == 0)
476 {
477 num2 = 1;
478 }
479 num2 *= ing.req;
480 if (ing.optional && num == 0)
481 {
482 num2 = 0;
483 }
484 bool flag = num < num2 && !ing.optional;
485 string text = (num.ToString() ?? "").TagColor(Colors.colorIngPredict) + (" -" + num2).TagColor(flag ? Colors.colorIngCost : Colors.colorIngReq);
486 mainText.text = text;
487 if (thing == null)
488 {
489 SetTooltip("note", delegate(UITooltip tt)
490 {
491 tt.note.Clear();
492 tt.note.Space(16);
493 tt.note.AddText("mark_ing".lang() + (ing.optional ? "opIngredient" : "noIngredient").lang(_ing.GetName()), ing.optional ? FontColor.Good : FontColor.Bad);
494 tt.note.Build();
495 });
496 EClass.sources.cards.map[ing.IdThing].SetImage(icon);
497 icon.SetAlpha(0.5f);
498 }
499 else if (thing.GetRootCard() != EClass.pc)
500 {
501 Attach("pcInv", rightAttach: false);
502 }
503 }
BaseTileSelector tileSelector
void SetDummy()
Definition: ButtonGrid.cs:417
void SetIngredient(Recipe r, Recipe.Ingredient _ing)
Definition: ButtonGrid.cs:435
int Num
Definition: Card.cs:154
Color colorIngPredict
Color colorIngReq
Color colorIngCost
BaseGameScreen screen
Definition: Core.cs:67
static SourceManager sources
Definition: EClass.cs:42
int countValid
Definition: HitSummary.cs:10
void OnChangeIngredient()
Definition: LayerCraft.cs:406
static LayerCraft Instance
Definition: LayerCraft.cs:8
string GetName()
Definition: Recipe.cs:96
RecipeSource source
Definition: Recipe.cs:187
void SaveLastIngredients()
Definition: Recipe.cs:975
virtual void OnChangeIngredient()
Definition: Recipe.cs:532
Dictionary< string, CardRow > map
Definition: SourceCard.cs:8
SourceCard cards

References UINote.AddText(), UINote.Build(), SourceManager.cards, UINote.Clear(), Color, RecipeSource.colorIng, HitSummary.countValid, Card.GetRootCard(), Recipe.ingredients, Core.Instance, LayerCraft.Instance, SourceCard.map, UITooltip.note, Card.Num, LayerCraft.OnChangeIngredient(), Recipe.OnChangeIngredient(), EClass.pc, Recipe.SaveLastIngredients(), Core.screen, Recipe.source, EClass.sources, UINote.Space(), BaseTileSelector.summary, and BaseGameScreen.tileSelector.

Referenced by DropdownGrid.Activate(), and DropdownGrid.BuildIngredients().

◆ SetIngredient() [2/2]

void ButtonGrid.SetIngredient ( Recipe  r,
Thing  t 
)
inline

Definition at line 505 of file ButtonGrid.cs.

506 {
507 SetCard(t, Mode.Ingredient);
508 int num = t.Num;
509 mainText.text = num.ToString() ?? "";
510 mainText.SetActive(enable: true);
511 ing = null;
512 if (t.GetRootCard() != EClass.pc)
513 {
514 Attach("pcInv", rightAttach: false);
515 }
516 }

References Card.GetRootCard(), Card.Num, and EClass.pc.

◆ SetItem()

void ButtonGrid.SetItem ( GridItem  i)
inline

Definition at line 398 of file ButtonGrid.cs.

399 {
400 Reset();
401 mainText.SetActive(enable: true);
402 i.SetButton(this);
403 }
virtual void SetButton(ButtonGrid b)
Definition: GridItem.cs:3

References Reset, and GridItem.SetButton().

Referenced by Dialog.OnAfterInit(), WidgetHotbar.RebuildPage(), and WidgetHotbar.SetItem().

◆ SetObject()

void ButtonGrid.SetObject ( object  o)
inline

Definition at line 405 of file ButtonGrid.cs.

406 {
407 if (o is Area)
408 {
409 SetArea(o as Area);
410 }
411 else if (o is Card)
412 {
413 SetCard(o as Card);
414 }
415 }
Definition: Area.cs:4
void SetArea(Area a)
Definition: ButtonGrid.cs:390

Referenced by LayerInteraction.Show().

◆ SetRecipe() [1/3]

void ButtonGrid.SetRecipe ( )
inline

◆ SetRecipe() [2/3]

void ButtonGrid.SetRecipe ( Area  a)
inline

Definition at line 538 of file ButtonGrid.cs.

539 {
540 Reset();
541 area = a;
542 icon.sprite = Core.Instance.refs.spriteArea;
543 icon.SetNativeSize();
544 mainText.SetActive(enable: false);
545 }
Area area
Definition: ButtonGrid.cs:18
Sprite spriteArea
Definition: CoreRef.cs:377

References Core.Instance, Core.refs, Reset, and CoreRef.spriteArea.

◆ SetRecipe() [3/3]

void ButtonGrid.SetRecipe ( Recipe  r)
inline

Definition at line 547 of file ButtonGrid.cs.

548 {
549 Reset();
550 recipe = r;
551 if (r.UseStock)
552 {
553 recipe.ingredients[0].RefreshThing();
554 Thing thing = recipe.ingredients[0].thing;
555 mainText.SetText(thing.Num.ToString() ?? "", SkinManager.CurrentColors.buttonGrid);
556 if (r.VirtualBlock)
557 {
558 r.renderRow.SetImage(icon, null, r.GetDefaultColor(), setNativeSize: true, 0, thing.trait.IdSkin);
559 }
560 else
561 {
562 thing.SetImage(icon);
563 }
564 }
565 else
566 {
567 r.renderRow.SetImage(icon, null, r.GetDefaultColor(), setNativeSize: true, 0, r.idSkin);
568 }
569 mainText.SetActive(r.UseStock);
570 if (r.UseStock && r.ingredients[0].thing?.GetRootCard() != EClass.pc)
571 {
572 Attach("pcInv", rightAttach: false);
573 }
574 }
bool VirtualBlock
Definition: Recipe.cs:173
bool UseStock
Definition: Recipe.cs:167
int GetDefaultColor()
Definition: Recipe.cs:457
int idSkin
Definition: Recipe.cs:181
void SetImage(Image image, Sprite sprite=null, int matCol=0, bool setNativeSize=true, int dir=0, int idSkin=0)
Definition: RenderRow.cs:346
static SkinColorProfile CurrentColors
Definition: SkinManager.cs:84
virtual int IdSkin
Definition: Trait.cs:44

References SkinColorProfile.buttonGrid, SkinManager.CurrentColors, Recipe.GetDefaultColor(), Recipe.idSkin, Trait.IdSkin, Recipe.ingredients, Card.Num, EClass.pc, Recipe.renderRow, Reset, Card.SetImage(), RenderRow.SetImage(), Card.trait, Recipe.UseStock, and Recipe.VirtualBlock.

◆ SetRecipeVariation()

void ButtonGrid.SetRecipeVariation ( UIRecipeInfo::RecipeVariation  a)
inline

Definition at line 518 of file ButtonGrid.cs.

519 {
520 Reset();
521 Recipe recipe = a.recipe;
522 if (recipe.UseStock && !recipe.VirtualBlock && recipe.ingredients[0].thing != null)
523 {
524 recipe.ingredients[0].thing.SetImage(icon, a.dir, recipe.ingredients[0].thing.trait.IdSkin);
525 }
526 else
527 {
529 }
530 mainText.SetActive(enable: false);
531 }
Definition: Recipe.cs:7
virtual SourceMaterial.Row GetColorMaterial()
Definition: Recipe.cs:481
int GetColorInt(SourceMaterial.Row mat)
Definition: RenderRow.cs:417

References RenderRow.GetColorInt(), Recipe.GetColorMaterial(), Recipe.idSkin, Recipe.ingredients, Recipe.renderRow, Reset, RenderRow.SetImage(), Recipe.UseStock, and Recipe.VirtualBlock.

Referenced by UIRecipeInfo.Refresh().

◆ ShowMouseHintLeft()

bool ButtonGrid.ShowMouseHintLeft ( )
inline

Implements IMouseHint.

Definition at line 664 of file ButtonGrid.cs.

665 {
666 if (invOwner != null && card != null)
667 {
668 if (!invOwner.CanShiftClick(this) && !invOwner.CanCtrlClick(this))
669 {
670 return invOwner.CanAltClick(this);
671 }
672 return true;
673 }
674 return false;
675 }

References card.

◆ ShowMouseHintRight()

bool ButtonGrid.ShowMouseHintRight ( )
inline

Implements IMouseHint.

Definition at line 694 of file ButtonGrid.cs.

695 {
696 if (invOwner != null && card != null)
697 {
698 return invOwner.AllowAutouse;
699 }
700 return false;
701 }
virtual bool AllowAutouse
Definition: InvOwner.cs:558

References card.

◆ ToString()

override string ButtonGrid.ToString ( )
inline

Definition at line 53 of file ButtonGrid.cs.

54 {
55 return card?.ToString();
56 }
override string ToString()
Definition: Card.cs:2347

References card, and Card.ToString().

◆ WriteReqMat()

void ButtonGrid.WriteReqMat ( UINote  n,
Recipe  r 
)
inline

Definition at line 646 of file ButtonGrid.cs.

647 {
648 r.WriteReqFactory(n);
649 r.WriteReqSkill(n);
650 n.AddHeaderTopic("reqMat");
651 foreach (Recipe.Ingredient ingredient in r.ingredients)
652 {
653 int count = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.AroundPC).count;
654 Color c = ((count >= ingredient.req) ? SkinManager.CurrentColors.textGood : SkinManager.CurrentColors.textBad);
655 string text = "<color=" + c.ToHex() + ">" + ingredient.GetName() + " x " + ingredient.req + " (" + count + ")</color>";
656 if (ingredient.optional)
657 {
658 text = "opIngredient".lang(text);
659 }
660 n.AddText(text).text1.SetSize(-1);
661 }
662 }
StockSearchMode
static Map _map
Definition: EClass.cs:18
PropsStocked Stocked
Definition: Map.cs:121
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Definition: Props.cs:204
void WriteReqSkill(UINote n)
Definition: Recipe.cs:802
void WriteReqFactory(UINote n, bool hasFactory=true)
Definition: Recipe.cs:793
UIText text1
Definition: UIItem.cs:6
UIItem AddHeaderTopic(string text, Sprite sprite=null)
Definition: UINote.cs:89
UIText SetSize(int a)
Definition: UIText.cs:227

References EClass._map, UINote.AddHeaderTopic(), UINote.AddText(), Color, ThingStack.count, SkinManager.CurrentColors, Recipe.ingredients, Props.ListThingStack(), UIText.SetSize(), Map.Stocked, UIItem.text1, SkinColorProfile.textBad, SkinColorProfile.textGood, Recipe.WriteReqFactory(), and Recipe.WriteReqSkill().

Member Data Documentation

◆ area

Area ButtonGrid.area

Definition at line 18 of file ButtonGrid.cs.

Referenced by BuildMenu.Refresh().

◆ card

◆ index

◆ ing

Recipe.Ingredient ButtonGrid.ing

Definition at line 22 of file ButtonGrid.cs.

Referenced by DropdownGrid.TrySelect().

◆ invOwner

◆ keepBg

bool ButtonGrid.keepBg

Definition at line 30 of file ButtonGrid.cs.

◆ listAttach

List<Transform> ButtonGrid.listAttach = new List<Transform>()

Definition at line 33 of file ButtonGrid.cs.

Referenced by Attach(), and Dettach().

◆ recipe

Recipe ButtonGrid.recipe

Definition at line 20 of file ButtonGrid.cs.

Referenced by BuildMenu.Refresh(), BuildMenu.Select(), and LayerCraftFloat.Update().

◆ rightAttachCount

int ButtonGrid.rightAttachCount
private

Definition at line 35 of file ButtonGrid.cs.

Referenced by Attach().

Property Documentation

◆ Card

Card ButtonGrid.Card
get

Definition at line 39 of file ButtonGrid.cs.

40 {
41 get
42 {
43 if (card == null || card.isDestroyed)
44 {
45 return null;
46 }
47 return card;
48 }
49 }

◆ Colors

ColorProfile ButtonGrid.Colors
get

Definition at line 37 of file ButtonGrid.cs.

◆ extFixY

virtual float ButtonGrid.extFixY
get

Definition at line 51 of file ButtonGrid.cs.


The documentation for this class was generated from the following file: