void Start() { _mainView = this.GetComponent <UIPanel>().ui; //空矩形图形组件(设置上下居中和左右居中关联于容器组件) GObject holder = _mainView.GetChild("holder"); //获取Unity对象地球的transform _ball = GameObject.Find("Globe").transform; //滑动手势 TouchBegin->TouchMove->TouchEnd流程 SwipeGesture gesture1 = new SwipeGesture(holder); gesture1.onMove.Add(OnSwipeMove); gesture1.onEnd.Add(OnSwipeEnd); //长按手势 once长按时间内是否只派发一次事件 ,interval间隔时间 LongPressGesture gesture2 = new LongPressGesture(holder); gesture2.once = false; gesture2.onAction.Add(OnHold); //两指缩放手势 PinchGesture gesture3 = new PinchGesture(holder); gesture3.onAction.Add(OnPinch); //两指旋转的手势 RotationGesture gesture4 = new RotationGesture(holder); gesture4.onAction.Add(OnRotate); }
void LongPressEventHandler(LongPressGesture gesture) { if (longPressMethods != null) { longPressMethods(gesture.Position, gesture.Selection); } }
void Start() { Inst = this; GameEntry.Event.Subscribe(EvtDataUpdated.EventId, OnEvtDataUpdated); GameEntry.Event.Subscribe(EvtTempDataUpdated.EventId, OnEvtTempDataUpdated); GameEntry.Event.Subscribe(EvtEventTriggered.EventId, OnEvtEventTriggered); GameEntry.Event.Subscribe(EvtZooBusinessTriggered.EventId, OnEvtZooBusinessTriggered); GameEntry.Event.Subscribe(EvtDataReseted.EventId, OnEvtDataReseted); GObject holder = m_GesturePanel.ui.GetChild("holder"); holder.onClick.Add(OnClick); for (int i = 0; i < m_BtnUnlockAreas.Length; i++) { UIPanel btnPanel = m_BtnUnlockAreas[i]; btnPanel.ui.data = i + 1; btnPanel.ui.onClick.Set(OnClickUnlockArea); } LongPressGesture = new LongPressGesture(holder); LongPressGesture.once = false; LongPressGesture.onAction.Add(OnLongPress); SwipeGesture = new SwipeGesture(holder); SwipeGesture.onBegin.Add(OnSwipeBegin); SwipeGesture.onMove.Add(OnSwipeMove); SwipeGesture.onEnd.Add(OnSwipeEnd); PinchGesture = new PinchGesture(holder); PinchGesture.onAction.Add(OnPinch); RotationGesture = new RotationGesture(holder); RotationGesture.onAction.Add(OnRotate); }
void Start() { _mainView = this.GetComponent <UIPanel>().ui; GObject holder = _mainView.GetChild("holder"); _ball = GameObject.Find("Globe").transform; SwipeGesture gesture1 = new SwipeGesture(holder); gesture1.onMove.Add(OnSwipeMove); gesture1.onEnd.Add(OnSwipeEnd); LongPressGesture gesture2 = new LongPressGesture(holder); gesture2.once = false; gesture2.onAction.Add(OnHold); PinchGesture gesture3 = new PinchGesture(holder); gesture3.onAction.Add(OnPinch); RotationGesture gesture4 = new RotationGesture(holder); gesture4.onAction.Add(OnRotate); }
//------------------------------------------------------------------------- void OnLongPress(LongPressGesture gesture) { if (onFingerLongPress != null) { onFingerLongPress(gesture.Position); } }
public void GestureTime() { tlog.Debug(tag, $"GestureTime START"); try { var longPressGesture = new LongPressGesture(Gesture.StateType.Cancelled); Assert.IsNotNull(longPressGesture, "Can't create success object LongPressGesture"); var gesture = new Gesture(longPressGesture); Assert.IsNotNull(gesture, "Can't create success object Gesture"); Assert.IsInstanceOf <Gesture>(gesture, "Should be an instance of Gesture type."); uint time = gesture.Time; Assert.GreaterOrEqual(time, 0, "Should be greater or equal 0"); gesture.Dispose(); longPressGesture.Dispose(); } catch (Exception e) { Tizen.Log.Error(tag, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"GestureTime END (OK)"); Assert.Pass("GestureTime"); }
public void GestureState() { tlog.Debug(tag, $"GestureState START"); try { var longPressGesture = new LongPressGesture(Gesture.StateType.Cancelled); Assert.IsNotNull(longPressGesture, "Can't create success object LongPressGesture"); var gesture = new Gesture(longPressGesture); Assert.IsNotNull(gesture, "Can't create success object Gesture"); Assert.IsInstanceOf <Gesture>(gesture, "Should be an instance of Gesture type."); Gesture.StateType state = gesture.State; Assert.AreEqual(Gesture.StateType.Cancelled, state, "Should be same value"); gesture.Dispose(); longPressGesture.Dispose(); } catch (Exception e) { Tizen.Log.Error(tag, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } tlog.Debug(tag, $"GestureState END (OK)"); Assert.Pass("GestureState"); }
// Use this for initialization protected virtual void Start() { PressGesture press = gameObject.AddComponent <PressGesture> (); press.Pressed += TouchEvent; PanGesture pan = gameObject.AddComponent <PanGesture> (); pan.Panned += TouchEvent; TapGesture tap = gameObject.AddComponent <TapGesture>(); tap.Tapped += TouchEvent; tap.NumberOfTapsRequired = 2; tap.TimeLimit = 0.5f; ScaleGesture scale = gameObject.AddComponent <ScaleGesture> (); scale.Scaled += TouchEvent; gameObject.AddComponent <PressGesture>().Pressed += TouchEvent; LongPressGesture longPress = gameObject.AddComponent <LongPressGesture>(); longPress.LongPressed += TouchEvent; longPress.TimeToPress = 0.2f; longPress.AddFriendlyGesture(pan); gameObject.AddComponent <ReleaseGesture>().Released += TouchEvent; }
//Gesture used to start moving backward void OnLongPressDoubleFinger(LongPressGesture gesture) { if (!GUISprites.isOnAGUIElement) { startMovingBackWard = true; } }
void OnLongPress(LongPressGesture gesture) { if (!enabled) { return; } if (currentSelected != null) { /*DOTween.Kill ("InputRotate_InitialPosition", true); * DOTween.Kill ("InputRotate_SelectedScale", true);*/ /*selectedInitialPosition = currentSelected.transform.position; * selectedInitialScale = currentSelected.transform.localScale;*/ Vector3 posOverFinger = Camera.main.ScreenToWorldPoint(new Vector3(gesture.Position.x, gesture.Position.y, 0)); posOverFinger.z = 0; posOverFinger += offsetPositionOverFinger; moveTo(currentSelected, posOverFinger, pieceSpeed); currentSelected.transform.DOScale(initialScale, .1f); gameManager.showShadowOnPiece(currentSelected, true); if (AudioManager.GetInstance()) { AudioManager.GetInstance().Stop("pieceSelected"); AudioManager.GetInstance().Play("pieceSelected"); } isLongPressed = true; } }
void OnLongPress(LongPressGesture gesture) { if (onLongPressHandle != null) { onLongPressHandle(gesture); } }
void OnLongPress(LongPressGesture gesture) { if (!enabled) { return; } if (allowInput && gesture.Raycast.Hit2D && letter != null) { activateRayCasters(false); Vector3 tempV3 = new Vector3(); offset = letter.transform.position.y; offset += objectSize.y * 0.5f; tempV3.x = letter.transform.position.x; tempV3.y = offset; //offset; tempV3.z = letter.transform.position.z; //letter.transform.position = tempV3; moveTo(letter, tempV3, letterSpeed); canDeleteLetter = false; onDragStart(letter); isOnLettersContainer = true; } }
void Start() { Application.targetFrameRate = 60; GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(OnKeyDown); UIPackage.AddPackage("UI/Gesture"); _mainView = UIPackage.CreateObject("Gesture", "Main").asCom; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); GObject holder = _mainView.GetChild("holder"); _ball = GameObject.Find("Globe").transform; SwipeGesture gesture1 = new SwipeGesture(holder); gesture1.onMove.Add(OnSwipeMove); gesture1.onEnd.Add(OnSwipeEnd); LongPressGesture gesture2 = new LongPressGesture(holder); gesture2.once = false; gesture2.onAction.Add(OnHold); PinchGesture gesture3 = new PinchGesture(holder); gesture3.onAction.Add(OnPinch); RotationGesture gesture4 = new RotationGesture(holder); gesture4.onAction.Add(OnRotate); }
public static IObservable <EventPattern <EventArgs> > LongPressedAsObservable(this LongPressGesture gesture) { return(Observable.FromEventPattern <EventHandler <EventArgs>, EventArgs>( h => h.Invoke, h => gesture.LongPressed += h, h => gesture.LongPressed -= h)); }
void OnLongPress(LongPressGesture gesture) { Debug.Log("call OnLongPress"); if (selectDelegate != null) { selectDelegate(gesture.Selection); } }
void OnLongPress(LongPressGesture gesture) { if (gesture.Selection == longPressObject) { SpawnParticles(longPressObject); UI.StatusText = "Performed a long-press with finger " + gesture.Fingers[0]; } }
protected override void OnEnable() { base.OnEnable(); gesture = GetComponent <TapGesture>(); gesture.Tapped += pressedHandler; longGesture = GetComponent <LongPressGesture>(); longGesture.LongPressed += longPressedHandler; }
void OnLongPress( LongPressGesture gesture ) { if( gesture.Selection == longPressObject ) { SpawnParticles( longPressObject ); UI.StatusText = "Performed a long-press with finger " + gesture.Fingers[0]; } }
private void OnEnable() { longPressGesture = GetComponent <LongPressGesture>(); TapGesture = GetComponent <TapGesture>(); longPressGesture.LongPressed += LongPressGesture_LongPressed; TapGesture.Tapped += TapGesture_Tapped; }
void OnLongPress(LongPressGesture gesture) { if (gesture.Selection == longPressObject) { string msg = "Performed a long-press with finger " + gesture.Fingers[0]; Debug.Log(msg); gesture.Selection.GetComponent <WorldTypeControl>().ChangeWorldType(); } }
//Gesture used to start moving forward void OnLongPress(LongPressGesture gesture) { //if ((gesture.StartSelection && !GUISprites.isOnAGUIElement) || (gesture.StartSelection.tag == "RoomBoundingBox" && !GUISprites.isOnAGUIElement)) //if (gesture.StartSelection.tag == "Furniture" && !GUISprites.isOnAGUIElement) if (gesture.StartSelection && gesture.StartSelection.CompareTag("RoomBoundingBox") && !GUISprites.isOnAGUIElement) { startMovingForward = true; } }
void OnLongPress(LongPressGesture gesture) { //if( gesture.Selection ) // LogUtil.Log( "LongPress object: " + gesture.Selection.name ); //else // LogUtil.Log( "No object was long pressed at " + gesture.Position ); Messenger <LongPressGesture> .Broadcast(FingerGesturesMessages.OnLongPress, gesture); }
private void OnEnable() { rnd = GetComponent <MeshRenderer>(); longPressGesture = GetComponent <LongPressGesture>(); pressGesture = GetComponent <PressGesture>(); longPressGesture.StateChanged += longPressedHandler; pressGesture.Pressed += pressedHandler; }
public override void OnRegister() { transformGesture = GetComponent <TransformGestureBase>(); longPressGesture = GetComponent <LongPressGesture>(); if (transformGesture != null) { transformGesture.Transformed += OnTransformGesture; } longPressGesture.StateChanged += ShowMenu; }
private void OnDetected(object obj, LongPressGestureDetector.DetectedEventArgs e) { View v1 = e.View; e.View = v1; LongPressGesture p1 = e.LongPressGesture; e.LongPressGesture = p1; }
internal static LongPressGesture GetLongPressGestureFromPtr(global::System.IntPtr cPtr) { LongPressGesture ret = new LongPressGesture(cPtr, false); if (NDalicPINVOKE.SWIGPendingException.Pending) { throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public override void OnEnter() { gesture = GestureUtils.GetGesture <LongPressGesture>(Fsm, GameObject, Component, true); if (gesture == null) { LogError("Gesture is missing"); return; } gesture.LongPressed += gesturePressedHandler; }
public void LongPressGestureNumberOfTouches() { tlog.Debug(tag, $"LongPressGestureNumberOfTouches START"); Gesture.StateType state = Gesture.StateType.Finished; LongPressGesture ret1 = new LongPressGesture(state); uint num = ret1.NumberOfTouches; tlog.Debug(tag, $"LongPressGestureNumberOfTouches END (OK)"); Assert.Pass("LongPressGestureNumberOfTouches"); }
public void LongPressGestureConstructor() { tlog.Debug(tag, $"LongPressGestureConstructor START"); Gesture.StateType state = Gesture.StateType.Finished; LongPressGesture ret1 = new LongPressGesture(state); ret1.Dispose(); tlog.Debug(tag, $"LongPressGestureConstructor END (OK)"); Assert.Pass("LongPressGestureConstructor"); }
public void LongPressGesturegetCPtr() { tlog.Debug(tag, $"LongPressGesturegetCPtr START"); Gesture.StateType state = Gesture.StateType.Finished; LongPressGesture ret1 = new LongPressGesture(state); global::System.Runtime.InteropServices.HandleRef a = LongPressGesture.getCPtr(ret1); tlog.Debug(tag, $"LongPressGesturegetCPtr END (OK)"); Assert.Pass("LongPressGestureLocalPoint"); }
/// <summary> /// Mies the long press event handler. /// </summary> /// <param name="gesture">Gesture.</param> void MyLongPressEventHandler(LongPressGesture gesture) { MyGestureParameter mgp = new MyGestureParameter("longpress"); pctrl.SetGesture(mgp); Vector2 v2 = new Vector2(gesture.Position.x - Screen.width / 2, gesture.Position.y - Screen.height / 2); uictrl.SetSpriteStatus("kuang", true, v2); tp.MyTakePhoto(gesture.Position); StartCoroutine(DisableKuang()); }
void OnLongPress(LongPressGesture gesture) { //timothy.SendMessage ("TimothyBrake", SendMessageOptions.DontRequireReceiver); }
/// <summary> /// 长按事件 /// </summary> /// <param name="fingerIndex"></param> /// <param name="fingerPos"></param> void OnLongPress(LongPressGesture gesture) { bIsLongPress = true; ///< UI层不做处理 if (null != UICamera.hoveredObject) { return; } ///< 滑动过程中也不能删除 if (bIsMovePress) { return; } ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (Vector3.Distance(hit.transform.position, transform.position) < SunmConstant.RayMaxLimit && Vector3.Distance(hit.transform.position, transform.position) > SunmConstant.RayMinLimit) { if (hit.collider.gameObject.name.Equals("(100.0, 100.0, 100.0)")) { return; } if (!bISAddCube) { return; } SunmGameInit.setThreeArray(hit.collider.transform.position, 0); SunmCubeOpt.RemoveCube(hit.collider.gameObject); ///< 销毁放开,播放粒子方块 Instantiate(Resources.Load("Prefab/Model/Effect/CoinCollectFlash"), hit.transform.position, SunmConstant.rootCube.transform.rotation); MusicPlayer.Play(MusicPlayer.WHICH_SOUND.BREAKCUBE); gameObject.SendMessage("ArchiveMessageProcessing", new object[] { hit.collider.transform.position }); ///< 给自己发送消息 } } }
//长按事件, void MyLongPressEventHandler(LongPressGesture gesture) { Debug.Log ("long press" ); //进入加速状态,我没改变进入此方法的时间,默认1秒, pressToSpeedUp = true; //播放动画, }
public void OnLongPress(LongPressGesture longPress) { if (longPress.State == GestureRecognitionState.Recognized) { _updates.Add(new InputMessage( InputMessage.InputTypes.OneFingerLongTap, InputMessage.MessageTypes.Transient, longPress.Fingers.Select(f => f.Position).ToList(), longPress.Fingers.Select(f => f.DeltaPosition).ToList() )); } }