public List <IBinding> GetBindings() { BindingBuilder bb = new BindingBuilder(); bb.BindExistingInstance(ApplicationManager.Instance); bb.BindExistingInstance(SceneNavigator.Instance); bb.BindExistingInstance(SettingsManager.Instance); bb.BindExistingInstance(SongMetaManager.Instance); bb.BindExistingInstance(ThemeManager.Instance); bb.BindExistingInstance(CursorManager.Instance); bb.BindExistingInstance(UiManager.Instance); bb.BindExistingInstance(MidiManager.Instance); bb.BindExistingInstance(AudioManager.Instance); bb.BindExistingInstance(I18NManager.Instance); EventSystem eventSystem = GameObjectUtils.FindComponentWithTag <EventSystem>("EventSystem"); bb.BindExistingInstance(eventSystem); // Lazy binding of settings, because they are not needed in every scene and loading the settings takes time. bb.BindExistingInstanceLazy(() => SettingsManager.Instance.Settings); bb.BindExistingInstanceLazy(() => StatsManager.Instance.Statistics); return(bb.GetBindings()); }
/// Returns the currentSelectedGameObject from the EventSystem. /// Normally, this is the UI control that has the focus (e.g. a Button, InputField or Toggle). public static GameObject GetSelectedGameObject() { EventSystem eventSystem = GameObjectUtils.FindComponentWithTag <EventSystem>("EventSystem"); GameObject result = eventSystem.currentSelectedGameObject; return(result); }
public static Canvas FindCanvas() { Canvas canvas = GameObjectUtils.FindComponentWithTag <Canvas>("Canvas"); if (canvas == null) { throw new UnityException("FindCanvas failed! Check tag of scene Canvas."); } return(canvas); }
public void Awake() { UIDocument uiDocument = GameObjectUtils.FindComponentWithTag <UIDocument>("UIDocument"); VisualElement visualElement = uiDocument.rootVisualElement.Q <VisualElement>(visualElementName); if (visualElement == null) { Debug.LogWarning($"No visualElement found with name {visualElementName}"); return; } visualElement.RegisterCallback <GeometryChangedEvent>(_ => { if (!dynTexture.IsInitialized) { dynTexture.Init(visualElement); } }); }
public List <IBinding> GetBindings() { BindingBuilder bb = new(); bb.BindExistingInstance(ApplicationManager.Instance); bb.BindExistingInstance(SceneNavigator.Instance); bb.BindExistingInstance(SettingsManager.Instance); bb.BindExistingInstance(SongMetaManager.Instance); bb.BindExistingInstance(CursorManager.Instance); bb.BindExistingInstance(UiManager.Instance); bb.BindExistingInstance(MidiManager.Instance); bb.BindExistingInstance(AudioManager.Instance); bb.BindExistingInstance(TranslationManager.Instance); bb.BindExistingInstance(ContextMenuPopupManager.Instance); bb.BindExistingInstance(PlaylistManager.Instance); bb.BindExistingInstance(StatsManager.Instance); bb.BindExistingInstance(CoroutineManager.Instance); bb.BindExistingInstance(InputManager.Instance); bb.Bind(typeof(UltraStarPlayInputManager)).ToExistingInstance(UltraStarPlayInputManager.Instance); bb.BindExistingInstance(HttpServer.Instance); bb.Bind(typeof(IServerSideConnectRequestManager)).ToExistingInstance(ServerSideConnectRequestManager.Instance); bb.BindExistingInstance(ServerSideConnectRequestManager.Instance); EventSystem eventSystem = GameObjectUtils.FindComponentWithTag <EventSystem>("EventSystem"); bb.BindExistingInstance(eventSystem); // Lazy binding of UIDocument, because it does not exist in every scene (yet) bb.BindExistingInstanceLazy(() => GetUiDocument()); // Lazy binding of settings, because they are not needed in every scene and loading the settings takes time. bb.Bind(typeof(ISettings)).ToExistingInstance(() => SettingsManager.Instance.Settings); bb.BindExistingInstanceLazy(() => SettingsManager.Instance.Settings); bb.BindExistingInstanceLazy(() => StatsManager.Instance.Statistics); return(bb.GetBindings()); }
public static Canvas FindCanvas() { return(GameObjectUtils.FindComponentWithTag <Canvas>("Canvas")); }