示例#1
0
 private void StayTouch(int fingerId, int i, ref Double3 summedPositionDelta, ref int dragingFingerCount, ref int horizontalAxis)
 {
     global::Touch.TouchState touchState = this.touchesInfo[fingerId].touchState;
     if (touchState != global::Touch.TouchState.OnEmpty)
     {
         if (touchState == global::Touch.TouchState.OnUI)
         {
             if (this.touchesInfo[fingerId].touchDownButton == Ref.inputController.leftArrow)
             {
                 horizontalAxis = -1;
             }
             if (this.touchesInfo[fingerId].touchDownButton == Ref.inputController.rightArrow)
             {
                 horizontalAxis = 1;
             }
             if (Ref.controller != null && Ref.controller.throttlePercentUI != null && this.touchesInfo[fingerId].touchDownButton == Ref.controller.throttlePercentUI.transform.parent)
             {
                 float num = this.touchesInfo[fingerId].lastFingerPosPixels.y - Input.GetTouch(i).position.y;
                 if (num != 0f && Ref.mainVessel != null)
                 {
                     if (Ref.mainVessel.controlAuthority)
                     {
                         Ref.mainVessel.SetThrottle(new Vessel.Throttle(Ref.mainVessel.throttle.throttleOn, Mathf.Clamp01(Ref.mainVessel.throttle.throttleRaw - num / 318f)));
                         if (Ref.inputController.instructionSlideThrottleHolder.activeSelf)
                         {
                             Ref.inputController.instructionSlideThrottleHolder.SetActive(false);
                             Ref.inputController.CheckAllInstructions();
                         }
                     }
                     else if (Ref.controller.msgUI.color.a < 0.6f)
                     {
                         Ref.controller.ShowMsg("No control");
                     }
                 }
             }
         }
     }
     else
     {
         if (Ref.currentScene == Ref.SceneType.Build)
         {
             Vector2 deltaPixel = this.touchesInfo[fingerId].lastFingerPosPixels - Input.GetTouch(i).position;
             Vector2 posWorld   = Camera.main.ScreenToWorldPoint((Vector3)Input.GetTouch(i).position + Vector3.forward * -Ref.cam.transform.position.z);
             Ref.inputController.TouchStayEmpty(posWorld, deltaPixel, fingerId);
         }
         if (Ref.mapView)
         {
             Vector2 v = this.touchesInfo[fingerId].lastFingerPosPixels - Input.GetTouch(i).position;
             summedPositionDelta += v;
             dragingFingerCount++;
         }
     }
 }
示例#2
0
    private void EndTouch(int fingerId, int i, Vector2 posPixel)
    {
        bool flag = this.touchesInfo[fingerId].touchDownTime > Time.time - 0.2f;

        global::Touch.TouchState touchState = this.touchesInfo[fingerId].touchState;
        if (touchState != global::Touch.TouchState.OnUI)
        {
            if (touchState == global::Touch.TouchState.OnEmpty)
            {
                Ref.inputController.EndTouchEmpty(this.PixelPosToWorldPos(posPixel), fingerId, flag);
            }
        }
        else if (flag)
        {
            Ref.inputController.ClickUI(posPixel);
        }
        if (fingerId == this.zoomFinger1 || fingerId == this.zoomFinger2)
        {
            this.zoomFinger1 = -1;
            this.zoomFinger2 = -1;
        }
        this.touchesInfo[fingerId].touchState = global::Touch.TouchState.NotTouching;
    }