Skip to content

Instantly share code, notes, and snippets.

@hecres
Last active July 8, 2018 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hecres/ed352abfa0c435ea6d0562a027551625 to your computer and use it in GitHub Desktop.
Save hecres/ed352abfa0c435ea6d0562a027551625 to your computer and use it in GitHub Desktop.
Blog20180708_0
public static partial class UnityUIComponentExtensions
{
public static IObservable<string> OnDoneAsObservable(this InputField self)
{
return self.OnEndEditAsObservable()
.Where(_ => TouchScreenKeyboard.isSupported)
.Where(_ => self.touchScreenKeyboard.status == TouchScreenKeyboard.Status.Done)
.Share();
}
public static IObservable<string> OnCanceledAsObservable(this InputField self)
{
return self.OnEndEditAsObservable()
.Where(_ => TouchScreenKeyboard.isSupported)
.Where(_ => self.touchScreenKeyboard.status == TouchScreenKeyboard.Status.Canceled)
.Share();
}
public static IObservable<string> OnLostFocusAsObservable(this InputField self)
{
return self.OnEndEditAsObservable()
.Where(_ => TouchScreenKeyboard.isSupported)
.Where(_ => self.touchScreenKeyboard.status == TouchScreenKeyboard.Status.LostFocus)
.Share();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment