Exemplo n.º 1
0
 /// <summary>
 /// 注册虚拟轴
 /// </summary>
 /// <param name="axis">虚拟轴</param>
 public void RegisterVirtualAxis(VirtualAxisBase axis)
 {
     if (axis == null)
     {
         Log.Error("Can no register null axis.");
         return;
     }
     CrossPlatformInputManager.RegisterVirtualAxis(axis);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 注册虚拟按钮
        /// </summary>
        /// <param name="button">虚拟按钮</param>
        public void UnRegisterVirtualAxis(VirtualAxisBase virtualAxis)
        {
            if (virtualAxis == null)
            {
                Log.Error("virtualAxis is null.");
                return;
            }

            if (string.IsNullOrEmpty(virtualAxis.Name))
            {
                Log.Error("name is invlid.");
                return;
            }

            CrossPlatformInputManager.UnRegisterVirtualAxis(virtualAxis.Name);
        }
Exemplo n.º 3
0
        protected override void OnOpen(object userData)
        {
            base.OnInit(userData);

            m_Joystick = new JoystickModule(UI);
            m_Joystick.OnMove.Add(this.OnJoystickMove);
            m_Joystick.OnEnd.Add(this.OnJoystickEnd);

            m_TouchPad = new TouchPadModule(UI);
            m_TouchPad.OnMove.Add(this.OnTouchPadMove);
            m_TouchPad.OnEnd.Add(this.OnTouchPadEnd);

            //注册输入
            m_HorizontalVirtualAxis = new VirtualAxisBase(Constant.Input.HorizontalAxis);
            m_VerticalVirtualAxis   = new VirtualAxisBase(Constant.Input.VerticalAxis);
            m_TouchPadXAxis         = new VirtualAxisBase(Constant.Input.PadXAxis);
            m_TouchPadYAxis         = new VirtualAxisBase(Constant.Input.PadYAxis);

            GameEntry.Input.RegisterVirtualAxis(m_HorizontalVirtualAxis);
            GameEntry.Input.RegisterVirtualAxis(m_VerticalVirtualAxis);
            GameEntry.Input.RegisterVirtualAxis(m_TouchPadXAxis);
            GameEntry.Input.RegisterVirtualAxis(m_TouchPadYAxis);
        }