Ejemplo n.º 1
0
        public static UnityAction <string> AddOnValueChangedActionThrottled(this InputField self, Action <string> onValueChanged, double delayInMs = 500)
        {
            EventHandler <string> action = (_, newText) => { onValueChanged(newText); };
            var throttledAction          = action.AsThrottledDebounce(delayInMs, skipFirstEvent: true);

            return(self.AddOnValueChangedAction((newText) => {
                throttledAction(self, newText);
                return true;
            }));
        }
Ejemplo n.º 2
0
        public static void AddOnValueChangedActionThrottled(this InputField self, Action <string> onValueChanged, double delayInMs = 1000)
        {
            EventHandler <string> action = (input, newText) => { onValueChanged(newText); };
            var throttledAction          = action.AsThrottledDebounce(delayInMs);

            self.AddOnValueChangedAction((newText) => {
                throttledAction(self, newText);
                return(true);
            });
        }