public static bool IsInteractableAndActive(this IComponent item) { if (item == null) { return(false); } IInteractableComponent button = null; if (item is LinkerComponent) { button = (item as LinkerComponent).Get <IInteractableComponent>(); } else { button = item as IInteractableComponent; } if (button != null && button.IsVisible() == true && button.IsInteractable() == true) { return(true); } return(false); }
public static void Select(IInteractableComponent button) { if (button != null) { var sel = button.GetSelectable(); if (sel != null) { if (button.IsVisible() == false) { var buttonBase = (button as WindowComponentBase); System.Action callback = null; callback = () => { WindowSystem.GetEvents().Unregister(buttonBase, WindowEventType.OnShowEnd, callback); WindowSystemInput.Select_INTERNAL(button); }; WindowSystem.GetEvents().Register(buttonBase, WindowEventType.OnShowEnd, callback); } else { WindowSystemInput.Select_INTERNAL(button); } } } }