void OnDragging(Vector2 delta) { if (curMainPlayer == null || curMainPlayer.isMoveLocked || curMainPlayer.isRigidity) { return; } if (curMainPlayer.isCasting || curMainPlayer.isCastingAttackEffect) { curMainPlayer.CancelAbility(); } if (isRockMove && Rocker != null && BackGround != null) { GoalPos += delta; Vector2 nowPos = GoalPos; if (GoalPos.magnitude > Range) { nowPos = Range * GoalPos.normalized; } Rocker.gameObject.transform.localPosition = nowPos; if (cameraTransform == null) { cameraTransform = GameCenter.cameraMng.mainCamera.transform; } Vector3 dir = nowPos.y * cameraTransform.forward + nowPos.x * cameraTransform.right; dir.y = 0.0f; dir = dir.normalized; if (GameCenter.curMainPlayer.isPathMoving) { GameCenter.curMainPlayer.StopMovingTo(); } if (dir == Vector3.zero) { GameCenter.curMainPlayer.StopMovingTowards(); } else { GameCenter.curMainPlayer.MoveTowards(dir); } //if (GameCenter.curMainPlayer.IsMoving) //{ // GameCenter.curMainPlayer.MoveToBy8Dir(ActorMoveFSM.TranslateTo8Dir(nowPos)); //} //else //{ // GameCenter.curMainPlayer.ForceMoveToBy8Dir(ActorMoveFSM.TranslateTo8Dir(nowPos)); //} } PlayerInputListener.isDragingRockerItem = true; }
void Update() { //if (!fsm.SceneAnimStage.IsWatching) //{ if (!UIMng.isClosingWnd && !UICamera.isOverUI && !hasKeyboardMoving)//解决主界面点击穿透的BUG by 易睿 { if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { TouchPoint(); } else { MousePoint(); } } else { pointDatas = null; UIMng.isClosingWnd = false; } //} //else //{ //} doPointDatas(); if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer) { //Debug.Log("进入省电模式的判断"); if (Input.touchCount > 0) { time = SystemSettingMng.POWERSAVING_TIME + (int)Time.time; if (GameCenter.systemSettingMng.OnPowerSavingEvent != null) { GameCenter.systemSettingMng.OnPowerSavingEvent(); } } } else { if (Input.anyKeyDown) { time = SystemSettingMng.POWERSAVING_TIME + (int)Time.time; if (GameCenter.systemSettingMng.OnPowerSavingEvent != null) { GameCenter.systemSettingMng.OnPowerSavingEvent(); } } } if (time - (int)Time.time < SystemSettingMng.POWERSAVING_TIME && time - (int)Time.time >= 0) { if (lastTime != (int)Time.time) { int showTime; showTime = time - (int)Time.time; int curTime = showTime % SystemSettingMng.POWERSAVING_TIME; if (curTime == 0) { if (!GameCenter.systemSettingMng.IsPowerSaving) { //GameCenter.uIMng.SwitchToUI(GUIType.NONE); //Debug.Log("进入省电模式"); GameCenter.uIMng.GenGUI(GUIType.POWERSAVING, true); } } } } lastTime = (int)Time.time; //if (Input.acceleration.x > 0 || Input.acceleration.y > 0 || Input.acceleration.z > 0) //{ // NGUIDebug.Log("重力加速度 x =" + Input.acceleration.x + " , y = " + Input.acceleration.y + " , z = " + Input.acceleration.z); // if (!target.isRigidity && !target.IsProtecting) // { // target.Jump(); // } //} //if (Input.gyro.gravity.sqrMagnitude > 0) //{ // NGUIDebug.Log("陀螺仪重力加速度 = " + Input.gyro.gravity); // if (!target.isRigidity && !target.IsProtecting) // { // target.Jump(); // } //} if (GameCenter.instance.isDevelopmentPattern) { if (Input.GetKeyDown(KeyCode.B)) //影响键盘输入 注释掉 { //target.AbilityTest(); } //测试用 by吴江 //if ( Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.Z)) //影响键盘输入 注释掉 //{ // target.BuffTest(1, true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.X)) //影响键盘输入 注释掉 //{ // target.BuffTest(33,true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.C)) //影响键盘输入 注释掉 //{ // target.BuffTest(34, true); //} //if (Input.GetKey(KeyCode.LeftShift) && Input.GetKeyDown(KeyCode.V)) //影响键盘输入 注释掉 //{ // target.BuffTest(36, true); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.Z)) //影响键盘输入 注释掉 //{ // target.BuffTest(1, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.X)) //影响键盘输入 注释掉 //{ // target.BuffTest(33, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.C)) //影响键盘输入 注释掉 //{ // target.BuffTest(34, false); //} //if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.V)) //影响键盘输入 注释掉 //{ // target.BuffTest(36, false); //} //if (Input.GetKey(KeyCode.I))//测试 试炼场 by龙英杰 //{ // GameCenter.uIMng.SwitchToUI(GUIType.WILDBOSS); //} //if (Input.GetKey(KeyCode.P))//测试每日活动LZR //{ // // GameCenter.uIMng.SwitchToUI(GUIType.DailyActivity); // GameCenter.uIMng.SwitchToUI(GUIType.RANDCHEST); //} if (Input.GetKey(KeyCode.O))//测试每日活动LZR { // GameCenter.uIMng.SwitchToUI(GUIType.CAMPJOIN); // GameCenter.uIMng.SwitchToUI(GUIType.MAILBOX); } if (Input.GetKeyDown(KeyCode.H)) { // GameCenter.sceneAnimMng.PushSceneAnima(GameCenter.instance.cur_Text_SceneAnima_ID); } //if(Input.GetKeyDown(KeyCode.Alpha1)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(0); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha2)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(1); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha3)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(2); // } //} //else if (Input.GetKeyDown(KeyCode.Alpha4)) //{ // SkillWnd wnd = GameCenter.uIMng.GetGui<SkillWnd>(); // if (wnd != null) // { // wnd.OnClickSkillBtnActon(3); // } //} if (Input.GetKeyDown(KeyCode.Tab)) { GameCenter.curMainPlayer.ChangeTarget(); } if (Input.GetKeyDown(KeyCode.H)) { //GameCenter.uIMng.SwitchToUI(GUIType.CAMPMAIN); //GameCenter.campMng.C2S_AskCampActivity(CampAction.ACTIVITY); // GameCenter.mainPlayerMng.protectMinerMng.FinalData = new FinalSettlemenInfo(); //GameCenter.uIMng.SwitchToUI(GUIType.MAILBOX); } //if (Input.GetKey(KeyCode.L)) //{ // GameCenter.chapterRewardMng.Set(); //} if (Input.GetKey(KeyCode.Space)) { target.Jump(); } if (!isDragingRockerItem) { hasKeyboardMoving = Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A); if (hasKeyboardMoving) { Vector3 vWS = Vector3.zero; Vector3 vAD = Vector3.zero; Transform mainCamTrasform = GameCenter.cameraMng.mainCamera.transform; if (Input.GetKey(KeyCode.W)) { vWS += mainCamTrasform.forward; } if (Input.GetKey(KeyCode.S)) { vWS -= mainCamTrasform.forward; } if (Input.GetKey(KeyCode.D)) { vAD += mainCamTrasform.right; } if (Input.GetKey(KeyCode.A)) { vAD -= mainCamTrasform.right; } if (!target.isRigidity) { target.CancelAbility(true); } target.AttakType = MainPlayer.AttackType.NONE; target.CancelCommands(); Vector3 dir = vWS + vAD; dir.y = 0.0f; dir.Normalize(); if (dir == Vector3.zero) { target.StopMovingTowards(); } else { target.MoveTowards(dir); } } else if (target.isMovingTowards) { target.StopMovingTowards(); } } } }