protected override void BuidUI() { m_txtFps = this.MainGO.FindChildComponentRecursive <Text>("txtFps"); RectTransform rectTrans = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickRect"); m_cBaseTrans = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickBase"); m_cMoveTrans = this.MainGO.FindChildComponentRecursive <RectTransform>("JoystickMove"); m_cBtnSkillTest = this.MainGO.FindChildRecursive("btnSkillTest"); GameObject joystickGO = this.MainGO.FindChildRecursive("Joystick"); m_cJoystick = joystickGO.AddComponentOnce <UIJoystick>(); m_cJoystick.Init(rectTrans, m_cBaseTrans, m_cMoveTrans, m_cBaseTrans.rect.width / 2f, true); minDirLen = m_cBaseTrans.rect.width * 0.1f; m_cJoystick.OnBegin += OnJoystickBegin; m_cJoystick.OnMove += OnJoystickMove; m_cJoystick.OnEnd += OnJoystickEnd; m_cJoystick.AddKeyCode(KeyCode.A, Vector2.left); m_cJoystick.AddKeyCode(KeyCode.D, Vector2.right); m_cJoystick.AddKeyCode(KeyCode.W, Vector2.up); m_cJoystick.AddKeyCode(KeyCode.S, Vector2.down); //m_cJoystick.enabled = false; SetJoystickActive(false); UIEventTrigger.Get(m_cBtnSkillTest).AddListener(EventTriggerType.PointerClick, OnClick); //TouchDispatcher.instance.touchBeganListeners += OnTouch; }