Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIButton Class Reference
Inheritance diagram for UIButton:
IUISkin ButtonAbility ButtonCategory ButtonChara ButtonElement ButtonGeneral ButtonGrid ButtonResourceTrack ButtonRoster Portrait UIButtonLR

Classes

class  Item
 

Public Member Functions

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 ()
 

Static Public Member Functions

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)
 

Public Attributes

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
 

Static Public Attributes

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
 

Protected Member Functions

override void Awake ()
 
override void OnEnable ()
 
override void DoStateTransition (SelectionState state, bool instant)
 

Properties

List< Graphic > Graphics [get]
 
virtual bool CanDragLeftButton [get]
 

Private Member Functions

void ColorTween (Color targetColor, bool instant)
 

Private Attributes

List< Graphic > m_graphics
 
Tween tween
 
SelectionState lastState
 

Static Private Attributes

static bool waiting
 

Detailed Description

Definition at line 9 of file UIButton.cs.

Member Function Documentation

◆ _OnPress()

void UIButton._OnPress ( )
inline

Definition at line 493 of file UIButton.cs.

494 {
495 if (!locked && IsActive() && IsInteractable())
496 {
497 if ((bool)soundClick)
498 {
499 SoundManager.current.Play(soundClick);
500 }
501 float realtimeSinceStartup = Time.realtimeSinceStartup;
502 if (lastButton == this && onDoubleClick != null && realtimeSinceStartup - lastClicked < doubleClickTime)
503 {
505 lastButton = null;
506 }
507 else
508 {
509 lastClicked = realtimeSinceStartup;
510 lastButton = this;
511 base.onClick.Invoke();
512 }
513 }
514 }
override bool IsActive()
Definition: UIButton.cs:695
static float lastClicked
Definition: UIButton.cs:94
static UIButton lastButton
Definition: UIButton.cs:86
static float doubleClickTime
Definition: UIButton.cs:96
Action onDoubleClick
Definition: UIButton.cs:144
SoundData soundClick
Definition: UIButton.cs:130
static bool locked
Definition: UIButton.cs:84

Referenced by OnPointerDown().

◆ AddHighlight()

void UIButton.AddHighlight ( Func< bool >  killCondition)
inline

Definition at line 521 of file UIButton.cs.

522 {
523 base.gameObject.AddComponent<UIButtonHighlighter>().Set(killCondition);
524 }

◆ ApplySkin()

virtual void UIButton.ApplySkin ( )
inlinevirtual

Implements IUISkin.

Definition at line 743 of file UIButton.cs.

744 {
745 if ((bool)skinRoot)
746 {
748 base.transition = button.transition;
749 SpriteState spriteState = base.spriteState;
750 spriteState.highlightedSprite = button.spriteHighlight;
751 if (base.transition == Transition.ColorTint)
752 {
753 base.image.color = Color.white;
754 ColorBlock colorBlock = base.colors;
755 colorBlock.normalColor = button.color;
756 colorBlock.highlightedColor = button.colorHighlight;
757 base.colors = colorBlock;
758 }
759 else
760 {
761 base.image.color = button.color;
762 }
763 base.spriteState = spriteState;
764 base.image.sprite = button.spriteNormal;
765 }
766 }
virtual SkinAsset_Button GetButton()
Definition: BaseSkinRoot.cs:28
Selectable.Transition transition
BaseSkinRoot skinRoot
Definition: UIButton.cs:142

References Color, SkinAsset_Button.color, SkinAsset_Button.colorHighlight, SkinAsset_Button.spriteHighlight, SkinAsset_Button.spriteNormal, and SkinAsset_Button.transition.

Referenced by Awake().

◆ Awake()

override void UIButton.Awake ( )
inlineprotected

Definition at line 221 of file UIButton.cs.

222 {
223 if ((bool)icon)
224 {
225 originalIconScale = icon.transform.localScale;
226 }
227 if (Application.isPlaying)
228 {
229 ApplySkin();
230 }
231 base.Awake();
232 }
Image icon
Definition: UIButton.cs:110
Vector3 originalIconScale
Definition: UIButton.cs:166
virtual void ApplySkin()
Definition: UIButton.cs:743

References ApplySkin(), icon, and originalIconScale.

◆ CanMiddleClick()

virtual bool UIButton.CanMiddleClick ( )
inlinevirtual

Reimplemented in ButtonAbility, and ButtonGrid.

Definition at line 212 of file UIButton.cs.

213 {
214 return false;
215 }

Referenced by ActionMode.UpdateInput().

◆ ColorTween()

void UIButton.ColorTween ( Color  targetColor,
bool  instant 
)
inlineprivate

Definition at line 637 of file UIButton.cs.

638 {
639 if (!(base.targetGraphic == null))
640 {
641 for (int i = 0; i < Graphics.Count; i++)
642 {
643 Graphics[i].CrossFadeColor(targetColor, (!instant) ? base.colors.fadeDuration : 0f, ignoreTimeScale: true, useAlpha: true);
644 }
645 }
646 }
List< Graphic > Graphics
Definition: UIButton.cs:187

◆ DoHighlightTransition()

void UIButton.DoHighlightTransition ( bool  instant = false)
inline

◆ DoNormalTransition()

void UIButton.DoNormalTransition ( bool  instant = true)
inline

Definition at line 531 of file UIButton.cs.

532 {
533 DoStateTransition(SelectionState.Normal, instant);
534 }

Referenced by UIContextMenu.Hide(), UIDynamicList.RefreshHighlight(), UISelectableGroup.SetButton(), WidgetHotbar.SetVisible(), and UIDynamicList.UpdateRow().

◆ DoStateTransition()

override void UIButton.DoStateTransition ( SelectionState  state,
bool  instant 
)
inlineprotected

Definition at line 536 of file UIButton.cs.

537 {
538 if ((waiting && state == SelectionState.Highlighted) || !Application.isPlaying)
539 {
540 return;
541 }
542 if (!base.interactable)
543 {
544 state = SelectionState.Disabled;
545 }
546 if ((bool)highlightTarget)
547 {
548 highlightTarget.DoStateTransition(state, instant: false);
549 }
550 if (selected && !imageCheck)
551 {
552 if (state == SelectionState.Highlighted)
553 {
554 ShowTooltip();
555 }
556 state = SelectionState.Selected;
557 }
558 switch (state)
559 {
560 case SelectionState.Normal:
561 if (scaleIcon != 1f)
562 {
563 icon.transform.localScale = originalIconScale;
564 }
565 break;
566 case SelectionState.Highlighted:
567 currentHighlight = this;
568 if (lastState != SelectionState.Pressed)
569 {
570 ShowTooltip();
571 }
572 if (scaleIcon != 1f && base.interactable)
573 {
574 icon.transform.localScale = new Vector3(scaleIcon, scaleIcon, 1f);
575 }
576 if (lastState != SelectionState.Pressed && (bool)soundHighlight)
577 {
578 SoundManager.current.Play(soundHighlight);
579 }
580 break;
581 case SelectionState.Pressed:
582 if (base.transition == Transition.SpriteSwap && base.spriteState.pressedSprite == null)
583 {
584 SpriteState spriteState = base.spriteState;
585 spriteState.pressedSprite = spriteState.highlightedSprite;
586 base.spriteState = spriteState;
587 }
588 if (scaleIcon != 1f)
589 {
590 icon.transform.localScale = new Vector3(scaleIcon, scaleIcon, 1f) * 0.9f;
591 buttons.Add(this);
592 }
593 if ((bool)animeHold)
594 {
595 if (tween == null)
596 {
597 tween = animeHold.Play(animeTarget ? animeTarget : base.transform).SetAutoKill(autoKillOnCompletion: false);
598 }
599 else
600 {
601 tween.Restart();
602 }
603 animating = true;
604 buttons.Add(this);
605 }
606 break;
607 default:
608 if (scaleIcon != 1f)
609 {
610 icon.transform.localScale = originalIconScale;
611 }
612 if ((bool)animeHold && tween != null && !Input.GetMouseButton(0))
613 {
614 tween.PlayBackwards();
615 animating = false;
616 }
617 break;
618 case SelectionState.Disabled:
619 break;
620 }
621 lastState = state;
622 if (base.transition != Transition.ColorTint)
623 {
624 base.DoStateTransition(state, instant);
625 return;
626 }
627 ColorTween(state switch
628 {
629 SelectionState.Normal => base.colors.normalColor,
630 SelectionState.Highlighted => base.colors.highlightedColor,
631 SelectionState.Pressed => base.colors.pressedColor,
632 SelectionState.Disabled => base.colors.disabledColor,
633 _ => Color.white,
634 } * base.colors.colorMultiplier, instant);
635 }
virtual Tween Play(Transform trans, UnityAction onComplete=null, float duration=-1f, float delay=0f)
Definition: Anime.cs:7
static UIButton currentHighlight
Definition: UIButton.cs:90
bool animating
Definition: UIButton.cs:160
SoundData soundHighlight
Definition: UIButton.cs:132
Image imageCheck
Definition: UIButton.cs:112
static List< UIButton > buttons
Definition: UIButton.cs:182
Tween tween
Definition: UIButton.cs:176
static bool waiting
Definition: UIButton.cs:180
Transform animeTarget
Definition: UIButton.cs:134
SelectionState lastState
Definition: UIButton.cs:178
Anime animeHold
Definition: UIButton.cs:138
UIButton highlightTarget
Definition: UIButton.cs:169
bool selected
Definition: UIButton.cs:163
virtual void ShowTooltip()
Definition: UIButton.cs:379
void ColorTween(Color targetColor, bool instant)
Definition: UIButton.cs:637
float scaleIcon
Definition: UIButton.cs:116

References Color.

◆ FindSelectableOnDown()

override Selectable UIButton.FindSelectableOnDown ( )
inline

Definition at line 648 of file UIButton.cs.

649 {
650 if (base.navigation.selectOnDown != null)
651 {
652 return base.FindSelectableOnDown();
653 }
654 return FindSelectable(Quaternion.Euler(0f, 0f, navigationFix) * Vector3.down);
655 }
float navigationFix
Definition: UIButton.cs:120

◆ FindSelectableOnLeft()

override Selectable UIButton.FindSelectableOnLeft ( )
inline

Definition at line 666 of file UIButton.cs.

667 {
668 if (base.navigation.selectOnLeft != null)
669 {
670 return base.FindSelectableOnLeft();
671 }
672 return FindSelectable(Quaternion.Euler(0f, 0f, navigationFix) * Vector3.left);
673 }

◆ FindSelectableOnRight()

override Selectable UIButton.FindSelectableOnRight ( )
inline

Definition at line 675 of file UIButton.cs.

676 {
677 if (base.navigation.selectOnRight != null)
678 {
679 return base.FindSelectableOnRight();
680 }
681 return FindSelectable(Quaternion.Euler(0f, 0f, navigationFix) * Vector3.right);
682 }

◆ FindSelectableOnUp()

override Selectable UIButton.FindSelectableOnUp ( )
inline

Definition at line 657 of file UIButton.cs.

658 {
659 if (base.navigation.selectOnUp != null)
660 {
661 return base.FindSelectableOnUp();
662 }
663 return FindSelectable(Quaternion.Euler(0f, 0f, navigationFix) * Vector3.up);
664 }

◆ IsActive()

override bool UIButton.IsActive ( )
inline

Definition at line 695 of file UIButton.cs.

696 {
697 if (IsDestroyed())
698 {
699 return false;
700 }
701 return base.IsActive();
702 }

◆ OnEnable()

override void UIButton.OnEnable ( )
inlineprotected

Definition at line 234 of file UIButton.cs.

235 {
236 selected = false;
237 base.OnEnable();
238 if (!EventSystem.current)
239 {
240 return;
241 }
242 if ((bool)imageCheck)
243 {
244 imageCheck.gameObject.SetActive(isChecked);
245 }
246 if (EventSystem.current.currentSelectedGameObject == base.gameObject)
247 {
248 if (base.transition == Transition.SpriteSwap && base.spriteState.highlightedSprite != base.image.sprite)
249 {
251 }
252 if ((bool)icon)
253 {
254 icon.transform.localScale = new Vector3(scaleIcon, scaleIcon, 1f);
255 }
256 }
257 }
void DoHighlightTransition(bool instant=false)
Definition: UIButton.cs:526
bool isChecked
Definition: UIButton.cs:122

References DoHighlightTransition(), icon, imageCheck, isChecked, scaleIcon, and selected.

◆ OnHover()

virtual void UIButton.OnHover ( )
inlinevirtual

Reimplemented in ButtonHotItem.

Definition at line 312 of file UIButton.cs.

313 {
314 if ((!(UIContextMenu.timeSinceClosed < 0.1f) || !(lastHovered == this)) && item != null && !Input.GetMouseButton(0) && !Input.GetMouseButton(1))
315 {
316 buttonPos = base.transform.position;
317 item.OnHover(this);
318 lastHovered = this;
319 }
320 }
virtual void OnHover(UIButton b)
Definition: UIButton.cs:64
static UIButton lastHovered
Definition: UIButton.cs:88
static Vector2 buttonPos
Definition: UIButton.cs:98
Item item
Definition: UIButton.cs:172
static float timeSinceClosed

References buttonPos, item, lastHovered, UIButton.Item.OnHover(), and UIContextMenu.timeSinceClosed.

◆ OnMiddleClick()

virtual void UIButton.OnMiddleClick ( bool  forceClick)
inlinevirtual

Reimplemented in ButtonAbility, and ButtonGrid.

Definition at line 217 of file UIButton.cs.

218 {
219 }

Referenced by ActionMode.UpdateInput().

◆ OnPointerClick()

override void UIButton.OnPointerClick ( PointerEventData  eventData)
inline

Definition at line 446 of file UIButton.cs.

447 {
449 onPressed = null;
450 if (eventData.dragging || instantClick)
451 {
452 return;
453 }
454 waiting = true;
456 {
458 {
459 waiting = false;
460 });
461 if (EInput.skipFrame <= 0)
462 {
463 if (eventData.button != 0)
464 {
465 if (eventData.button == PointerEventData.InputButton.Right && onRightClick != null && !EInput.rightMouse.wasConsumed)
466 {
467 onRightClick();
468 }
469 }
470 else
471 {
472 _OnPress();
473 }
474 }
475 });
476 }
void WaitForEndOfFrame(Action action)
Definition: BaseCore.cs:61
static BaseCore Instance
Definition: BaseCore.cs:11
Definition: EInput.cs:8
static int skipFrame
Definition: EInput.cs:287
bool instantClick
Definition: UIButton.cs:124
static Action onPressed
Definition: UIButton.cs:100
static UIButton currentPressedButton
Definition: UIButton.cs:92

References currentPressedButton, BaseCore.Instance, instantClick, onPressed, EInput.skipFrame, BaseCore.WaitForEndOfFrame(), and waiting.

◆ OnPointerDown()

override void UIButton.OnPointerDown ( PointerEventData  eventData)
inline

Definition at line 395 of file UIButton.cs.

396 {
398 if (!instantClick)
399 {
400 base.OnPointerDown(eventData);
401 }
402 else
403 {
404 if (EInput.IsConsumed)
405 {
406 return;
407 }
408 if (eventData.button != 0)
409 {
410 if (eventData.button == PointerEventData.InputButton.Right && onRightClick != null && !EInput.rightMouse.wasConsumed)
411 {
413 {
414 onRightClick();
415 });
416 }
417 return;
418 }
419 waiting = true;
421 {
423 {
424 waiting = false;
425 });
426 if (EInput.skipFrame <= 0)
427 {
428 if ((bool)animeClick)
429 {
430 EventSystem.current.enabled = false;
431 animeClick.Play(animeTarget ? animeTarget : base.transform).OnComplete(delegate
432 {
433 OnPress();
434 EventSystem.current.enabled = true;
435 });
436 }
437 else
438 {
439 _OnPress();
440 }
441 }
442 });
443 }
444 }
bool wasConsumed
Definition: ButtonState.cs:51
static bool IsConsumed
Definition: EInput.cs:393
static ButtonState rightMouse
Definition: EInput.cs:351
Anime animeClick
Definition: UIButton.cs:136
void OnPress()
Definition: UIButton.cs:516
override void OnPointerDown(PointerEventData eventData)
Definition: UIButton.cs:395
Action onRightClick
Definition: UIButton.cs:146
void _OnPress()
Definition: UIButton.cs:493

References _OnPress(), animeClick, animeTarget, currentPressedButton, BaseCore.Instance, instantClick, EInput.IsConsumed, OnPointerDown(), OnPress(), onRightClick, Anime.Play(), EInput.rightMouse, EInput.skipFrame, BaseCore.WaitForEndOfFrame(), waiting, and ButtonState.wasConsumed.

Referenced by OnPointerDown().

◆ OnPointerUp()

override void UIButton.OnPointerUp ( PointerEventData  eventData)
inline

Definition at line 478 of file UIButton.cs.

479 {
481 onPressed = null;
482 if (!instantClick)
483 {
484 base.OnPointerUp(eventData);
485 }
486 }

◆ OnPointerUpOnDrag()

void UIButton.OnPointerUpOnDrag ( PointerEventData  eventData)
inline

Definition at line 488 of file UIButton.cs.

489 {
490 base.OnPointerUp(eventData);
491 }

Referenced by ButtonAbility.OnDrag(), and ButtonGridDrag.OnDrag().

◆ OnPress()

void UIButton.OnPress ( )
inline

Definition at line 516 of file UIButton.cs.

517 {
518 Invoke("_OnPress", 0.01f);
519 }

Referenced by OnPointerDown().

◆ RefreshItem()

virtual void UIButton.RefreshItem ( )
inlinevirtual

Reimplemented in ButtonHotItem.

Definition at line 269 of file UIButton.cs.

270 {
271 bool flag = item != null;
272 base.onClick.RemoveAllListeners();
273 icon.enabled = flag;
274 base.interactable = flag;
275 if (flag && item.Hidden)
276 {
277 icon.enabled = false;
278 base.interactable = false;
279 }
280 base.transition = item?.Transition ?? Transition.SpriteSwap;
281 if (flag)
282 {
283 icon.sprite = item.GetSprite();
284 base.onClick.AddListener(delegate
285 {
286 buttonPos = base.transform.position;
287 item.OnClick(this);
288 EInput.Consume(0);
289 });
290 icon.transform.localScale = item.SpriteScale;
292 {
293 icon.SetNativeSize();
294 }
295 else
296 {
297 icon.Rect().sizeDelta = new Vector2(48f, 48f);
298 }
299 tooltip.enable = !item.TextTip.IsEmpty();
300 tooltip.onShowTooltip = delegate(UITooltip t)
301 {
302 string textTip = item.TextTip;
303 t.textMain.text = textTip;
304 };
305 if ((bool)subText)
306 {
308 }
309 }
310 }
static void Consume(int _skipFrame)
Definition: EInput.cs:656
virtual void OnClick(UIButton b)
Definition: UIButton.cs:68
virtual bool Hidden
Definition: UIButton.cs:37
virtual Vector3 SpriteScale
Definition: UIButton.cs:35
virtual Transition Transition
Definition: UIButton.cs:39
virtual Sprite GetSprite()
Definition: UIButton.cs:41
virtual void SetSubText(UIText t)
Definition: UIButton.cs:76
virtual string TextTip
Definition: UIButton.cs:17
virtual bool AdjustImageSize
Definition: UIButton.cs:27
UIText subText
Definition: UIButton.cs:104

References UIButton.Item.AdjustImageSize, buttonPos, EInput.Consume(), UIButton.Item.GetSprite(), UIButton.Item.Hidden, icon, item, UIButton.Item.OnClick(), UIButton.Item.SetSubText(), UIButton.Item.SpriteScale, subText, UIButton.Item.TextTip, and UIButton.Item.Transition.

Referenced by SetItem().

◆ SetCheck()

void UIButton.SetCheck ( bool  check)
inline

Definition at line 332 of file UIButton.cs.

333 {
334 isChecked = check;
335 if ((bool)imageCheck)
336 {
337 imageCheck.gameObject.SetActive(isChecked);
338 }
339 }

References imageCheck, and isChecked.

Referenced by AM_Copy.OnSetSubMenuButton(), AM_Deconstruct.OnSetSubMenuButton(), UISelectableGroup.Select(), SetToggle(), LayerResource.ShowThings(), and ToggleCheck().

◆ SetInteractableWithAlpha()

void UIButton.SetInteractableWithAlpha ( bool  enable)
inline

Definition at line 732 of file UIButton.cs.

733 {
734 CanvasGroup canvasGroup = base.gameObject.GetComponent<CanvasGroup>();
735 if (!canvasGroup)
736 {
737 canvasGroup = base.gameObject.AddComponent<CanvasGroup>();
738 }
739 canvasGroup.alpha = (enable ? 1f : 0.5f);
740 base.interactable = enable;
741 }

Referenced by LayerUploader.Update().

◆ SetItem()

void UIButton.SetItem ( Item  i)
inline

Definition at line 259 of file UIButton.cs.

260 {
261 item = i;
262 RefreshItem();
263 if (item != null)
264 {
265 item.OnSetItem(this);
266 }
267 }
virtual void OnSetItem(UIButton b)
Definition: UIButton.cs:72
virtual void RefreshItem()
Definition: UIButton.cs:269

References item, UIButton.Item.OnSetItem(), and RefreshItem().

Referenced by WidgetMinimap.OnActivate().

◆ SetNavigation()

void UIButton.SetNavigation ( UIButton  up,
UIButton  down = null,
UIButton  left = null,
UIButton  right = null 
)
inline

Definition at line 684 of file UIButton.cs.

685 {
686 Navigation navigation = base.navigation;
687 navigation.mode = Navigation.Mode.Explicit;
688 navigation.selectOnUp = up;
689 navigation.selectOnDown = down;
690 navigation.selectOnLeft = left;
691 navigation.selectOnRight = right;
692 base.navigation = navigation;
693 }

References down, left, right, and up.

◆ SetToggle()

void UIButton.SetToggle ( bool  isOn,
Action< bool >  onToggle = null 
)
inline

◆ SetToggleWithScore()

void UIButton.SetToggleWithScore ( bool  isOn,
Action< bool >  onToggle,
int?  score 
)
inline

Definition at line 355 of file UIButton.cs.

356 {
357 SetToggle(isOn, onToggle);
358 subText.SetActive(enable: false);
359 }
void SetToggle(bool isOn, Action< bool > onToggle=null)
Definition: UIButton.cs:341

References SetToggle(), and subText.

◆ SetTooltip() [1/2]

◆ SetTooltip() [2/2]

void UIButton.SetTooltip ( string  id,
Action< UITooltip onShowTooltip = null,
bool  enable = true 
)
inline

Definition at line 366 of file UIButton.cs.

367 {
368 tooltip.id = id;
369 tooltip.enable = enable;
370 tooltip.onShowTooltip = onShowTooltip;
371 }

◆ SetTooltipLang()

void UIButton.SetTooltipLang ( string  lang = null)
inline

Definition at line 373 of file UIButton.cs.

374 {
375 tooltip.enable = true;
376 tooltip.lang = lang;
377 }

Referenced by LayerWorldSetting.Refresh(), UIInventory.RefreshMenu(), and LayerDragGrid.SetInv().

◆ ShowTooltip()

virtual void UIButton.ShowTooltip ( )
inlinevirtual

Definition at line 379 of file UIButton.cs.

380 {
381 if (tooltip.enable && !Input.GetMouseButton(0) && !waiting && !Input.GetMouseButton(1) && (!EInput.isShiftDown || !Input.GetMouseButton(0)))
382 {
384 }
385 }
static bool isShiftDown
Definition: EInput.cs:261
bool enable
Definition: TooltipData.cs:7
void ShowTooltip(TooltipData data, Transform target)
static TooltipManager Instance
TooltipData tooltip
Definition: UIButton.cs:128

References TooltipData.enable, TooltipManager.Instance, EInput.isShiftDown, TooltipManager.ShowTooltip(), tooltip, and waiting.

Referenced by DropdownGrid.TrySelect().

◆ ShowTooltipForced()

void UIButton.ShowTooltipForced ( bool  ignoreWhenRightClick = true)
inline

Definition at line 387 of file UIButton.cs.

388 {
389 if (tooltip.enable && (!ignoreWhenRightClick || !Input.GetMouseButton(1)) && (!EInput.isShiftDown || !Input.GetMouseButton(0)))
390 {
392 }
393 }

References TooltipData.enable, TooltipManager.Instance, EInput.isShiftDown, TooltipManager.ShowTooltip(), and tooltip.

Referenced by UICharaMaker.ListJob(), and UICharaMaker.ListRace().

◆ Toggle()

void UIButton.Toggle ( )
inline

Definition at line 322 of file UIButton.cs.

323 {
324 group.Select(this, !isChecked);
325 }
UISelectableGroup group
Definition: UIButton.cs:126
void Select(UIButton button, bool check=true)

References group, isChecked, and UISelectableGroup.Select().

Referenced by UISelectableGroup.SetGroup().

◆ ToggleCheck()

void UIButton.ToggleCheck ( )
inline

Definition at line 327 of file UIButton.cs.

328 {
330 }

References isChecked, and SetCheck().

◆ TryHihlight()

static void UIButton.TryHihlight ( )
inlinestatic

Definition at line 768 of file UIButton.cs.

769 {
771 UIButton componentOf = InputModuleEX.GetComponentOf<UIButton>();
772 if ((bool)componentOf)
773 {
774 componentOf.DoHighlightTransition();
775 }
776 }
static void UpdateEventData()

References DoHighlightTransition(), and InputModuleEX.UpdateEventData().

Referenced by UI.FreezeScreen(), UIDynamicList.List(), and DramaActor.Talk().

◆ TryShowTip()

static void UIButton.TryShowTip ( Transform  root = null,
bool  highlight = true,
bool  ignoreWhenRightClick = true 
)
inlinestatic

◆ TryShowTip< T >()

static void UIButton.TryShowTip< T > ( Transform  root = null,
bool  highlight = true,
bool  ignoreWhenRightClick = true 
)
inlinestatic
Type Constraints
T :UIButton 

Definition at line 783 of file UIButton.cs.

783 : UIButton
784 {
785 actionTooltip = delegate
786 {
788 T componentOf = InputModuleEX.GetComponentOf<T>();
789 if ((bool)componentOf && componentOf.tooltip.enable)
790 {
792 if ((bool)componentOf && (root == null || componentOf.transform.IsChildOf(root)))
793 {
794 if (highlight)
795 {
796 componentOf.DoHighlightTransition();
797 }
798 try
799 {
800 componentOf.ShowTooltipForced(ignoreWhenRightClick);
801 }
802 catch
803 {
804 }
805 }
806 }
807 };
808 }
void HideTooltips(bool immediate=false)
static Action actionTooltip
Definition: UIButton.cs:184

References TooltipManager.HideTooltips(), TooltipManager.Instance, and InputModuleEX.UpdateEventData().

◆ UpdateButtons()

static void UIButton.UpdateButtons ( )
inlinestatic

Definition at line 704 of file UIButton.cs.

705 {
706 if ((bool)currentPressedButton && onPressed != null)
707 {
708 onPressed();
709 }
710 if (Input.GetMouseButton(0) || buttons.Count == 0)
711 {
712 return;
713 }
714 foreach (UIButton button in buttons)
715 {
716 if ((bool)button && (bool)button.gameObject)
717 {
718 if (button.animating)
719 {
720 button.tween.PlayBackwards();
721 button.animating = false;
722 }
723 if ((bool)button.icon && button.scaleIcon != 1f)
724 {
725 button.icon.transform.localScale = button.originalIconScale;
726 }
727 }
728 }
729 buttons.Clear();
730 }

References animating, icon, originalIconScale, scaleIcon, and tween.

Referenced by Scene.OnUpdate().

Member Data Documentation

◆ actionTooltip

Action UIButton.actionTooltip
static

Definition at line 184 of file UIButton.cs.

Referenced by Core.LateUpdate().

◆ animating

bool UIButton.animating

Definition at line 160 of file UIButton.cs.

Referenced by UpdateButtons().

◆ animeClick

Anime UIButton.animeClick

Definition at line 136 of file UIButton.cs.

Referenced by OnPointerDown().

◆ animeHold

Anime UIButton.animeHold

Definition at line 138 of file UIButton.cs.

◆ animeTarget

Transform UIButton.animeTarget

Definition at line 134 of file UIButton.cs.

Referenced by OnPointerDown().

◆ buttonPos

Vector2 UIButton.buttonPos
static

Definition at line 98 of file UIButton.cs.

Referenced by HotItemContext.OnClick(), OnHover(), and RefreshItem().

◆ buttons

List<UIButton> UIButton.buttons = new List<UIButton>()
static

Definition at line 182 of file UIButton.cs.

Referenced by WidgetHotbar.GetSwapButton(), and WidgetHotbar.RefreshButtons().

◆ buttonType

ButtonType UIButton.buttonType

Definition at line 140 of file UIButton.cs.

◆ currentHighlight

UIButton UIButton.currentHighlight
static

Definition at line 90 of file UIButton.cs.

Referenced by UI.ShowMouseHint().

◆ currentPressedButton

UIButton UIButton.currentPressedButton
static

Definition at line 92 of file UIButton.cs.

Referenced by OnPointerClick(), and OnPointerDown().

◆ DoSlide

bool UIButton.DoSlide
static

Definition at line 82 of file UIButton.cs.

◆ doubleClickTime

float UIButton.doubleClickTime = 0.4f
static

Definition at line 96 of file UIButton.cs.

◆ group

UISelectableGroup UIButton.group

Definition at line 126 of file UIButton.cs.

Referenced by UIList.Select(), and Toggle().

◆ highlightTarget

UIButton UIButton.highlightTarget

Definition at line 169 of file UIButton.cs.

◆ icon

◆ imageCheck

Image UIButton.imageCheck

◆ instantClick

bool UIButton.instantClick = true

Definition at line 124 of file UIButton.cs.

Referenced by OnPointerClick(), OnPointerDown(), and ButtonHotItem.RefreshItem().

◆ isChecked

bool UIButton.isChecked

Definition at line 122 of file UIButton.cs.

Referenced by OnEnable(), SetCheck(), SetToggle(), Toggle(), and ToggleCheck().

◆ item

◆ keyText

UIText UIButton.keyText

◆ lastButton

UIButton UIButton.lastButton
static

Definition at line 86 of file UIButton.cs.

◆ lastClicked

float UIButton.lastClicked
static

Definition at line 94 of file UIButton.cs.

◆ lastHovered

UIButton UIButton.lastHovered
static

Definition at line 88 of file UIButton.cs.

Referenced by OnHover().

◆ lastState

SelectionState UIButton.lastState
private

Definition at line 178 of file UIButton.cs.

◆ locked

bool UIButton.locked
static

Definition at line 84 of file UIButton.cs.

◆ m_graphics

List<Graphic> UIButton.m_graphics
private

Definition at line 174 of file UIButton.cs.

◆ mainText

◆ navigationFix

float UIButton.navigationFix

Definition at line 120 of file UIButton.cs.

◆ onDoubleClick

Action UIButton.onDoubleClick

Definition at line 144 of file UIButton.cs.

◆ onInputWheel

Action<int> UIButton.onInputWheel

Definition at line 148 of file UIButton.cs.

Referenced by Scene.OnUpdate().

◆ onPressed

Action UIButton.onPressed
static

Definition at line 100 of file UIButton.cs.

Referenced by OnPointerClick().

◆ onRightClick

◆ originalIconScale

Vector3 UIButton.originalIconScale = Vector3.one

Definition at line 166 of file UIButton.cs.

Referenced by Awake(), and UpdateButtons().

◆ refInt

int UIButton.refInt

Definition at line 154 of file UIButton.cs.

◆ refObj

object UIButton.refObj

Definition at line 151 of file UIButton.cs.

◆ refStr

string UIButton.refStr

Definition at line 157 of file UIButton.cs.

◆ scaleIcon

float UIButton.scaleIcon = 1f

Definition at line 116 of file UIButton.cs.

Referenced by OnEnable(), and UpdateButtons().

◆ selected

bool UIButton.selected

Definition at line 163 of file UIButton.cs.

Referenced by OnEnable(), UIDynamicList.RefreshHighlight(), and UIDynamicList.UpdateRow().

◆ skinRoot

BaseSkinRoot UIButton.skinRoot

◆ slideX

float UIButton.slideX

Definition at line 118 of file UIButton.cs.

◆ soundClick

SoundData UIButton.soundClick

Definition at line 130 of file UIButton.cs.

Referenced by DramaEventTalk.Play().

◆ soundHighlight

SoundData UIButton.soundHighlight

Definition at line 132 of file UIButton.cs.

◆ subText

◆ subText2

◆ targetGraphics

Graphic [] UIButton.targetGraphics

Definition at line 114 of file UIButton.cs.

◆ tooltip

TooltipData UIButton.tooltip

Definition at line 128 of file UIButton.cs.

Referenced by ShowTooltip(), and ShowTooltipForced().

◆ tween

Tween UIButton.tween
private

Definition at line 176 of file UIButton.cs.

Referenced by UpdateButtons().

◆ waiting

bool UIButton.waiting
staticprivate

Definition at line 180 of file UIButton.cs.

Referenced by OnPointerClick(), OnPointerDown(), and ShowTooltip().

Property Documentation

◆ CanDragLeftButton

virtual bool UIButton.CanDragLeftButton
get

Definition at line 210 of file UIButton.cs.

Referenced by ButtonGridDrag.OnDrag().

◆ Graphics

List<Graphic> UIButton.Graphics
getprotected

Definition at line 186 of file UIButton.cs.

187 {
188 get
189 {
190 if (m_graphics == null)
191 {
192 m_graphics = new List<Graphic>();
193 if (base.targetGraphic != null)
194 {
195 m_graphics.Add(base.targetGraphic);
196 }
197 if (targetGraphics != null)
198 {
199 Graphic[] array = targetGraphics;
200 foreach (Graphic graphic in array)
201 {
202 m_graphics.Add(graphic);
203 }
204 }
205 }
206 return m_graphics;
207 }
208 }
Graphic[] targetGraphics
Definition: UIButton.cs:114
List< Graphic > m_graphics
Definition: UIButton.cs:174

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