// ------------------- override public bool OnTouchStart(TouchObject touch, TouchControl sender, TouchStartType touchStartType) { if (this.touchObj != null) { return(false); } this.touchObj = touch; this.touchObj.AddControl(this); Vector3 startPosScreen = ((touchStartType == TouchStartType.DirectPress) ? touch.screenPosStart : touch.screenPosCur), curPosScreen = touch.screenPosCur, startPosOriented = this.ScreenToOrientedPos(startPosScreen, touch.cam), curPosOriented = this.ScreenToOrientedPos(curPosScreen, touch.cam), startPosWorld = this.ScreenToWorldPos(startPosScreen, touch.cam), curPosWorld = this.ScreenToWorldPos(curPosScreen, touch.cam); this.touchStateWorld.OnTouchStart(startPosWorld, curPosWorld, 0, this.touchObj); this.touchStateScreen.OnTouchStart(startPosScreen, curPosScreen, 0, this.touchObj); this.touchStateOriented.OnTouchStart(startPosOriented, curPosOriented, 0, this.touchObj); this.touchStartedByRegion = ((sender != null) && (sender != this)); //== this.GetDynamicRegion())); this.touchStartType = touchStartType; return(true); }
// ------------- public SystemTouch(TouchControlPanel panel) { //this.panel = panel; this.touch = new TouchObject(); this.hwId = 0; this.elapsedSinceLastAction = 0; }
// ------------------ override public void ReleaseAllTouches() { if (this.touchObj != null) { this.touchObj.ReleaseControl(this, TouchEndType.Cancel); this.touchObj = null; } }
// -------------- override public bool OnTouchStart(TouchObject touch, TouchControl sender, TouchStartType touchStartType) { if (this.targetControl != null) { return(this.targetControl.OnTouchStart(touch, this, TouchStartType.ProxyPress)); } return(false); }
// ------------------- override public bool OnTouchPressureChange(TouchObject touchObj) { if ((this.touchObj == null) || (this.touchObj != touchObj)) { return(false); } this.touchState.OnTouchPressureChange(touchObj.GetPressure()); return(true); }
// ---------------------- override public void ReleaseAllTouches() { if (this.touchObj != null) { this.touchObj.ReleaseControl(this, TouchEndType.Cancel); this.touchObj = null; } this.touchStateWorld.OnTouchEnd(true); //(touchEndType != TouchEndType.RELEASE)); //cancel); this.touchStateOriented.OnTouchEnd(true); //(touchEndType != TouchEndType.RELEASE)); //cancel); this.touchStateScreen.OnTouchEnd(true); //(touchEndType != TouchEndType.RELEASE)); //cancel); }
// ------------------ override public bool OnTouchEnd(TouchObject touchObj, TouchEndType touchEndType) { if ((this.touchObj == null) || (this.touchObj != touchObj)) { return(false); } this.touchObj = null; this.touchState.OnTouchEnd(touchEndType != TouchEndType.Release); return(true); }
// ------------------- override public bool OnTouchPressureChange(TouchObject touch) { if ((touch != this.touchObj) || (this.touchObj == null)) { return(false); } this.touchStateWorld.OnTouchPressureChange(touch.GetPressure()); this.touchStateScreen.OnTouchPressureChange(touch.GetPressure()); this.touchStateOriented.OnTouchPressureChange(touch.GetPressure()); return(true); }
// ------------------- override public bool OnTouchEnd(TouchObject touch, TouchEndType touchEndType) { if ((touch != this.touchObj) || (this.touchObj == null)) { return(false); } this.touchObj = null; this.touchStateWorld.OnTouchEnd(touchEndType != TouchEndType.Release); //cancel); this.touchStateScreen.OnTouchEnd(touchEndType != TouchEndType.Release); //cancel); this.touchStateOriented.OnTouchEnd(touchEndType != TouchEndType.Release); //cancel); return(true); }
// ------------------- override public bool OnTouchMove(TouchObject touchObj) { if ((this.touchObj == null) || (this.touchObj != touchObj)) { return(false); } Vector2 localPos = this.ScreenToOrientedPos(touchObj.screenPosCur, touchObj.cam); //data.pos, data.cam); this.touchState.OnTouchMove(localPos); this.CheckSwipeOff(touchObj, this.touchStartType); return(true); }
// ------------------ override public bool OnTouchEnd(TouchObject touchObj, TouchEndType touchEndType) { if ((this.touchObj == null) || (this.touchObj != touchObj)) { return(false); } //Debug.LogFormat("----------------Track pad END!!!! : {0} : active:{1}", Time.frameCount, this.IsActive()); this.touchObj = null; this.touchState.OnTouchEnd(touchEndType != TouchEndType.Release); return(true); }
// ------------------ protected bool CheckSwipeOff(TouchObject touchObj, TouchStartType touchStartType) { if ((touchObj == null) || (this.swipeOffMode == SwipeOffMode.Disabled) || ((this.swipeOffMode == SwipeOffMode.OnlyIfSwipedOver) && (touchStartType != TouchStartType.SwipeOver))) { return(false); } if (!this.RaycastScreen(touchObj.screenPosCur, touchObj.cam)) { touchObj.ReleaseControl(this, TouchEndType.SwipeOff); return(true); } return(false); }
// ------------------ override public bool OnTouchStart(TouchObject touchObj, TouchControl sender, TouchStartType touchStartType) { if (this.touchObj != null) { return(false); } this.touchObj = touchObj; this.touchStartType = touchStartType; this.touchObj.AddControl(this); Vector2 localPos = this.ScreenToOrientedPos(touchObj.screenPosStart, touchObj.cam); this.touchState.OnTouchStart(localPos, localPos, 0, touchObj.IsMouse()); return(true); }
// -------------- override public bool OnTouchStart(TouchObject touch, TouchControl sender, TouchStartType touchStartType) { bool someActivated = false; for (int i = 0; i < this.targetControlList.Count; ++i) { TouchControl c = this.targetControlList[i]; if (c != null) { if (c.OnTouchStart(touch, this, TouchStartType.ProxyPress)) { someActivated = true; } } } return(someActivated); }
// ------------------ override public bool OnTouchStart(TouchObject touchObj, TouchControl sender, TouchStartType touchStartType) { if (this.touchObj != null) { return(false); } //Debug.LogFormat("----------------Track pad start : {0} : active:{1}", Time.frameCount, this.IsActive()); this.touchObj = touchObj; this.touchStartType = touchStartType; this.touchObj.AddControl(this); Vector2 localPos = this.ScreenToOrientedPos(touchObj.screenPosStart, touchObj.cam); this.touchState.OnTouchStart(localPos, localPos, 0, touchObj); return(true); }
// ------------------- override public bool OnTouchMove(TouchObject touch) //, TouchControl sender) { if ((touch != this.touchObj) || (this.touchObj == null)) { return(false); } Vector3 posScreen = touch.screenPosCur, posWorld = this.ScreenToWorldPos(touch.screenPosCur, touch.cam), posOriented = this.ScreenToOrientedPos(touch.screenPosCur, touch.cam); this.touchStateWorld.OnTouchMove(posWorld); this.touchStateScreen.OnTouchMove(posScreen); this.touchStateOriented.OnTouchMove(posOriented); this.CheckSwipeOff(touch, this.touchStartType); return(true); }
// ------------------- override public bool CanBeTouchedDirectly(TouchObject touchObj) { if (!base.CanBeTouchedDirectly(touchObj)) { return(false); } for (int i = 0; i < this.targetControlList.Count; ++i) { TouchControl c = this.targetControlList[i]; if (c == null) { continue; } if (c.CanBeActivatedByOtherControl(this, touchObj)) { return(true); } } return(false); }
// -------------- override public bool OnTouchEnd(TouchObject touch, TouchEndType touchEndType) { return(false); }
public override bool CanBeSwipedOverFromRestrictedList(TouchObject touchObj) { return(this.CanBeSwipedOverFromRestrictedListDefault(touchObj)); }
public override bool CanBeSwipedOverFromNothing(TouchObject touchObj) { return(this.CanBeSwipedOverFromNothingDefault(touchObj)); }
// -------------------- public override bool CanSwipeOverOthers(TouchObject touchObj) { return(false); }
// ---------------------- virtual public bool CanBeActivatedByOtherControl(TouchControl c, TouchObject touchObj) { return(this.IsActive()); }
// ----------------------- virtual public bool CanBeTouchedDirectly(TouchObject touchObj) { return(!this.cantBeControlledDirectly && this.IsActive()); }
protected bool CanSwipeOverOthersDefault(TouchObject touchObj, TouchObject myTouchObj, TouchStartType touchStartType) { return((myTouchObj == touchObj) && ((this.swipeOverOthersMode == SwipeOverOthersMode.Enabled) || ((this.swipeOverOthersMode == SwipeOverOthersMode.OnlyIfTouchedDirectly) && (touchStartType != TouchStartType.SwipeOver)))); }
// -------------------- abstract public bool CanSwipeOverOthers(TouchObject touchObj);
protected bool CanBeSwipedOverFromRestrictedListDefault(TouchObject touchObj) { return(this.IsActive()); }
// --------------------- abstract public bool CanBeSwipedOverFromRestrictedList(TouchObject touchObj);
// -------------- override public bool OnTouchMove(TouchObject touch) { return(false); }
// -------------- override public bool OnTouchPressureChange(TouchObject touch) { return(false); }
protected bool CanBeSwipedOverFromNothingDefault(TouchObject touchObj) { return(this.canBeSwipedOver && this.IsActive()); }