コード例 #1
0
        private void OnJoystickMove(EventContext context)
        {
            JoystickEventData data = (JoystickEventData)context.data;

            //Log.Warning(data.DeltaX + "****" + data.DelatY + "****" + data.Degree);
            m_HorizontalVirtualAxis.Update(data.DeltaX);
            m_VerticalVirtualAxis.Update(data.DeltaY);
        }
コード例 #2
0
        public JoystickModule(GComponent mainView)
        {
            OnMove = new EventListener(this, "onMove");
            OnEnd  = new EventListener(this, "onEnd");

            m_button = mainView.GetChild("joystick").asButton;
            m_button.changeStateOnClick = false;
            m_thumb      = m_button.GetChild("thumb");
            m_touchArea  = mainView.GetChild("joystick_touch");
            m_center     = mainView.GetChild("joystick_center");
            m_controller = mainView.GetController("joystick");
            m_controller.selectedIndex = 1;

            m_InitX   = m_center.x + m_center.width / 2;
            m_InitY   = m_center.y + m_center.height / 2;
            m_touchId = -1;
            Radius    = 150;
            m_data    = new JoystickEventData();

            m_touchArea.onTouchBegin.Add(this.OnTouchBegin);
            m_touchArea.onTouchMove.Add(this.OnTouchMove);
            m_touchArea.onTouchEnd.Add(this.OnTouchEnd);
        }