using System; namespace UnityEngine.InputSystem.LowLevel { internal class SelectObservable : IObservable { private readonly IObservable m_Source; private readonly Func m_Filter; public SelectObservable(IObservable source, Func filter) { m_Source = source; m_Filter = filter; } public IDisposable Subscribe(IObserver observer) { return m_Source.Subscribe(new Select(this, observer)); } private class Select : IObserver { private SelectObservable m_Observable; private readonly IObserver m_Observer; public Select(SelectObservable observable, IObserver observer) { m_Observable = observable; m_Observer = observer; } public void OnCompleted() { } public void OnError(Exception error) { Debug.LogException(error); } public void OnNext(TSource evt) { var result = m_Observable.m_Filter(evt); m_Observer.OnNext(result); } } } }