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); }
public void RotationGestureDetectedSignalEmit() { tlog.Debug(tag, $"RotationGestureDetectedSignalEmit START"); var currentPid = global::System.Diagnostics.Process.GetCurrentProcess().Id; var currentTid = global::System.Threading.Thread.CurrentThread.ManagedThreadId; tlog.Debug(tag, $"thread check! main pid={App.mainPid}, current pid={currentPid}, main tid={App.mainTid}, current tid={currentTid}"); using (View view = new View()) { var testingTarget = new RotationGestureDetectedSignal(); Assert.IsNotNull(testingTarget, "Should be not null!"); Assert.IsInstanceOf <RotationGestureDetectedSignal>(testingTarget, "Should be an Instance of RotationGestureDetectedSignal!"); try { using (RotationGesture gesture = new RotationGesture(view.SwigCPtr.Handle, false)) { testingTarget.Emit(view, gesture); } } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } testingTarget.Dispose(); } tlog.Debug(tag, $"RotationGestureDetectedSignalEmit END (OK)"); }
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); }
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 OnRotate(EventContext context) { DOTween.Kill(_ball); RotationGesture gesture = (RotationGesture)context.sender; _ball.Rotate(Vector3.forward, -gesture.delta, Space.World); }
private void OnDetected(object obj, RotationGestureDetector.DetectedEventArgs e) { View v1 = e.View; e.View = v1; RotationGesture p1 = e.RotationGesture; e.RotationGesture = p1; }
private void OnRotate(EventContext context) { if (!EnableRotation) { RotationGesture gesture = (RotationGesture)context.sender; m_CameraCenter.transform.Rotate(Vector3.down, -gesture.delta, Space.World); } }
public void RotationGestureLocalCenterPoint() { tlog.Debug(tag, $"RotationGestureLocalCenterPoint START"); Gesture.StateType state = Gesture.StateType.Finished; RotationGesture a1 = new RotationGesture(state); Vector2 v1 = a1.LocalCenterPoint; tlog.Debug(tag, $"RotationGestureLocalCenterPoint END (OK)"); Assert.Pass("RotationGestureLocalCenterPoint"); }
public void RotationGestureRotation() { tlog.Debug(tag, $"RotationGestureRotation START"); Gesture.StateType state = Gesture.StateType.Finished; RotationGesture a1 = new RotationGesture(state); float f1 = a1.Rotation; tlog.Debug(tag, $"RotationGestureRotation END (OK)"); Assert.Pass("RotationGestureRotation"); }
public void RotationGestureConstructor() { tlog.Debug(tag, $"RotationGestureConstructor START"); Gesture.StateType state = Gesture.StateType.Finished; RotationGesture a2 = new RotationGesture(state); a2.Dispose(); tlog.Debug(tag, $"RotationGestureConstructor END (OK)"); Assert.Pass("RotationGesture"); }
public void RotationGestureGetRotationGestureFromPtr() { tlog.Debug(tag, $"RotationGestureGetRotationGestureFromPtr START"); Gesture.StateType state = Gesture.StateType.Finished; RotationGesture a2 = new RotationGesture(state); RotationGesture a1 = RotationGesture.GetRotationGestureFromPtr(RotationGesture.getCPtr(a2).Handle); a2.Dispose(); tlog.Debug(tag, $"RotationGestureGetRotationGestureFromPtr END (OK)"); Assert.Pass("RotationGestureGetRotationGestureFromPtr"); }
public void RotationGesturegetCPtr() { tlog.Debug(tag, $"RotationGesturegetCPtr START"); Gesture.StateType state = Gesture.StateType.Finished; RotationGesture a1 = new RotationGesture(state); global::System.Runtime.InteropServices.HandleRef r1 = RotationGesture.getCPtr(a1); tlog.Debug(tag, $"RotationGesturegetCPtr END (OK)"); Assert.Pass("RotationGesturegetCPtr"); }
public void OnDrag(PointerEventData eventData) { RotationGesture.OnDrag(eventData, _camera.WorldToScreenPoint(_selectionCenter)); }
public void OnBeginDrag(PointerEventData eventData) { _isUserRotateInput = true; RotationGesture.OnBeginDrag(eventData); }