public override void Update()
 {
     if (TsPlatform.IsMobile)
     {
         if (this.m_FilePercent != null && this.m_Percent != null)
         {
             string text = string.Empty;
             if (this.m_FilePercent.Visible)
             {
                 text = this.m_FilePercent.Text;
             }
             if (this.m_Percent.Visible)
             {
                 text = text + "\nTotal : " + this.m_Percent.Text;
             }
             NrTSingleton <NrUserDeviceInfo> .Instance.SetMovieText(text);
         }
         Vector3 mousePosition = Input.mousePosition;
         if (NkInputManager.GetMouseButton(0) && this.m_v3TouchStart != Vector3.zero && this.m_v3TouchStart != mousePosition)
         {
             if (mousePosition != Vector3.zero && this.pRealChar != null && Mathf.Abs(this.m_v2TouchStart.x - mousePosition.x) > 5f)
             {
                 this.m_fTempAngle = 360f * ((this.m_v2TouchStart.x - mousePosition.x) / (float)Screen.width);
                 Quaternion rotation = Quaternion.Lerp(Quaternion.identity, Quaternion.AngleAxis(this.m_fAngle + this.m_fTempAngle, Vector3.up), Time.time * 0.1f);
                 this.pRealChar.transform.rotation = rotation;
             }
         }
         else if (NkInputManager.GetMouseButtonUp(0))
         {
             if (mousePosition != Vector3.zero && this.pTouchEffectPrefab != null)
             {
                 this.SetTouchEffcet(new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y));
                 this.m_v3TouchStart = Vector3.zero;
             }
         }
         else if (NkInputManager.GetMouseButtonDown(0) && mousePosition != Vector3.zero)
         {
             this.m_v2TouchStart = new Vector2(mousePosition.x, (float)Screen.height - mousePosition.y);
             this.m_v3TouchStart = mousePosition;
             this.m_fAngle       = this.pRealChar.transform.rotation.eulerAngles.y;
         }
     }
 }
示例#2
0
        private void CharacterRotation()
        {
            if (this._costumeChar == null)
            {
                return;
            }
            Vector3 mousePosition = Input.mousePosition;

            if (NkInputManager.GetMouseButton(0) && this._v3TouchStart != Vector3.zero && this._v3TouchStart != mousePosition)
            {
                if (mousePosition != Vector3.zero && Mathf.Abs(this._v2TouchStart.x - mousePosition.x) > 5f)
                {
                    this._fTempAngle = 360f * ((this._v2TouchStart.x - mousePosition.x) / (float)Screen.width);
                    Quaternion rotation = Quaternion.Lerp(Quaternion.identity, Quaternion.AngleAxis(this._fAngle + this._fTempAngle, Vector3.up), Time.time * 0.1f);
                    this._costumeChar.transform.rotation = rotation;
                }
            }
            else if (NkInputManager.GetMouseButtonUp(0) && mousePosition != Vector3.zero)
            {
                this._v3TouchStart = Vector3.zero;
            }
        }
    private void InputMouse()
    {
        if (this.m_SoldierBatch.CastedTarget.MakeUpCharInfo.m_SolID != 0L)
        {
            return;
        }
        bool flag = false;

        if (NkInputManager.GetMouseButton(0) || NkInputManager.GetMouseButton(2))
        {
            flag = true;
        }
        if (NkInputManager.GetMouseButtonUp(0) || NkInputManager.GetMouseButtonUp(2))
        {
            flag = false;
        }
        if (flag)
        {
            if (this.m_veScrollStart == Vector3.zero)
            {
                this.m_veScrollStart = NkInputManager.mousePosition;
                this.m_SoldierBatch.CastedTarget.CAMERA.SetScrollView(true);
            }
            else
            {
                Vector3 vector = this.m_veScrollStart - NkInputManager.mousePosition;
                this.m_SoldierBatch.CastedTarget.CAMERA.CameraScrollMove(vector.x, vector.y);
                this.m_veScrollStart = NkInputManager.mousePosition;
            }
        }
        if (!flag)
        {
            this.m_veScrollStart = Vector3.zero;
            this.m_SoldierBatch.CastedTarget.CAMERA.SetScrollView(false);
        }
    }
示例#4
0
 public bool GetAxisRange(ref float fXrange, ref float fYRange)
 {
     if (TsPlatform.IsMobile)
     {
         if (TsPlatform.IsEditor)
         {
             if (NkInputManager.GetMouseButton(1))
             {
                 fXrange  = Input.GetAxis("Mouse X");
                 fYRange  = Input.GetAxis("Mouse Y");
                 fXrange *= this.xSpeed;
                 fYRange *= this.ySpeed;
             }
             return(true);
         }
         bool flag = false;
         if (Scene.CurScene == Scene.Type.WORLD)
         {
             flag = true;
         }
         if (flag && NkInputManager.IsJoystick())
         {
             int touchCount = Input.touchCount;
             if (touchCount == 0)
             {
                 return(false);
             }
             if (touchCount != 2)
             {
                 return(false);
             }
             Vector2 deltaPosition  = Input.GetTouch(0).deltaPosition;
             Vector2 deltaPosition2 = Input.GetTouch(1).deltaPosition;
             Vector2 vector         = Vector2.zero;
             this.m_bRotate = false;
             if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Stationary)
             {
                 vector         = deltaPosition;
                 this.m_bRotate = true;
             }
             else if (Input.GetTouch(1).phase == TouchPhase.Moved && Input.GetTouch(0).phase == TouchPhase.Stationary)
             {
                 vector         = deltaPosition2;
                 this.m_bRotate = true;
             }
             else if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved)
             {
                 vector         = deltaPosition2;
                 this.m_bRotate = true;
             }
             if (this.m_bRotate)
             {
                 fXrange = vector.x / (float)Screen.width * 1280f * this.xSpeed * this.m_fMobileRotate;
                 fYRange = vector.y / (float)Screen.height * 720f * this.ySpeed * this.m_fMobileRotate;
             }
         }
         else if (flag)
         {
             if (NrTSingleton <FormsManager> .Instance.IsMouseOverForm())
             {
                 return(false);
             }
             int touchCount2 = Input.touchCount;
             if (touchCount2 != 1)
             {
                 return(false);
             }
             Vector2 deltaPosition3 = Input.GetTouch(0).deltaPosition;
             Vector2 vector2        = Vector2.zero;
             this.m_bRotate = false;
             if (Input.GetTouch(0).phase == TouchPhase.Moved)
             {
                 vector2        = deltaPosition3;
                 this.m_bRotate = true;
             }
             if (this.m_bRotate)
             {
                 fXrange = vector2.x / (float)Screen.width * 1280f * this.xSpeed * this.m_fMobileRotate;
                 fYRange = vector2.y / (float)Screen.height * 720f * this.ySpeed * this.m_fMobileRotate;
             }
         }
         else
         {
             int touchCount3 = Input.touchCount;
             if (touchCount3 == 0)
             {
                 return(false);
             }
             if (touchCount3 != 2)
             {
                 return(false);
             }
             Vector2 deltaPosition4 = Input.GetTouch(0).deltaPosition;
             Vector2 deltaPosition5 = Input.GetTouch(1).deltaPosition;
             Vector2 vector3        = Vector2.zero;
             this.m_bRotate = false;
             if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Stationary)
             {
                 vector3        = deltaPosition4;
                 this.m_bRotate = true;
             }
             else if (Input.GetTouch(1).phase == TouchPhase.Moved && Input.GetTouch(0).phase == TouchPhase.Stationary)
             {
                 vector3        = deltaPosition5;
                 this.m_bRotate = true;
             }
             else if (Input.GetTouch(0).phase == TouchPhase.Moved && Input.GetTouch(1).phase == TouchPhase.Moved)
             {
                 vector3        = deltaPosition5;
                 this.m_bRotate = true;
             }
             if (this.m_bRotate)
             {
                 fXrange = vector3.x / (float)Screen.width * 1280f * this.xSpeed * this.m_fMobileRotate;
                 fYRange = vector3.y / (float)Screen.height * 720f * this.ySpeed * this.m_fMobileRotate;
             }
         }
         if (Scene.CurScene == Scene.Type.BATTLE && Battle.BATTLE != null)
         {
             Battle.BATTLE.SetCameraRotate(this.m_bRotate);
         }
         return(true);
     }
     else
     {
         if (NkInputManager.GetMouseButton(1))
         {
             fXrange  = Input.GetAxis("Mouse X");
             fYRange  = Input.GetAxis("Mouse Y");
             fXrange *= this.xSpeed;
             fYRange *= this.ySpeed;
             return(true);
         }
         return(false);
     }
 }
 public void Update()
 {
     if (!EventTriggerMiniCamera._bUseControll)
     {
         return;
     }
     if (NkInputManager.GetKeyUp(KeyCode.KeypadEnter))
     {
         EventTriggerMiniCamera.m_bControllPosition = !EventTriggerMiniCamera.m_bControllPosition;
     }
     if (NkInputManager.GetKey(KeyCode.Keypad8))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition += base.gameObject.transform.up.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(-EventTriggerMiniCamera.m_Reaction, 0f, 0f);
         }
     }
     if (NkInputManager.GetKey(KeyCode.Keypad2))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition -= base.gameObject.transform.up.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(EventTriggerMiniCamera.m_Reaction, 0f, 0f);
         }
     }
     if (NkInputManager.GetKey(KeyCode.Keypad4))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition -= base.gameObject.transform.right.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(0f, -EventTriggerMiniCamera.m_Reaction, 0f);
         }
     }
     if (NkInputManager.GetKey(KeyCode.Keypad6))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition += base.gameObject.transform.right.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(0f, EventTriggerMiniCamera.m_Reaction, 0f);
         }
     }
     if (NkInputManager.GetKey(KeyCode.KeypadPeriod))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition += base.gameObject.transform.forward.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(0f, 0f, EventTriggerMiniCamera.m_Reaction);
         }
     }
     if (NkInputManager.GetKey(KeyCode.Keypad0))
     {
         if (EventTriggerMiniCamera.m_bControllPosition)
         {
             base.gameObject.transform.localPosition -= base.gameObject.transform.forward.normalized * EventTriggerMiniCamera.m_Reaction;
         }
         else
         {
             base.gameObject.transform.localEulerAngles += new Vector3(0f, 0f, -EventTriggerMiniCamera.m_Reaction);
         }
     }
     if (NkInputManager.GetKey(KeyCode.KeypadPlus))
     {
         EventTriggerMiniCamera.m_Reaction += 0.25f;
     }
     if (NkInputManager.GetKey(KeyCode.KeypadMinus))
     {
         EventTriggerMiniCamera.m_Reaction -= 0.25f;
     }
     if (NkInputManager.GetMouseButton(0))
     {
         base.gameObject.transform.localEulerAngles += new Vector3(-NkInputManager.GetAxisRaw("Mouse Y"), NkInputManager.GetAxisRaw("Mouse X"), 0f);
     }
     if (NkInputManager.GetMouseButton(1))
     {
         base.gameObject.transform.localEulerAngles += new Vector3(0f, 0f, NkInputManager.GetAxisRaw("Mouse X"));
     }
     if (NkInputManager.GetAxis("Mouse ScrollWheel") != 0f)
     {
         base.gameObject.transform.localPosition -= base.gameObject.transform.forward.normalized * NkInputManager.GetAxis("Mouse ScrollWheel");
     }
 }
示例#6
0
    public void MyCharMoveMouse()
    {
        NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1);

        if (@char == null)
        {
            return;
        }
        if (NkInputManager.GetMouseButton(0) && NkInputManager.GetMouseButton(1))
        {
            NrCharUser nrCharUser = (NrCharUser)@char;
            if (nrCharUser.GetFollowCharPersonID() > 0L)
            {
                if (!(NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_STOPAUTOMOVE) is StopAutoMove))
                {
                    NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
                }
                return;
            }
            if (!this.bMouseCharMove)
            {
                nrCharUser.m_kCharMove.MoveStop(true, false);
                nrCharUser.m_kCharMove.SetIncreaseMove();
            }
            nrCharUser.m_kCharMove.MouseMove();
            this.bMouseCharMove = true;
        }
        else if (NkInputManager.GetMouseButtonUp(0))
        {
            if (this.bMouseCharMove)
            {
                if (@char != null)
                {
                    @char.m_kCharMove.MoveStop(true, true);
                    @char.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
                }
                this.bMouseCharMove = false;
                this.SetSafeClickTime(-0.2f);
                return;
            }
            this.UpdateWalkEffect(false);
            if (NrTSingleton <FormsManager> .Instance.IsMouseOverForm())
            {
                return;
            }
            if (!NrTSingleton <NkClientLogic> .Instance.IsPickingEnable())
            {
                NrTSingleton <NkClientLogic> .Instance.SetPickingEnable(true);

                return;
            }
            if (!NrTSingleton <NkClientLogic> .Instance.IsMovable())
            {
                return;
            }
            if (this.fSafeClickTime > 0f && Time.time - this.fSafeClickTime < 0.5f)
            {
                return;
            }
            NrCharUser nrCharUser2 = (NrCharUser)@char;
            if (nrCharUser2.GetFollowCharPersonID() > 0L)
            {
                NrTSingleton <FormsManager> .Instance.ShowForm(G_ID.DLG_STOPAUTOMOVE);
            }
            else
            {
                NrCharBase pickChar = NrTSingleton <NkClientLogic> .Instance.GetPickChar();

                if (pickChar != null)
                {
                    if (NrTSingleton <NkClientLogic> .Instance.GetFocusChar() == null)
                    {
                        pickChar.CancelClickMe();
                        nrCharUser2.m_kCharMove.SetTargetChar(null);
                    }
                    else
                    {
                        pickChar.SetClickMe();
                        if (!pickChar.IsCharKindATB(32L))
                        {
                            nrCharUser2.m_kCharMove.SetTargetChar(pickChar);
                        }
                        else
                        {
                            nrCharUser2.m_kCharMove.SetTargetChar(null);
                        }
                    }
                }
                else
                {
                    NrCharBase targetChar = nrCharUser2.m_kCharMove.GetTargetChar();
                    if (targetChar != null)
                    {
                        targetChar.CancelClickMe();
                    }
                    nrCharUser2.m_kCharMove.SetTargetChar(null);
                }
                nrCharUser2.PickingMove();
            }
            Dlg_Collect dlg_Collect = (Dlg_Collect)NrTSingleton <FormsManager> .Instance.GetForm(G_ID.DLG_COLLECT);

            if (dlg_Collect != null)
            {
                dlg_Collect.OnClose();
            }
            this.fSafeClickTime = 0f;
        }
        else if (this.bMouseCharMove)
        {
            if (@char != null)
            {
                @char.m_kCharMove.MoveStop(true, true);
                @char.m_kCharMove.SendCharMovePacketForKeyBoardMove(true);
            }
            this.bMouseCharMove = false;
            this.SetSafeClickTime(-0.2f);
        }
    }