Example #1
0
 private void ProcessSimulater()
 {
     PlayerController.EControlType controlType = this.ControlType;
     if (controlType != PlayerController.EControlType.ETouch)
     {
         if (controlType == PlayerController.EControlType.EJoystick)
         {
             this.joystick = GameUIManager.mInstance.GetDPad();
             if (this.joystick == null)
             {
                 return;
             }
             if (Input.GetMouseButtonDown(0))
             {
                 this.BeginJoystick(Input.mousePosition);
             }
             if (Input.GetMouseButton(0))
             {
                 this.MoveJoystick(Input.mousePosition);
             }
             if (Input.GetMouseButtonUp(0))
             {
                 this.EndJoystick();
             }
         }
     }
     else
     {
         if (Input.GetMouseButtonDown(0))
         {
             this.TouchDown(Input.mousePosition);
         }
         if (Input.GetMouseButton(0))
         {
             this.TouchMove(Input.mousePosition);
         }
         if (Input.GetMouseButtonUp(0))
         {
             this.TouchUp();
         }
     }
 }
Example #2
0
 private bool ProcessTouch()
 {
     if (Input.touchCount <= 0)
     {
         return false;
     }
     Touch touch = Input.GetTouch(0);
     PlayerController.EControlType controlType = this.ControlType;
     if (controlType != PlayerController.EControlType.ETouch)
     {
         if (controlType == PlayerController.EControlType.EJoystick)
         {
             this.joystick = GameUIManager.mInstance.GetDPad();
             if (this.joystick == null)
             {
                 return true;
             }
             switch (touch.phase)
             {
             case TouchPhase.Began:
                 this.BeginJoystick(touch.position);
                 break;
             case TouchPhase.Moved:
             case TouchPhase.Stationary:
                 this.MoveJoystick(touch.position);
                 break;
             case TouchPhase.Ended:
                 this.EndJoystick();
                 break;
             }
         }
     }
     else
     {
         switch (touch.phase)
         {
         case TouchPhase.Began:
             this.TouchDown(touch.position);
             break;
         case TouchPhase.Moved:
         case TouchPhase.Stationary:
             this.TouchMove(touch.position);
             break;
         case TouchPhase.Ended:
             this.TouchUp();
             break;
         }
     }
     return true;
 }
Example #3
0
 private void ProcessGamePad()
 {
     if (!GamePadMgr.isConnnected)
     {
         return;
     }
     PlayerController.EControlType controlType = this.ControlType;
     if (controlType != PlayerController.EControlType.ETouch)
     {
         if (controlType == PlayerController.EControlType.EJoystick)
         {
             this.joystick = GameUIManager.mInstance.GetDPad();
             if (this.joystick == null)
             {
                 return;
             }
             if (GamePadMgr.GetKeyButtonDown())
             {
                 this.BeginJoystick(this.joystick.GetDPadScreenPos());
             }
             if (GamePadMgr.GetKeyButton())
             {
                 Vector3 vector = new Vector3(-GamePadMgr.moveX, -GamePadMgr.moveY, 0f);
                 Vector3 a = (vector.magnitude <= 1f) ? vector : vector.normalized;
                 vector = this.joystick.GetDPadScreenPos() - a * 40f;
                 this.MoveJoystick(vector);
             }
             if (GamePadMgr.GetKeyButtonUp())
             {
                 this.EndJoystick();
             }
         }
     }
     else
     {
         Vector3 inputPosition = new Vector3(GamePadMgr.moveX, -GamePadMgr.moveY, 0f);
         Vector3 normalized = inputPosition.normalized;
         Vector3 position = base.transform.position - normalized;
         inputPosition = Camera.main.WorldToScreenPoint(position);
         if (GamePadMgr.GetKeyButtonDown())
         {
             this.TouchDown(inputPosition);
         }
         if (GamePadMgr.GetKeyButton())
         {
             this.TouchMove(inputPosition);
         }
         if (GamePadMgr.GetKeyButtonUp())
         {
             this.TouchUp();
         }
     }
 }