void __touchBegin(EventContext context) { if (Stage.inst.touchCount > 1) { Stage.inst.onTouchMove.Remove(__touchMove); Stage.inst.onTouchEnd.Remove(__touchEnd); if (_started) { _started = false; onEnd.Call(context.inputEvent); } return; } InputEvent evt = context.inputEvent; _startPoint = _host.GlobalToLocal(new Vector2(evt.x, evt.y)); _lastPoint = _startPoint; _throwPoint = _startPoint; _time2 = _time = Time.time; _started = false; velocity = Vector2.zero; position = Vector2.zero; Stage.inst.onTouchMove.Add(__touchMove); Stage.inst.onTouchEnd.Add(__touchEnd); }
void __touchBegin(EventContext context) { InputEvent evt = context.inputEvent; _startPoint = _host.GlobalToLocal(new Vector2(evt.x, evt.y)); _started = false; Timers.inst.Add(trigger, 1, __timer); context.CaptureTouch(); }
void __touchBegin(EventContext context) { if (Stage.inst.touchCount > 1) { Timers.inst.Remove(__timer); return; } InputEvent evt = context.inputEvent; _startPoint = _host.GlobalToLocal(new Vector2(evt.x, evt.y)); Timers.inst.Add(duration, 0, __timer); Stage.inst.onTouchEnd.Add(__touchEnd); }
void __touchBegin(EventContext context) { context.StopPropagation(); InputEvent evt = context.inputEvent; Vector2 pt = _grip.GlobalToLocal(new Vector2(evt.x, evt.y)); if (_vertical) { if (pt.y < 0) { _target.ScrollUp(4, false); } else { _target.ScrollDown(4, false); } } else { if (pt.x < 0) { _target.ScrollLeft(4, false); } else { _target.ScrollRight(4, false); } } }
private void __barTouchBegin(EventContext context) { if (!changeOnClick) { return; } InputEvent evt = context.inputEvent; Vector2 pt = _gripObject.GlobalToLocal(new Vector2(evt.x, evt.y)); float percent = Mathf.Clamp01((float)((_value - _min) / (_max - _min))); float delta = 0; if (_barObjectH != null) { delta = (pt.x - _gripObject.width / 2) / _barMaxWidth; } if (_barObjectV != null) { delta = (pt.y - _gripObject.height / 2) / _barMaxHeight; } if (_reverse) { percent -= delta; } else { percent += delta; } UpdateWithPercent(percent, true); }
void __touchBegin(EventContext context) { if (Stage.inst.touchCount == 2) { if (!_started) { Stage.inst.GetAllTouch(_touches); Vector2 pt1 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[0])); Vector2 pt2 = _host.GlobalToLocal(Stage.inst.GetTouchPosition(_touches[1])); _startVector = pt1 - pt2; Stage.inst.onTouchMove.Add(__touchMove); Stage.inst.onTouchEnd.Add(__touchEnd); } } }
private void __barTouchBegin(EventContext context) { if (!changeOnClick) { return; } InputEvent evt = context.inputEvent; Vector2 pt = _gripObject.GlobalToLocal(new Vector2(evt.x, evt.y)); float percent = (float)(_value / _max); float delta = 0; if (_barObjectH != null) { delta = (pt.x - _gripObject.width / 2) / _barMaxWidth; } if (_barObjectV != null) { delta = (pt.y - _gripObject.height / 2) / _barMaxHeight; } if (_reverse) { percent -= delta; } else { percent += delta; } if (percent > 1) { percent = 1; } else if (percent < 0) { percent = 0; } double newValue = percent * _max; if (newValue != _value) { _value = newValue; if (DispatchEvent("onChanged", null)) { return; } } UpdateWidthPercent(percent); }