コード例 #1
0
    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);
    }
コード例 #2
0
ファイル: GestureMain.cs プロジェクト: xiaozhehlq/JohnWork
    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);
    }
コード例 #3
0
        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)");
        }
コード例 #4
0
ファイル: GestureMain.cs プロジェクト: Hengle/U3D_Demo
    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);
    }
コード例 #5
0
    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);
    }
コード例 #6
0
ファイル: GestureMain.cs プロジェクト: zz0733/Fishing
    void OnRotate(EventContext context)
    {
        DOTween.Kill(_ball);

        RotationGesture gesture = (RotationGesture)context.sender;

        _ball.Rotate(Vector3.forward, -gesture.delta, Space.World);
    }
コード例 #7
0
		private void OnDetected(object obj, RotationGestureDetector.DetectedEventArgs e)
		{
            View v1 = e.View;
            e.View = v1;
			
            RotationGesture p1 = e.RotationGesture;
            e.RotationGesture = p1;
		}		
コード例 #8
0
 private void OnRotate(EventContext context)
 {
     if (!EnableRotation)
     {
         RotationGesture gesture = (RotationGesture)context.sender;
         m_CameraCenter.transform.Rotate(Vector3.down, -gesture.delta, Space.World);
     }
 }
コード例 #9
0
        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");
        }
コード例 #10
0
        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");
        }
コード例 #11
0
        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");
        }
コード例 #12
0
        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");
        }
コード例 #13
0
        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");
        }
コード例 #14
0
ファイル: CellSelector.cs プロジェクト: musapkahraman/hexagon
 public void OnDrag(PointerEventData eventData)
 {
     RotationGesture.OnDrag(eventData, _camera.WorldToScreenPoint(_selectionCenter));
 }
コード例 #15
0
ファイル: CellSelector.cs プロジェクト: musapkahraman/hexagon
 public void OnBeginDrag(PointerEventData eventData)
 {
     _isUserRotateInput = true;
     RotationGesture.OnBeginDrag(eventData);
 }