void OnTap ( Gesture e ) { if ( unitToCreate == null || !canCreate ) return; if ( !unitToCreate.Recharged ) return; selectedTerrainBlockGO = e.Selection; if ( selectedTerrainBlockGO == null ) return; selectedTerrainBlock = selectedTerrainBlockGO.GetComponent<TerrainBlock>(); if ( selectedTerrainBlock == null ) return; if ( selectedTerrainBlock.HasUnit ) return; if ( instiantedUnit == null ) instiantedUnit = Instantiate ( unitToCreate.gameObject ) as GameObject; instiantedUnit.SetXY ( selectedTerrainBlockGO.GetX(), selectedTerrainBlockGO.GetY() ); if ( selectedTerrainBlock.HasUnit ) Destroy ( instiantedUnit ); else { selectedTerrainBlock.unitOnTerrain = instiantedUnit.GetComponent<Unit>(); selectedTerrainBlock.unitOnTerrain.terrainBlock = selectedTerrainBlock; selectedTerrainBlock.unitOnTerrain.UnitPlaced = true; } selectedTerrainBlockGO = null; selectedTerrainBlock = null; instiantedUnit = null; unitToCreate.LastUsedTime = Time.time; }
// At the long tap end void On_LongTapEnd2Fingers( Gesture gesture){ // Verification that the action on the object if (gesture.pickedObject == gameObject){ gameObject.GetComponent<Renderer>().material.color = startColor; textMesh.text="Long tap me"; } }
void OnGestureEnd(Gesture g) { if (g.ID == _pressedGID) { OnRelease(g); } }
private void On_LongTap(Gesture gesture) { if (gesture.pickObject == base.gameObject) { this.textMesh.text = gesture.actionTime.ToString("f2"); } }
// Simple tap private void On_SimpleTap( Gesture gesture) { // Verification that the action on the object if (gesture.pickObject == gameObject){ gameObject.renderer.material.color = new Color( Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f)); } }
void On_TouchDown(Gesture gesture) { if (gesture.pickedObject!=null){ if (!EasyTouch.GetAutoUpdatePickedObject()){ label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position; } else{ label.text = "Picked object from event : " + gesture.pickedObject.name + " : " + gesture.position; } } else{ if (!EasyTouch.GetAutoUpdatePickedObject()){ label.text = "Picked object from event : none"; } else{ label.text = "Picked object from event : none"; } } label2.text = ""; if (!EasyTouch.GetAutoUpdatePickedObject()){ GameObject tmp = gesture.GetCurrentPickedObject(); if (tmp != null){ label2.text = "Picked object from GetCurrentPickedObject : " + tmp.name ; } else{ label2.text = "Picked object from GetCurrentPickedObject : none"; } } }
public virtual void OnRelease(Gesture G) { if (_pressedGID == -1) return; _pressedGID = -1; GestureController.OnGestureEnd -= OnGestureEnd; }
private void On_TouchStart2Fingers(Gesture gesture) { if (gesture.pickObject == base.gameObject) { base.gameObject.renderer.material.color = new Color(UnityEngine.Random.Range((float) 0f, (float) 1f), UnityEngine.Random.Range((float) 0f, (float) 1f), UnityEngine.Random.Range((float) 0f, (float) 1f)); } }
// At the drag end void On_DragEnd(Gesture gesture) { if (gesture.pickObject == gameObject){ this.transform.localRotation = this.transform.localRotation; gameObject.GetComponent<Renderer>().material.color = Color.white; } }
// Simple 2 fingers tap void On_SimpleTap2Fingers( Gesture gesture) { // Verification that the action on the object if (gesture.pickedObject == gameObject){ RandomColor(); } }
private void On_TouchDown2Fingers(Gesture gesture) { if (gesture.pickObject == base.gameObject) { this.textMesh.text = "Down since :" + gesture.actionTime.ToString("f2"); } }
private void On_Drag(Gesture gesture) { if (gesture.pickedObject == null) return; CurrentPosition = GetTouch(gesture); transform.position = CurrentPosition - DeltaPosition; OnDrag(); }
private void On_TouchStart(Gesture gesture) { if (gesture.pickedObject == null) return; CurrentPosition = GetTouch(gesture); DeltaPosition = CurrentPosition - transform.position; OnTouchStart(); }
public void onTouchStart(Gesture gesture) { _ctrl.doControl (); _touchPosition = _play.touch (gesture.position);// + _ctrl._dirver.fly.gameObject.transform.position; //_touchTime = 0; //isDown_ = true; }
// Double Tap void On_DoubleTap2Fingers( Gesture gesture) { // Verification that the action on the object if (gesture.pickedObject == gameObject){ gameObject.GetComponent<Renderer>().material.color = new Color( Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f)); } }
void On_TouchStart (Gesture gesture){ if (gesture.pickObject != null){ Destroy(gesture.pickObject); CreateMonster(); } }
// During the touch is down private void On_TouchDown(Gesture gesture) { // Verification that the action on the object if (gesture.pickedObject == gameObject){ textMesh.text = "Down since :" + gesture.actionTime.ToString("f2"); } }
// During the swipe private void On_Swipe(Gesture gesture){ // the world coordinate from touch for z=5 Vector3 position = gesture.GetTouchToWorldPoint(5); trail.transform.position = position; }
// during the swipe void On_Swipe2Fingers(Gesture gesture){ if (trail!=null){ Vector3 position = gesture.GetTouchToWordlPoint(5); trail.transform.position = position; } }
// Simple Touch message void On_SimpleTap(Gesture gesture){ if (gesture.pickObject == gameObject){ GameObject child=null; rigidbody.constraints = RigidbodyConstraints.None; foreach (Transform childreen in transform ){ if (childreen.name=="ring") child = childreen.gameObject; } if (child==null){ GameObject ring = Instantiate(Resources.Load("Ring01"), transform.position , Quaternion.identity) as GameObject; ring.transform.localScale = transform.localScale * 1.5f; ring.AddComponent("SlowRotate"); ring.renderer.material.SetColor ("_TintColor", renderer.material.GetColor("_TintColor")); ring.transform.parent = transform; ring.name="ring"; } else{ Destroy( child); } } }
// During the long tap void On_LongTap2Fingers( Gesture gesture) { // Verification that the action on the object if (gesture.pickedObject == gameObject){ textMesh.text = gesture.actionTime.ToString("f2"); } }
void On_PinchIn(Gesture gesture) { EasyTouch.On_Swipe -= On_Swipe; if (camera.orthographicSize < zoom_max) { camera.orthographicSize += zoom_speed; } }
// At the long tap end void On_LongTapEnd2Fingers( Gesture gesture){ // Verification that the action on the object if (gesture.pickObject == gameObject){ gameObject.renderer.material.color = new Color(1f,1f,1f); textMesh.text="Long tap"; } }
public PointEventArgs(Gesture gesture, int x, int y) : base() { this.X = x; this.Y = y; this.Gesture = gesture; }
private void On_Cancel2Fingers(Gesture gesture) { if (gesture.touchCount > 0) { this.newPivot = true; } }
// At the long tap beginning private void On_LongTapStart( Gesture gesture){ // Verification that the action on the object if (gesture.pickObject==gameObject){ gameObject.GetComponent<Renderer>().material.color = new Color( Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f), Random.Range(0.0f,1.0f)); } }
void OnGUI() { GUI.Box(drawArea, "Draw Area"); GUI.Label(new Rect(10, Screen.height - 40, 500, 50), message); if (GUI.Button(new Rect(Screen.width - 100, 10, 100, 30), "Recognize")) { recognized = true; Gesture candidate = new Gesture(points.ToArray()); string gestureResult = PointCloudRecognizer.Classify(candidate, trainingSet.ToArray()); message = gestureResult; Debug.Log("Message:" + message); } GUI.Label(new Rect(Screen.width - 200, 150, 70, 30), "Add as: "); newGestureName = GUI.TextField(new Rect(Screen.width - 150, 150, 100, 30), newGestureName); if (GUI.Button(new Rect(Screen.width - 50, 150, 50, 30), "Add") && points.Count > 0 && newGestureName != "") { string fileName = String.Format("{0}/{1}-{2}.xml", Application.persistentDataPath, newGestureName, DateTime.Now.ToFileTime()); Debug.Log(Application.persistentDataPath); #if !UNITY_WEBPLAYER DataGestures.Save(points, strokeId+1, fileName, newGestureName ); #endif trainingSet.Add(new Gesture(points.ToArray(), newGestureName)); newGestureName = ""; } }
void HandleOn_Swipe(Gesture gesture) { if( gesture.swipe == EasyTouch.SwipeDirection.Up){ Fsm.Event(Up); } if( gesture.swipe == EasyTouch.SwipeDirection.UpLeft){ Fsm.Event(UpLeft); } if( gesture.swipe == EasyTouch.SwipeDirection.UpRight){ Fsm.Event(UpRight); } if(gesture.swipe == EasyTouch.SwipeDirection.Down){ Fsm.Event(Down); } if(gesture.swipe == EasyTouch.SwipeDirection.DownLeft){ Fsm.Event(DownLeft); } if(gesture.swipe == EasyTouch.SwipeDirection.DownRight){ Fsm.Event(DownRight); } if(gesture.swipe == EasyTouch.SwipeDirection.Left){ Fsm.Event(Left); } if(gesture.swipe == EasyTouch.SwipeDirection.Right){ Fsm.Event(Right); } }
private void On_SimpleTap(Gesture gesture) { if (gesture.pickedObject != null) { if (spawnerDisplayEnabled) HideSpawnerOptions(); if (turretSelectDisplayEnabled) HideTurretSelectTab(); if (gesture.pickedObject.tag == "SpawnPosition") { AllySpawnerPosition allySpawnerPosition = gesture.pickedObject.GetComponent<AllySpawnerPosition>(); ShowSpawnerOptions(allySpawnerPosition); } if (gesture.pickedObject.tag == "Ally") { structureController = gesture.pickedObject.GetComponent<AllyStructureController>(); if (structureController.IsTurret) { destroyTurretTab.StructureController = gesture.pickedObject.GetComponentInChildren<AllyStructureController>(); turretSelectWidget.SetAnchor(gesture.pickedObject.transform); ShowTurretSelectTab(); } } } }
void On_PinchOut(Gesture gesture) { EasyTouch.On_Swipe -= On_Swipe; if(camera.orthographicSize > zoom_min){ camera.orthographicSize -= zoom_speed; } }
public void OnGesture(Gesture gesture) { switch (gesture.GestureType) { case GestureType.MouseWheel: if (_view.IsPointInsideView(gesture.Position)) { float offset = -gesture.Offset.Y * _wheelSpeed; if (_wheelScrollsHorizontal) { float maxScroll = _service.ScrolledElement.MaxScrollX - _service.ScrolledElement.ScreenBounds.Width; if ((offset < 0 && _service.ScrollPositionX > 0) || (offset > 0 && _service.ScrollPositionX < maxScroll)) { _service.ScrollPositionX += offset; } } else { float maxScroll = _service.ScrolledElement.MaxScrollY - _service.ScrolledElement.ScreenBounds.Height; if ((offset < 0 && _service.ScrollPositionY > 0) || (offset > 0 && _service.ScrollPositionY < maxScroll)) { _service.ScrollPositionY += offset; } } } break; case GestureType.Up: case GestureType.CapturedByOther: if (_touchIdX == gesture.TouchId) { _touchIdX = 0; _lastMoveTime = null; _service.ScrollSpeedX = _scrollSpeed.X; AppMain.Redraw(_view); } if (_touchIdY == gesture.TouchId) { _touchIdY = 0; _lastMoveTime = null; _service.ScrollSpeedY = _scrollSpeed.Y; AppMain.Redraw(_view); } break; case GestureType.HorizontalDrag: case GestureType.VerticalDrag: case GestureType.FreeDrag: if (gesture.PointerCapturedBy == null) { if (_touchIdX == 0 && _touchIdY == 0) { if (_view.IsPointInsideView(gesture.Origin)) { _touchIdX = _touchIdY = gesture.TouchId; gesture.CapturePointer(_view); } } } if (_touchIdX == gesture.TouchId || _touchIdY == gesture.TouchId) { float maxExceed = (float)_service.MaxExceed.ComputeDouble(); gesture.SetHandled(); if (_touchIdX != 0 && _mode.HasFlag(Mode.HorizontalDrag)) { if (_service.ScrollPositionX < -maxExceed && gesture.Offset.X > 0) { _service.ScrollPositionX = -maxExceed; } else if (_service.ScrollPositionX > _service.ScrolledElement.MaxScrollX + maxExceed && gesture.Offset.X < 0) { _service.ScrollPositionX = _service.ScrolledElement.MaxScrollX + maxExceed; } else { _service.ScrollPositionX -= gesture.Offset.X; } if (gesture.Offset.X != 0) { AppMain.Redraw(_view); } } if (_touchIdY != 0 && _mode.HasFlag(Mode.VerticalDrag)) { if (_service.ScrollPositionY < -maxExceed && gesture.Offset.Y > 0) { _service.ScrollPositionY = -maxExceed; } else if (_service.ScrollPositionY > _service.ScrolledElement.MaxScrollY + maxExceed && gesture.Offset.Y < 0) { _service.ScrollPositionY = _service.ScrolledElement.MaxScrollY + maxExceed; } else { _service.ScrollPositionY -= gesture.Offset.Y; } if (gesture.Offset.Y != 0) { AppMain.Redraw(_view); } } if (_lastMoveTime != null) { double time = (gesture.Time - _lastMoveTime.Value).TotalSeconds; time = Math.Max(time, 0.016f); if (_touchIdX != 0 && _mode.HasFlag(Mode.HorizontalDrag)) { _scrollSpeed.X = (_service.ScrollSpeedX - gesture.Offset.X / (float)time) / 2; } if (_touchIdY != 0 && _mode.HasFlag(Mode.VerticalDrag)) { _scrollSpeed.Y = (_service.ScrollSpeedY - gesture.Offset.Y / (float)time) / 2; } } else { _scrollSpeed.X = 0; _scrollSpeed.Y = 0; } _lastMoveTime = gesture.Time; } break; } _service.IsDraggingX = _touchIdX != 0; _service.IsDraggingY = _touchIdY != 0; }
public void OnRelease(Gesture gesture) { overUI = true; touchCountEqualsOne = false; pieceSelected = false; }
public void CheckIfOverUI(Gesture gesture) { overUI = gesture.IsOverUIElement(); touchCountEqualsOne = (gesture.touchCount == 1); pieceSelected = (gesture.pickedObject != null && (gesture.pickedObject == CurrentPiece || gesture.pickedObject == CurrentPiece.transform.parent)); }
// Token: 0x06000564 RID: 1380 RVA: 0x00028208 File Offset: 0x00026608 private void On_Cancel2Fingers(Gesture gesture) { base.gameObject.GetComponent <Renderer>().material.color = new Color(1f, 1f, 1f); this.textMesh.text = "Long tap"; }
public void On_DoubleTap(Gesture gesture) { AnimationControlls.instance.StopAllCoroutines(); StopRecord(); }
public void recognizeShape() { if (points.Count > 0) { List <float> posXs = new List <float> (); List <float> posYs = new List <float> (); foreach (var item in points) { posXs.Add(item.X); posYs.Add(item.Y); } float posXmin = posXs.Min(); float posXmax = posXs.Max(); float posYmin = posYs.Min(); float posYmax = posYs.Max(); float distanceX = posXmax - posXmin; float distanceY = posYmax - posYmin; float distanceCameraX = Camera.main.pixelWidth; float distanceCameraY = Camera.main.pixelHeight; float scaleX = distanceX / distanceCameraX; float scaleY = distanceY / distanceCameraY; recognized = true; if (scaleX >= minScaleFigure || scaleY >= minScaleFigure) { sound_handler.playRandomSound(); if (controller_player == null) { controller_player = FindObjectOfType <PlayerControllerFM> (); } Dictionary <String, int> array_names_spells; array_names_spells = new Dictionary <String, int> (); array_names_spells.Add("lineH", 0); array_names_spells.Add("lineV", 1); array_names_spells.Add("arrowUp", 2); array_names_spells.Add("arrowDown", 3); array_names_spells.Add("thunder", 4); array_names_spells.Add("yInverse", 5); array_names_spells.Add("chickenFoot", 6); array_names_spells.Add("X", 7); array_names_spells.Add("cross", 8); array_names_spells.Add("iluminati", 9); Gesture candidate = new Gesture(points.ToArray()); Result gestureResult = PointCloudRecognizer.Classify(candidate, trainingSet.ToArray()); message = gestureResult.GestureClass + " " + gestureResult.Score; controller_player.controlAnim.SetTrigger("attack"); int indexSpell; if (array_names_spells.TryGetValue(gestureResult.GestureClass, out indexSpell)) { effets.startCircleMagic(indexSpell); } if (onShapeRecognition != null) { onShapeRecognition(new Result(gestureResult.GestureClass, gestureResult.Score)); } } else { sound_handler.playBlock(); } if (recognized) { recognized = false; strokeId = -1; points.Clear(); foreach (LineRenderer lineRenderer in gestureLinesRenderer) { lineRenderer.SetVertexCount(0); Destroy(lineRenderer.gameObject); } gestureLinesRenderer.Clear(); } } }
public GestureEventArgs(Gesture gesture) { Gesture = gesture; }
public virtual void OnTouchStart2Fingers(Gesture gesture) { }
public virtual void OnSwipeStart(Gesture gesture) { }
public virtual void OnTouchUp2Fingers(Gesture gesture) { }
public virtual void OnDragStart(Gesture gesture) { }
public virtual void OnSwipeEnd(Gesture gesture) { }
public virtual void OnLongTapStart(Gesture gesture) { }
public virtual void OnDragEnd(Gesture gesture) { }
public virtual void OnSimpleTap(Gesture gesture) { }
public virtual void OnLongTapEnd(Gesture gesture) { }
public virtual void OnTouchStart(Gesture gesture) { }
public virtual void OnDoubleTap(Gesture gesture) { }
public virtual void OnSwipeEnd2Fingers(Gesture gesture) { }
/// <summary> /// /// </summary> /// <param name="gesture"></param> /// <returns>true 表示不继续向其他lisnter传递</returns> public virtual bool OnTouchUp(Gesture gesture) { return(false); }
public virtual void OnDragEnd2Fingers(Gesture gesture) { }
public virtual void OnCancel(Gesture gesture) { }
public virtual void OnPinchEnd(Gesture gesture) { }
public virtual void OnSwipeStart2Fingers(Gesture gesture) { }
public virtual void OnPinchIn(Gesture gesture) { }
public virtual void OnDragStart2Fingers(Gesture gesture) { }
public virtual void OnLongTapEnd2Fingers(Gesture gesture) { }
public virtual void OnPinchOut(Gesture gesture) { }
public virtual void OnLongTapStart2Fingers(Gesture gesture) { }
public virtual void OnTwistEnd(Gesture gesture) { }