예제 #1
0
        // Token: 0x06008CB8 RID: 36024 RVA: 0x00291484 File Offset: 0x0028F684
        private void UpdateTouch(float dt)
        {
            if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_UpdateTouchSingle_hotfix != null)
            {
                this.m_UpdateTouchSingle_hotfix.call(new object[]
                {
                    this,
                    dt
                });
                return;
            }
            BJLuaObjHelper.IsSkipLuaHotfix = false;
            for (int i = 0; i < Input.touchCount; i++)
            {
                Touch touch = Input.GetTouch(i);
                if (touch.fingerId < 2)
                {
                    TouchStatus touchStatus = this.m_touchStatus[touch.fingerId];
                    if (touch.phase == TouchPhase.Began)
                    {
                        if (!this.IsTouchUI(touch.position))
                        {
                            touchStatus.m_beginPosition = (touchStatus.m_currentPosition = (touchStatus.m_prevPosition = touch.position));
                            touchStatus.m_pressed       = true;
                        }
                    }
                    else if (touch.phase == TouchPhase.Ended || touch.phase == TouchPhase.Canceled)
                    {
                        touchStatus.m_pressed = false;
                    }
                    else if (touch.phase == TouchPhase.Moved)
                    {
                        touchStatus.m_currentPosition = touch.position;
                    }
                }
            }
            if (Input.touchCount <= 0)
            {
                TouchStatus touchStatus2 = this.m_touchStatus[0];
                if (Input.GetMouseButtonDown(0) && !this.IsTouchUI(Input.mousePosition))
                {
                    touchStatus2.m_beginPosition = (touchStatus2.m_currentPosition = (touchStatus2.m_prevPosition = Input.mousePosition));
                    touchStatus2.m_pressed       = true;
                }
                if (Input.GetMouseButtonUp(0))
                {
                    touchStatus2.m_pressed = false;
                }
                if (Input.GetMouseButton(0))
                {
                    touchStatus2.m_currentPosition = Input.mousePosition;
                }
            }
            float axis = Input.GetAxis("Mouse ScrollWheel");

            if (axis != 0f)
            {
                float num = 1f - axis;
                this.m_height = Mathf.Clamp(this.m_height * num, this.m_viewHeightMin, this.m_viewHeightMax);
            }
            if (this.m_touchStatus[0].m_pressed || this.m_touchStatus[1].m_pressed)
            {
                this.m_isFollowing = false;
                float   viewWidth  = this.m_camera.orthographicSize * 2f * this.m_camera.aspect;
                float   viewHeight = this.m_camera.orthographicSize * 2f;
                Vector2 position   = this.m_position;
                if (this.m_touchStatus[0].m_pressed ^ this.m_touchStatus[1].m_pressed)
                {
                    int     num2   = (!this.m_touchStatus[0].m_pressed) ? 1 : 0;
                    Vector2 vector = WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[num2].m_currentPosition - this.m_touchStatus[num2].m_prevPosition, viewWidth, viewHeight);
                    this.m_touchStatus[num2].m_prevPosition = this.m_touchStatus[num2].m_currentPosition;
                    position.x -= vector.x;
                    position.y -= vector.y;
                }
                else if (this.m_touchStatus[0].m_pressed && this.m_touchStatus[1].m_pressed && axis == 0f)
                {
                    Vector2 b    = (this.m_touchStatus[0].m_prevPosition + this.m_touchStatus[1].m_prevPosition) * 0.5f;
                    Vector2 a    = (this.m_touchStatus[0].m_currentPosition + this.m_touchStatus[1].m_currentPosition) * 0.5f;
                    float   num3 = Vector2.Distance(WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[0].m_prevPosition, viewWidth, viewHeight), WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[1].m_prevPosition, viewWidth, viewHeight));
                    float   num4 = Vector2.Distance(WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[0].m_currentPosition, viewWidth, viewHeight), WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[1].m_currentPosition, viewWidth, viewHeight));
                    this.m_touchStatus[0].m_prevPosition = this.m_touchStatus[0].m_currentPosition;
                    this.m_touchStatus[1].m_prevPosition = this.m_touchStatus[1].m_currentPosition;
                    Vector2 vector2 = WorldCamera.ScreenPositionToViewPosition(a - b, viewWidth, viewHeight);
                    position.x -= vector2.x;
                    position.y -= vector2.y;
                    if (num3 > 0f && num4 > 0f)
                    {
                        this.m_height = Mathf.Clamp(this.m_height * num3 / num4, this.m_viewHeightMin, this.m_viewHeightMax);
                    }
                }
                if (this.m_hitWaypointUIController != null || this.m_hitEventActorUIController != null)
                {
                    float num5 = 0f;
                    if (this.m_touchStatus[0].m_pressed)
                    {
                        num5 += WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[0].m_beginPosition - this.m_touchStatus[0].m_currentPosition, viewWidth, viewHeight).magnitude;
                    }
                    if (this.m_touchStatus[1].m_pressed)
                    {
                        num5 += WorldCamera.ScreenPositionToViewPosition(this.m_touchStatus[1].m_beginPosition - this.m_touchStatus[1].m_currentPosition, viewWidth, viewHeight).magnitude;
                    }
                    if (num5 > 0.2f)
                    {
                        if (this.m_hitWaypointUIController != null)
                        {
                            this.m_hitWaypointUIController.IgnoreClick();
                            this.m_hitWaypointUIController = null;
                        }
                        if (this.m_hitEventActorUIController != null)
                        {
                            this.m_hitEventActorUIController.IgnoreClick();
                            this.m_hitEventActorUIController = null;
                        }
                    }
                }
                if (dt > 0f)
                {
                    this.m_touchMoveVelocity = (position - this.m_position) / dt;
                }
                this.m_position = this.ClampCameraPosition(position);
            }
            else
            {
                float magnitude = this.m_touchMoveVelocity.magnitude;
                if (magnitude > 0f)
                {
                    float d = Math.Max(magnitude - magnitude * dt * 10f, 0f);
                    this.m_touchMoveVelocity = this.m_touchMoveVelocity / magnitude * d;
                    this.m_position          = this.ClampCameraPosition(this.m_position + this.m_touchMoveVelocity * dt);
                }
            }
        }
예제 #2
0
 // Token: 0x06008CCE RID: 36046 RVA: 0x0029248C File Offset: 0x0029068C
 public LuaExportHelper(WorldCamera owner)
 {
     this.m_owner = owner;
 }
예제 #3
0
 // Token: 0x06008D05 RID: 36101 RVA: 0x002927FC File Offset: 0x002909FC
 public static Vector2 ScreenPositionToViewPosition(Vector2 p, float viewWidth, float viewHeight)
 {
     return(WorldCamera.ScreenPositionToViewPosition(p, viewWidth, viewHeight));
 }