private void OnJoystickMove(EJoystick move) { float x = move.joystickAxis.x; float y = move.joystickAxis.y; if (Math.Abs(x) > 0.1f || Math.Abs(y) > 0.1f) { ZTEvent.FireEvent(EventID.MOVING_JOYSTICK, x, y); } }
private void OnJoystickMove(EJoystick move) { float x = move.joystickAxis.x; float y = move.joystickAxis.y; if (Math.Abs(x) > 0.1f || Math.Abs(y) > 0.1f) { GTNetworkSend.Instance.TryMoveJoystick(x, y); } }
private void OnJoystickMove(EJoystick move) { float x = move.joystickAxis.x; float y = move.joystickAxis.y; if (Math.Abs(x) > 0.1f || Math.Abs(y) > 0.1f) { CharacterService.Instance.TryMoveJoystick(x, y); } }
public Vector2 GetAxis(EJoystick joystick) { Vector2 axis = Vector2.zero; for (int i = 0; i < m_InputDevices.Count; ++i) { if ((axis = m_InputDevices[i].GetAxis(joystick)) != Vector2.zero) { return(axis); } } return(axis); }
//得到摇杆输入 public override Vector2 GetAxis(EJoystick joystick) { if (joystick == EJoystick.LEFT) { m_Axis.x = UnityEngine.Input.GetAxis(InputConst.XBOX_KEYWORD_LEFT_JOY_H); m_Axis.y = UnityEngine.Input.GetAxis(InputConst.XBOX_KEYWORD_LEFT_JOY_V); } else if (joystick == EJoystick.RIGHT) { m_Axis.x = UnityEngine.Input.GetAxis(InputConst.XBOX_KEYWORD_RIGHT_JOY_H); m_Axis.y = UnityEngine.Input.GetAxis(InputConst.XBOX_KEYWORD_RIGHT_JOY_V); } return(m_Axis); }
public override Vector2 GetAxis(EJoystick joystick) { if (joystick == EJoystick.LEFT) { m_Axis.x = UnityEngine.Input.GetAxis("Horizontal"); m_Axis.y = UnityEngine.Input.GetAxis("Vertical"); } else if (joystick == EJoystick.RIGHT) { m_Axis.x = UnityEngine.Input.GetAxis("Mouse X"); m_Axis.y = UnityEngine.Input.GetAxis("Mouse Y"); } return(m_Axis); }
// Use this for initialization void Start() { ZTConfig.Instance.Init(); ZTInput.Instance.SetDontDestroyOnLoad(transform); CreateMainCamera(); ActorMainPlayer pActor = (ActorMainPlayer)AddActor(1, EActorType.PLAYER, EBattleCamp.A, XTransform.Create(this.transform.position, this.transform.eulerAngles), true); MainPlayer = pActor; Actor actor = (ActorPlayer)AddActor(50006, EActorType.MONSTER, EBattleCamp.B, XTransform.Create(this.transform.position, this.transform.eulerAngles), false); mNGUIJoystick = joysticktran.GetComponent <EJoystick>(); mNGUIJoystick.On_JoystickMove += OnJoystickMove; mNGUIJoystick.On_JoystickMoveEnd += OnJoystickMoveEnd; NGUICamera.clearFlags = CameraClearFlags.Depth; NGUICamera.depth = Define.DEPTH_CAM_2DUICAMERA; NGUICamera.nearClipPlane = -10; NGUICamera.farClipPlane = 1200; }
private void OnJoystickMoveEnd(EJoystick move) { ZTEvent.FireEvent(EventID.ENDING_JOYSTICK); }
private void OnJoystickMoveEnd(EJoystick move) { CharacterService.Instance.TryStopJoystick(); }
protected override void OnAwake() { mTop = transform.Find("Top"); mTopLeft = transform.Find("TopLeft"); mTopRight = transform.Find("TopRight"); mBottom = transform.Find("Bottom"); mBottomRight = transform.Find("BottomRight"); mBottomLeft = transform.Find("BottomLeft"); mTopRightGrid = mTopRight.Find("Grid"); btnMenu = mTopRight.Find("Pivot/Btn_Menu").gameObject; btnBag = mTopRight.Find("Pivot/Btn_Bag").gameObject; for (int i = 0; i < 6; i++) { ItemSkill tab = new ItemSkill(); Transform btn = mBottomRight.Find(i.ToString()); tab.btn = btn.gameObject; tab.lockSprite = btn.transform.Find("Lock").GetComponent <UISprite>(); tab.maskSprite = btn.transform.Find("Mask").GetComponent <UISprite>(); tab.icon = btn.transform.Find("Icon").GetComponent <UITexture>(); tab.maskSprite.gameObject.SetActive(false); mSkillBtns.Add((ESkillPos)i, tab); } mNGUIJoystick = mBottomLeft.FindChild("Joystick").GetComponent <EJoystick>(); mMapTexture = mTopRight.FindChild("Map/Texture").GetComponent <UITexture>(); mBar1 = mTopLeft.Find("Bar_1").GetComponent <UISlider>(); mBar2 = mTopLeft.Find("Bar_2").GetComponent <UISlider>(); mBar3 = mTopLeft.Find("Bar_3").GetComponent <UISlider>(); mBarValue1 = mBar1.transform.Find("Num").GetComponent <UILabel>(); mBarValue2 = mBar2.transform.Find("Num").GetComponent <UILabel>(); mPlayerIcon = mTopLeft.Find("Hero/Icon").GetComponent <UISprite>(); mPlayerLevel = mTopLeft.Find("Hero/Level").GetComponent <UILabel>(); mPlayerName = mTopLeft.Find("Hero/Name").GetComponent <UILabel>(); btnHero = mTopLeft.Find("Hero").gameObject; btnJump = mBottomRight.Find("Btn_Jump").gameObject; btnRide = mBottomRight.Find("Btn_Ride").gameObject; btnTemp = transform.Find("BtnTemplate").gameObject; btnTemp.SetActive(false); for (int i = 1; i <= 4; i++) { ItemBuff tab = new ItemBuff(); Transform trans = mTopLeft.transform.Find("Buff/" + i); tab.item = trans.gameObject; tab.item.SetActive(false); tab.icon = trans.Find("Icon").GetComponent <UISprite>(); tab.mask = trans.Find("Mask").GetComponent <UISprite>(); tab.ovelayNum = trans.Find("Num").GetComponent <UILabel>(); mBuffItems.Add(tab); } menuTask = mTopLeft.Find("Menus/Menu_Task").GetComponent <UIToggle>(); menuPartner = mTopLeft.Find("Menus/Menu_Partner").GetComponent <UIToggle>(); menuAutoFight = mBottomRight.Find("Btn_Auto").GetComponent <UIToggle>(); contentPartner = mTopLeft.Find("Menus/Content_Partner"); contentTask = mTopLeft.Find("Menus/Content_Task"); int group = GTWindowManager.Instance.GetToggleGroupId(); menuTask.group = group; menuPartner.group = group; switch (GTLauncher.Instance.CurrSceneType) { case ESceneType.TYPE_CITY: menuTask.value = true; break; case ESceneType.TYPE_WORLD: menuTask.value = true; break; case ESceneType.TYPE_PVE: menuPartner.value = true; break; } mTaskContentType1 = contentTask.Find("Type1").GetComponent <UILabel>(); mTaskContentType2 = contentTask.Find("Type2").GetComponent <UILabel>(); for (int i = 1; i <= 2; i++) { Transform trans = contentPartner.Find(i.ToString()); ItemPartner tab = new ItemPartner(); tab.heroGo = trans.gameObject; tab.heroIcon = trans.Find("Icon").GetComponent <UISprite>(); tab.heroQuality = trans.Find("Quality").GetComponent <UISprite>(); tab.heroName = trans.Find("Name").GetComponent <UILabel>(); tab.heroLevel = trans.Find("Level").GetComponent <UILabel>(); tab.heroHPSlider = trans.Find("HP").GetComponent <UISlider>(); tab.heroHPPercent = trans.Find("HP/Num").GetComponent <UILabel>(); tab.heroGo.SetActive(false); mPartners.Add(tab); } }
private void OnJoystickMoveEnd(EJoystick move) { GTNetworkSend.Instance.TryStopJoystick(); }
public abstract Vector2 GetAxis(EJoystick joystick);