Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
UIContextMenu Class Reference
Inheritance diagram for UIContextMenu:

Public Member Functions

void OnPointerEnter (PointerEventData data)
 
void OnPointerExit (PointerEventData data)
 
void Show (UIItem i)
 
void Show (UIButton b)
 
void Show (Vector2 pos)
 
void Show ()
 
void Hide ()
 
void ClearItems ()
 
void AddSeparator (int index=0)
 
void AddButton (Func< string > funcText, UnityAction action=null)
 
UIButton AddButton (string idLang="", Action action=null, bool hideAfter=true)
 
UIContextMenuItem AddToggle (string idLang="", bool isOn=false, UnityAction< bool > action=null)
 
UIContextMenuItem AddSlider (string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
 
UIContextMenuItem AddSlider (string id, string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
 
UIContextMenuItem AddSlider (UIContextMenuItem item, string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)
 
GridLayoutGroup AddGridLayout ()
 
GridLayoutGroup AddGridLayout (string id)
 
AddGameObject< T > (T c)
 
AddGameObject< T > (string id)
 
UIContextMenu AddOrGetChild (string idLang="Child")
 
UIContextMenu AddChild (string idLang, TextAnchor anchor)
 
UIContextMenu AddChild (string idLang="Child")
 
UIContextMenu SetHighlightTarget (UIItem i)
 
UIContextMenu SetHighlightTarget (UIButton t)
 

Public Attributes

UIContextMenuItem defaultButton
 
UIContextMenuPopper defaultPopper
 
UIContextMenuItem defaultToggle
 
UIContextMenuItem defaultSlider
 
GridLayoutGroup defaultGridLayout
 
Transform logo
 
CanvasGroup cg
 
GameObject[] separators
 
Action onDestroy
 
Action onUpdate
 
UIContextMenuPopper popper
 
bool destroyOnHide
 
bool wasCanceled
 
Material matBlur
 
bool system
 
bool alwaysPopLeft
 
Image bg
 
SoundData soundPop
 
Vector2 margin
 
Vector2 fixPos
 
UIButton highlightTarget
 
bool hideOnMouseLeave
 
VerticalLayoutGroup layoutGroup
 
RectTransform _rect
 
bool isPointerOver
 
int depth
 
UIContextMenu parent
 
float timeSinceOpen
 
float timeSincePointerLeft
 
float updatesSinceOpen
 
bool isDestroyed
 

Static Public Attributes

static UIContextMenu Current
 
static float timeSinceClosed
 
static bool closeOnMouseLeave
 

Properties

bool isChild [get]
 
UIContextMenu Root [get]
 

Private Member Functions

void Awake ()
 
void Update ()
 
void LateUpdate ()
 
void PositionMenu ()
 

Private Attributes

Vector2 showPos
 

Detailed Description

Definition at line 8 of file UIContextMenu.cs.

Member Function Documentation

◆ AddButton() [1/2]

void UIContextMenu.AddButton ( Func< string >  funcText,
UnityAction  action = null 
)
inline

Definition at line 273 of file UIContextMenu.cs.

274 {
275 UIContextMenuItem item = UnityEngine.Object.Instantiate(defaultButton);
276 item.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
277 item.textName.text = funcText();
278 Button button = item.button;
279 if (action != null)
280 {
281 button.onClick.AddListener(action);
282 }
283 button.onClick.AddListener(delegate
284 {
285 if ((bool)item)
286 {
287 item.textName.text = funcText();
288 }
289 });
290 }
VerticalLayoutGroup layoutGroup
UIContextMenuItem defaultButton

References Button, defaultButton, item, and layoutGroup.

Referenced by BaseListPeople.OnClick(), ListPeopleExpedition.OnClick(), LayerAbility.OnInit(), LayerMod.OnInit(), AM_EditArea.OnProcessTiles(), AM_MoveInstalled.OnProcessTiles(), WidgetHotbar.OnSetContextMenu(), WidgetMainText.OnSetContextMenu(), WidgetRoster.OnSetContextMenu(), WidgetSideScreen.OnSetContextMenu(), WidgetTracker.OnSetContextMenu(), HotAction.OnShowContextMenu(), HotItemEQSet.OnShowContextMenu(), HotItemLayout.OnShowContextMenu(), HotItemWidgetSet.OnShowContextMenu(), LayerSkinDeco.OnUpdateInput(), ItemCulture.Refresh(), UIInventory.RefreshMenu(), Widget.SetBaseContextMenu(), Widget.SetGridContextMenu(), WidgetHotbar.SetShortcutMenu(), HotItemContext.Show(), InvOwner.ShowContextMenu(), Thing.ShowSplitMenu(), Thing.ShowSplitMenu2(), TraitBed.TrySetAct(), and LayerTextureViewer.Update().

◆ AddButton() [2/2]

UIButton UIContextMenu.AddButton ( string  idLang = "",
Action  action = null,
bool  hideAfter = true 
)
inline

Definition at line 292 of file UIContextMenu.cs.

293 {
294 UIContextMenuItem uIContextMenuItem = UnityEngine.Object.Instantiate(defaultButton);
295 uIContextMenuItem.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
296 uIContextMenuItem.textName.text = Lang.Get(idLang);
297 UIButton uIButton = uIContextMenuItem.button as UIButton;
298 if (hideAfter)
299 {
300 uIButton.onClick.AddListener(Hide);
301 }
302 if ((bool)popper && hideAfter)
303 {
304 uIButton.onClick.AddListener(popper.parent.Hide);
305 }
306 if (action != null)
307 {
308 uIButton.onClick.AddListener(delegate
309 {
310 action();
311 });
312 }
313 return uIButton;
314 }
Definition: Hide.cs:4
Definition: Lang.cs:6
static string Get(string id)
Definition: Lang.cs:91
UIContextMenuPopper popper

References defaultButton, Lang.Get(), Hide(), layoutGroup, UIContextMenuPopper.parent, and popper.

◆ AddChild() [1/2]

◆ AddChild() [2/2]

UIContextMenu UIContextMenu.AddChild ( string  idLang = "Child")
inline

Definition at line 503 of file UIContextMenu.cs.

504 {
505 UIContextMenuPopper uIContextMenuPopper = UnityEngine.Object.Instantiate(defaultPopper);
506 uIContextMenuPopper.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
507 uIContextMenuPopper.textName.text = Lang.Get(idLang);
508 uIContextMenuPopper.parent = this;
509 uIContextMenuPopper.id = idLang;
510 UIContextMenu uIContextMenu = uIContextMenuPopper.CreateMenu();
511 uIContextMenu.alwaysPopLeft = alwaysPopLeft;
512 uIContextMenu.ClearItems();
513 uIContextMenuPopper.button.onClick.RemoveAllListeners();
514 return uIContextMenuPopper.menu;
515 }
UIContextMenu CreateMenu()
UIContextMenuPopper defaultPopper

References alwaysPopLeft, UIContextMenuItem.button, ClearItems(), UIContextMenuPopper.CreateMenu(), defaultPopper, Lang.Get(), layoutGroup, and UIContextMenuPopper.menu.

◆ AddGameObject< T >() [1/2]

T UIContextMenu.AddGameObject< T > ( string  id)
inline
Type Constraints
T :Component 

Definition at line 479 of file UIContextMenu.cs.

479 : Component
480 {
481 return Util.Instantiate<T>("Items/" + id, layoutGroup);
482 }
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References layoutGroup, and Util.

◆ AddGameObject< T >() [2/2]

T UIContextMenu.AddGameObject< T > ( c)
inline
Type Constraints
T :Component 

Definition at line 473 of file UIContextMenu.cs.

473 : Component
474 {
475 c.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
476 return c;
477 }

References layoutGroup.

◆ AddGridLayout() [1/2]

GridLayoutGroup UIContextMenu.AddGridLayout ( )
inline

Definition at line 461 of file UIContextMenu.cs.

462 {
463 GridLayoutGroup gridLayoutGroup = UnityEngine.Object.Instantiate(defaultGridLayout);
464 gridLayoutGroup.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
465 return gridLayoutGroup;
466 }
GridLayoutGroup defaultGridLayout

References defaultGridLayout, and layoutGroup.

Referenced by UIInventory.RefreshMenu(), UIInventory.ShowDistribution(), and TraitMapBoard.TrySetAct().

◆ AddGridLayout() [2/2]

GridLayoutGroup UIContextMenu.AddGridLayout ( string  id)
inline

Definition at line 468 of file UIContextMenu.cs.

469 {
470 return Util.Instantiate<GridLayoutGroup>("Items/" + id, layoutGroup);
471 }

References layoutGroup, and Util.

◆ AddOrGetChild()

UIContextMenu UIContextMenu.AddOrGetChild ( string  idLang = "Child")
inline

Definition at line 484 of file UIContextMenu.cs.

485 {
486 foreach (UIContextMenuPopper componentsInDirectChild in base.transform.GetComponentsInDirectChildren<UIContextMenuPopper>())
487 {
488 if (componentsInDirectChild.id == idLang)
489 {
490 return componentsInDirectChild.menu;
491 }
492 }
493 return AddChild(idLang);
494 }

References AddChild(), UIContextMenuPopper.id, and UIContextMenuPopper.menu.

Referenced by Widget.SetBaseContextMenu().

◆ AddSeparator()

void UIContextMenu.AddSeparator ( int  index = 0)
inline

Definition at line 268 of file UIContextMenu.cs.

269 {
270 UnityEngine.Object.Instantiate(separators[index]).transform.SetParent(layoutGroup.transform, worldPositionStays: false);
271 }
GameObject[] separators

References layoutGroup, and separators.

Referenced by HotItemContext.Show().

◆ AddSlider() [1/3]

UIContextMenuItem UIContextMenu.AddSlider ( string  id,
string  text,
Func< float, string >  textFunc,
float  value,
Action< float >  action,
float  min = 0f,
float  max = 1f,
bool  isInt = false,
bool  hideOther = true,
bool  useInput = false 
)
inline

Definition at line 335 of file UIContextMenu.cs.

336 {
338 return AddSlider(item, text, textFunc, value, action, min, max, isInt, hideOther, useInput);
339 }
UIContextMenuItem AddSlider(string text, Func< float, string > textFunc, float value, Action< float > action, float min=0f, float max=1f, bool isInt=false, bool hideOther=true, bool useInput=false)

References AddSlider(), item, and Util.

◆ AddSlider() [2/3]

UIContextMenuItem UIContextMenu.AddSlider ( string  text,
Func< float, string >  textFunc,
float  value,
Action< float >  action,
float  min = 0f,
float  max = 1f,
bool  isInt = false,
bool  hideOther = true,
bool  useInput = false 
)
inline

◆ AddSlider() [3/3]

UIContextMenuItem UIContextMenu.AddSlider ( UIContextMenuItem  item,
string  text,
Func< float, string >  textFunc,
float  value,
Action< float >  action,
float  min = 0f,
float  max = 1f,
bool  isInt = false,
bool  hideOther = true,
bool  useInput = false 
)
inline

Definition at line 341 of file UIContextMenu.cs.

342 {
343 UiInputField input = item.GetComponentInChildren<UiInputField>();
344 Slider s = item.slider;
345 item.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
346 item.textName.text = text.lang();
347 s.minValue = min;
348 if (max < 0f)
349 {
350 max = 0f;
351 }
352 s.maxValue = max;
353 s.wholeNumbers = isInt;
354 s.SetValueWithoutNotify(value);
355 item.textSlider.text = textFunc(value);
356 s.onValueChanged.AddListener(delegate(float a)
357 {
358 item.textSlider.text = textFunc(a);
359 action(a);
360 if ((bool)input)
361 {
362 input.text = s.value.ToString() ?? "";
363 input.Select();
364 input.HideCaret();
365 }
366 });
367 if ((bool)input)
368 {
369 input.SetActive(useInput);
370 input.text = s.value.ToString() ?? "";
371 input.onValueChanged.AddListener(delegate(string text)
372 {
373 if (!text.IsEmpty())
374 {
375 float num2 = Mathf.Clamp(text.ToInt(), min, max);
376 s.SetValueWithoutNotify(num2);
377 action(num2);
378 }
379 });
380 input.onUpdate = delegate
381 {
382 if (Input.GetKeyDown(KeyCode.Space) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
383 {
384 action(s.value);
385 Current?.Hide();
386 }
387 else if (!input.text.IsEmpty())
388 {
389 int num = input.text.ToInt();
390 if ((float)num > max)
391 {
392 num = (int)max;
393 input.text = num.ToString() ?? "";
394 s.SetValueWithoutNotify(num);
395 }
396 }
397 };
398 if (useInput)
399 {
400 input.onDisable = delegate
401 {
402 action(s.value);
403 };
404 }
405 if (useInput)
406 {
407 input.Select();
408 }
409 }
410 if (hideOther)
411 {
412 RectTransform blocker = null;
413 EventTrigger component = s.GetComponent<EventTrigger>();
414 component.triggers.Clear();
415 EventTrigger.Entry entry = new EventTrigger.Entry
416 {
417 eventID = EventTriggerType.PointerDown
418 };
419 entry.callback.AddListener(delegate
420 {
421 blocker = Util.Instantiate<RectTransform>("Items/sliderBlocker", this);
422 blocker.SetAsFirstSibling();
423 UIContextMenu[] componentsInParent2 = GetComponentsInParent<UIContextMenu>();
424 for (int j = 0; j < componentsInParent2.Length; j++)
425 {
426 componentsInParent2[j].cg.DOFade(0.01f, 1f);
427 }
428 if ((bool)s && s.gameObject != null)
429 {
430 s.gameObject.AddComponent<CanvasGroup>().ignoreParentGroups = true;
431 }
432 });
433 component.triggers.Add(entry);
434 entry = new EventTrigger.Entry
435 {
436 eventID = EventTriggerType.PointerUp
437 };
438 entry.callback.AddListener(delegate
439 {
440 if (!isPointerOver)
441 {
442 Root.Hide();
443 }
444 else
445 {
446 UIContextMenu[] componentsInParent = GetComponentsInParent<UIContextMenu>();
447 foreach (UIContextMenu obj in componentsInParent)
448 {
449 DOTween.Kill(obj.cg);
450 obj.cg.alpha = 1f;
451 }
452 UnityEngine.Object.Destroy(s.GetComponent<CanvasGroup>());
453 UnityEngine.Object.DestroyImmediate(blocker.gameObject);
454 }
455 });
456 component.triggers.Add(entry);
457 }
458 return item;
459 }
UIContextMenu Root
static UIContextMenu Current
CanvasGroup cg

References cg, UiInputField.Clear(), Current, Hide(), isPointerOver, item, layoutGroup, Root, and Util.

◆ AddToggle()

UIContextMenuItem UIContextMenu.AddToggle ( string  idLang = "",
bool  isOn = false,
UnityAction< bool >  action = null 
)
inline

Definition at line 316 of file UIContextMenu.cs.

317 {
318 UIContextMenuItem uIContextMenuItem = UnityEngine.Object.Instantiate(defaultToggle);
319 uIContextMenuItem.transform.SetParent(layoutGroup.transform, worldPositionStays: false);
320 uIContextMenuItem.textName.text = idLang.lang().ToTitleCase();
321 uIContextMenuItem.toggle.isOn = isOn;
322 if (action != null)
323 {
324 uIContextMenuItem.toggle.onValueChanged.AddListener(action);
325 }
326 return uIContextMenuItem;
327 }
UIContextMenuItem defaultToggle

References defaultToggle, layoutGroup, and UIContextMenuItem.toggle.

Referenced by LayerHoard.OnClickConfig(), LayerAbility.OnInit(), WidgetBottomBar.OnSetContextMenu(), WidgetDate.OnSetContextMenu(), WidgetEquip.OnSetContextMenu(), WidgetHotbar.OnSetContextMenu(), WidgetHP.OnSetContextMenu(), WidgetInspector.OnSetContextMenu(), WidgetMainText.OnSetContextMenu(), WidgetMascot.OnSetContextMenu(), WidgetMinimap.OnSetContextMenu(), WidgetNotice.OnSetContextMenu(), WidgetRoster.OnSetContextMenu(), WidgetSideScreen.OnSetContextMenu(), WidgetStatsBar.OnSetContextMenu(), WidgetSticky.OnSetContextMenu(), WidgetTracker.OnSetContextMenu(), WidgetUnityChan.OnSetContextMenu(), HotItemContext.OnShowContextMenu(), LayerSkinDeco.OnUpdateInput(), LayerCollectible.Refresh(), UIInventory.RefreshMenu(), Widget.SetBaseContextMenu(), HotItemContext.Show(), and UIInventory.ShowDistribution().

◆ Awake()

void UIContextMenu.Awake ( )
inlineprivate

Definition at line 103 of file UIContextMenu.cs.

104 {
105 layoutGroup = GetComponent<VerticalLayoutGroup>();
106 _rect = base.transform as RectTransform;
107 base.gameObject.SetActive(value: false);
108 }
RectTransform _rect

References _rect, and layoutGroup.

◆ ClearItems()

void UIContextMenu.ClearItems ( )
inline

Definition at line 263 of file UIContextMenu.cs.

264 {
265 layoutGroup.DestroyChildren();
266 }

References layoutGroup.

Referenced by AddChild().

◆ Hide()

void UIContextMenu.Hide ( )
inline

Definition at line 226 of file UIContextMenu.cs.

227 {
229 {
230 return;
231 }
232 isPointerOver = false;
233 if (destroyOnHide)
234 {
235 if (!isDestroyed)
236 {
237 isDestroyed = true;
238 UnityEngine.Object.DestroyImmediate(base.gameObject);
239 if (onDestroy != null)
240 {
241 onDestroy();
242 }
244 {
246 }
247 }
248 }
249 else
250 {
251 if (!base.gameObject.activeSelf)
252 {
253 return;
254 }
255 base.gameObject.SetActive(value: false);
256 }
258 BaseCore.Instance.eventSystem.SetSelectedGameObject(null);
261 }
virtual void ConsumeInput()
Definition: BaseCore.cs:57
EventSystem eventSystem
Definition: BaseCore.cs:27
static BaseCore Instance
Definition: BaseCore.cs:11
Definition: EInput.cs:8
static void DisableIME()
Definition: EInput.cs:454
static bool IsPointerOver(Component c)
static void TryShowTip(Transform root=null, bool highlight=true, bool ignoreWhenRightClick=true)
Definition: UIButton.cs:778
void DoNormalTransition(bool instant=true)
Definition: UIButton.cs:531
static UIContextMenuManager Instance
UIButton highlightTarget
Action onDestroy

References UIContextMenuManager.autoClose, BaseCore.ConsumeInput(), destroyOnHide, EInput.DisableIME(), UIButton.DoNormalTransition(), BaseCore.eventSystem, highlightTarget, BaseCore.Instance, UIContextMenuManager.Instance, isDestroyed, InputModuleEX.IsPointerOver(), isPointerOver, onDestroy, and UIButton.TryShowTip().

Referenced by AddButton(), AddSlider(), UIContextMenuManager.Create(), UIContextMenuPopper.Depop(), Scene.OnUpdate(), LayerSkinDeco.OnUpdateInput(), Widget.SetBaseContextMenu(), LayerCraftFloat.ShowContextMenu(), and Update().

◆ LateUpdate()

void UIContextMenu.LateUpdate ( )
inlineprivate

Definition at line 157 of file UIContextMenu.cs.

158 {
159 if ((bool)highlightTarget)
160 {
162 }
163 }
void DoHighlightTransition(bool instant=false)
Definition: UIButton.cs:526

References UIButton.DoHighlightTransition(), and highlightTarget.

◆ OnPointerEnter()

void UIContextMenu.OnPointerEnter ( PointerEventData  data)
inline

Definition at line 165 of file UIContextMenu.cs.

166 {
167 isPointerOver = true;
168 }

References isPointerOver.

◆ OnPointerExit()

void UIContextMenu.OnPointerExit ( PointerEventData  data)
inline

Definition at line 170 of file UIContextMenu.cs.

171 {
172 isPointerOver = false;
173 }

References isPointerOver.

◆ PositionMenu()

void UIContextMenu.PositionMenu ( )
inlineprivate

Definition at line 517 of file UIContextMenu.cs.

518 {
519 base.gameObject.SetActive(value: true);
520 this.RebuildLayout(recursive: true);
521 _rect.anchoredPosition = showPos;
522 RectTransform obj = _rect.parent as RectTransform;
523 Vector3 localPosition = _rect.localPosition;
524 Vector3 vector = obj.rect.min - _rect.rect.min;
525 Vector3 vector2 = obj.rect.max - _rect.rect.max;
526 localPosition.x = Mathf.Clamp(_rect.localPosition.x, vector.x, vector2.x);
527 localPosition.y = Mathf.Clamp(_rect.localPosition.y, vector.y, vector2.y + margin.y);
528 _rect.localPosition = localPosition;
529 }
Vector2 showPos
Vector2 margin

References _rect, margin, and showPos.

Referenced by Show().

◆ SetHighlightTarget() [1/2]

UIContextMenu UIContextMenu.SetHighlightTarget ( UIButton  t)
inline

Definition at line 536 of file UIContextMenu.cs.

537 {
538 highlightTarget = t;
539 return this;
540 }

References highlightTarget.

◆ SetHighlightTarget() [2/2]

UIContextMenu UIContextMenu.SetHighlightTarget ( UIItem  i)
inline

Definition at line 531 of file UIContextMenu.cs.

532 {
533 return SetHighlightTarget(i.button1);
534 }
UIContextMenu SetHighlightTarget(UIItem i)
UIButton button1
Definition: UIItem.cs:18

References UIItem.button1, and SetHighlightTarget().

Referenced by SetHighlightTarget(), and Show().

◆ Show() [1/4]

void UIContextMenu.Show ( )
inline

Definition at line 192 of file UIContextMenu.cs.

193 {
194 wasCanceled = false;
195 if (isChild)
196 {
198 }
199 else
200 {
201 hideOnMouseLeave = true;
202 }
203 if (showPos == Vector2.zero)
204 {
206 }
207 base.gameObject.SetActive(value: true);
208 this.RebuildLayout(recursive: true);
209 if (!isChild)
210 {
211 showPos += fixPos;
212 if ((bool)soundPop)
213 {
214 SE.Play(soundPop);
215 }
216 _rect.anchoredPosition = new Vector2(-10000f, -10000f);
217 PositionMenu();
218 Current = this;
219 }
220 if ((bool)TooltipManager.Instance)
221 {
223 }
224 }
static Vector3 uiMousePosition
Definition: EInput.cs:369
static TooltipManager Instance
void HideTooltips(bool immediate=false)
Vector2 fixPos
void PositionMenu()
bool hideOnMouseLeave
SoundData soundPop

References Current, fixPos, hideOnMouseLeave, TooltipManager.HideTooltips(), TooltipManager.Instance, isChild, PositionMenu(), showPos, soundPop, EInput.uiMousePosition, and wasCanceled.

Referenced by Show().

◆ Show() [2/4]

void UIContextMenu.Show ( UIButton  b)
inline

Definition at line 180 of file UIContextMenu.cs.

181 {
183 Show();
184 }

References SetHighlightTarget(), and Show().

◆ Show() [3/4]

◆ Show() [4/4]

void UIContextMenu.Show ( Vector2  pos)
inline

Definition at line 186 of file UIContextMenu.cs.

187 {
188 showPos = pos;
189 Show();
190 }

References Show(), and showPos.

◆ Update()

void UIContextMenu.Update ( )
inlineprivate

Definition at line 110 of file UIContextMenu.cs.

111 {
112 if (onUpdate != null)
113 {
114 onUpdate();
115 }
116 if ((bool)highlightTarget)
117 {
119 }
120 timeSinceOpen += Time.unscaledDeltaTime;
121 if (timeSinceOpen < 0.3f)
122 {
123 return;
124 }
125 if (Input.GetKeyDown(KeyCode.Escape) || Input.GetMouseButtonDown(1))
126 {
127 wasCanceled = true;
128 Hide();
129 return;
130 }
131 updatesSinceOpen += 1f;
132 if (!Current.hideOnMouseLeave && updatesSinceOpen > 10f && !isPointerOver && Input.GetMouseButtonDown(0) && !isChild)
133 {
134 Hide();
135 }
136 else if (updatesSinceOpen > 10f && !isPointerOver && !Input.GetMouseButton(0))
137 {
138 timeSincePointerLeft += Time.unscaledDeltaTime;
140 {
141 if (Input.GetMouseButtonUp(0))
142 {
143 Hide();
144 }
146 {
147 Hide();
148 }
149 }
150 }
151 else
152 {
154 }
155 }
float timeSincePointerLeft
float updatesSinceOpen
float timeSinceOpen

References Current, UIButton.DoHighlightTransition(), Hide(), hideOnMouseLeave, highlightTarget, isChild, isPointerOver, UIContextMenuPopper.isPointerOver, onUpdate, popper, timeSinceOpen, timeSincePointerLeft, updatesSinceOpen, and wasCanceled.

Member Data Documentation

◆ _rect

RectTransform UIContextMenu._rect

Definition at line 66 of file UIContextMenu.cs.

Referenced by Awake(), PositionMenu(), and UIContextMenuPopper.PositionMenu().

◆ alwaysPopLeft

bool UIContextMenu.alwaysPopLeft

Definition at line 46 of file UIContextMenu.cs.

Referenced by AddChild(), and UIContextMenuPopper.PositionMenu().

◆ bg

Image UIContextMenu.bg

Definition at line 48 of file UIContextMenu.cs.

◆ cg

CanvasGroup UIContextMenu.cg

Definition at line 28 of file UIContextMenu.cs.

Referenced by AddSlider().

◆ closeOnMouseLeave

bool UIContextMenu.closeOnMouseLeave
static

Definition at line 14 of file UIContextMenu.cs.

◆ Current

◆ defaultButton

UIContextMenuItem UIContextMenu.defaultButton

Definition at line 16 of file UIContextMenu.cs.

Referenced by AddButton().

◆ defaultGridLayout

GridLayoutGroup UIContextMenu.defaultGridLayout

Definition at line 24 of file UIContextMenu.cs.

Referenced by AddGridLayout().

◆ defaultPopper

UIContextMenuPopper UIContextMenu.defaultPopper

Definition at line 18 of file UIContextMenu.cs.

Referenced by AddChild().

◆ defaultSlider

UIContextMenuItem UIContextMenu.defaultSlider

Definition at line 22 of file UIContextMenu.cs.

Referenced by AddSlider().

◆ defaultToggle

UIContextMenuItem UIContextMenu.defaultToggle

Definition at line 20 of file UIContextMenu.cs.

Referenced by AddToggle().

◆ depth

int UIContextMenu.depth

Definition at line 72 of file UIContextMenu.cs.

◆ destroyOnHide

bool UIContextMenu.destroyOnHide

Definition at line 38 of file UIContextMenu.cs.

Referenced by Hide().

◆ fixPos

Vector2 UIContextMenu.fixPos

Definition at line 54 of file UIContextMenu.cs.

Referenced by Show().

◆ hideOnMouseLeave

bool UIContextMenu.hideOnMouseLeave

Definition at line 58 of file UIContextMenu.cs.

Referenced by UIContextMenuPopper.Pop(), Show(), Update(), and UIContextMenuPopper.Update().

◆ highlightTarget

UIButton UIContextMenu.highlightTarget

Definition at line 56 of file UIContextMenu.cs.

Referenced by Hide(), LateUpdate(), SetHighlightTarget(), and Update().

◆ isDestroyed

bool UIContextMenu.isDestroyed

Definition at line 87 of file UIContextMenu.cs.

Referenced by Hide().

◆ isPointerOver

bool UIContextMenu.isPointerOver

◆ layoutGroup

VerticalLayoutGroup UIContextMenu.layoutGroup

◆ logo

Transform UIContextMenu.logo

Definition at line 26 of file UIContextMenu.cs.

Referenced by UIContextMenuManager.Create().

◆ margin

Vector2 UIContextMenu.margin

Definition at line 52 of file UIContextMenu.cs.

Referenced by PositionMenu().

◆ matBlur

Material UIContextMenu.matBlur

Definition at line 42 of file UIContextMenu.cs.

Referenced by UIContextMenuPopper.CreateMenu().

◆ onDestroy

Action UIContextMenu.onDestroy

Definition at line 32 of file UIContextMenu.cs.

Referenced by Hide().

◆ onUpdate

Action UIContextMenu.onUpdate

Definition at line 34 of file UIContextMenu.cs.

Referenced by Update().

◆ parent

UIContextMenu UIContextMenu.parent

Definition at line 75 of file UIContextMenu.cs.

◆ popper

UIContextMenuPopper UIContextMenu.popper

Definition at line 36 of file UIContextMenu.cs.

Referenced by AddButton(), and Update().

◆ separators

GameObject [] UIContextMenu.separators

Definition at line 30 of file UIContextMenu.cs.

Referenced by AddSeparator().

◆ showPos

Vector2 UIContextMenu.showPos
private

Definition at line 60 of file UIContextMenu.cs.

Referenced by PositionMenu(), and Show().

◆ soundPop

SoundData UIContextMenu.soundPop

Definition at line 50 of file UIContextMenu.cs.

Referenced by Show().

◆ system

bool UIContextMenu.system

Definition at line 44 of file UIContextMenu.cs.

Referenced by UIContextMenuPopper.CreateMenu().

◆ timeSinceClosed

float UIContextMenu.timeSinceClosed
static

Definition at line 12 of file UIContextMenu.cs.

Referenced by UIButton.OnHover().

◆ timeSinceOpen

float UIContextMenu.timeSinceOpen

Definition at line 78 of file UIContextMenu.cs.

Referenced by Update(), and UIContextMenuPopper.Update().

◆ timeSincePointerLeft

float UIContextMenu.timeSincePointerLeft

Definition at line 81 of file UIContextMenu.cs.

Referenced by Update().

◆ updatesSinceOpen

float UIContextMenu.updatesSinceOpen

Definition at line 84 of file UIContextMenu.cs.

Referenced by Update().

◆ wasCanceled

bool UIContextMenu.wasCanceled

Definition at line 40 of file UIContextMenu.cs.

Referenced by Show(), Thing.ShowSplitMenu(), and Update().

Property Documentation

◆ isChild

bool UIContextMenu.isChild
get

Definition at line 89 of file UIContextMenu.cs.

Referenced by Show(), and Update().

◆ Root

UIContextMenu UIContextMenu.Root
get

Definition at line 91 of file UIContextMenu.cs.

92 {
93 get
94 {
95 if (!parent)
96 {
97 return this;
98 }
99 return parent.Root;
100 }
101 }
UIContextMenu parent

Referenced by AddSlider().


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