Beispiel #1
0
        public void OnViewPointPanelPointerDown(BaseEventData baseData)
        {
            PointerEventData data = (PointerEventData)baseData;

            if (!this._cameraControlPointers.ContainsKey(data.pointerId))
            {
                CameraControllPointer pointer = new CameraControllPointer {
                    pointerId   = data.pointerId,
                    isDrag      = false,
                    enterPoint  = data.position,
                    offsetPoint = data.delta
                };
                this._cameraControlPointers.Add(pointer.pointerId, pointer);
                this.RefreshControlType();
            }
        }
Beispiel #2
0
        public void OnViewPointPanelPointerUp(BaseEventData baseData)
        {
            PointerEventData data = (PointerEventData)baseData;

            if (this._cameraControlPointers.ContainsKey(data.pointerId))
            {
                CameraControllPointer pointer = this._cameraControlPointers[data.pointerId];
                if (this._currentControlType == CameraControlType.OnePoint)
                {
                    if (pointer.isDrag)
                    {
                        Singleton <CameraManager> .Instance.GetMainCamera().FollowControlledRotateEnableExitTimer();

                        if (Singleton <LevelManager> .Instance.levelActor.HasPlugin <LevelDamageStasticsPlugin>() && Singleton <LevelManager> .Instance.levelActor.GetPlugin <LevelDamageStasticsPlugin>().isUpdating)
                        {
                            Singleton <LevelManager> .Instance.levelActor.GetPlugin <LevelDamageStasticsPlugin>().AddScreenRotateTimes();
                        }
                    }
                    else
                    {
                        if (Singleton <CameraManager> .Instance.controlledRotateKeepManual)
                        {
                            Singleton <CameraManager> .Instance.GetMainCamera().FollowControlledRotateStop();
                        }
                        if (((Singleton <LevelManager> .Instance.levelActor.levelState == LevelActor.LevelState.LevelRunning) && (Singleton <MonsterManager> .Instance.LivingMonsterCount() > 0)) && Singleton <AvatarManager> .Instance.GetLocalAvatar().IsAlive())
                        {
                            Singleton <AvatarManager> .Instance.GetLocalAvatar().SelectTarget();

                            Singleton <AvatarManager> .Instance.GetLocalAvatar().ClearAttackTargetTimed(1.2f);
                        }
                        else
                        {
                            Singleton <CameraManager> .Instance.GetMainCamera().SetRotateToFaceDirection();
                        }
                    }
                }
                this._cameraControlPointers.Remove(data.pointerId);
                this.RefreshControlType();
                if (this._currentControlType == CameraControlType.None)
                {
                    this._dragOffset = Vector2.zero;
                }
            }
        }
Beispiel #3
0
        public void OnViewPointPanelDrag(BaseEventData baseData)
        {
            PointerEventData data = (PointerEventData)baseData;

            if (this._cameraControlPointers.ContainsKey(data.pointerId))
            {
                CameraControllPointer pointer = this._cameraControlPointers[data.pointerId];
                pointer.offsetPoint = data.delta;
                CameraControllPointer pointer2         = pointer;
                CameraControlType     currentTouchType = this.GetCurrentTouchType();
                if (currentTouchType == CameraControlType.TwoPoint)
                {
                    foreach (KeyValuePair <int, CameraControllPointer> pair in this._cameraControlPointers)
                    {
                        if (pair.Key != data.pointerId)
                        {
                            pointer2 = pair.Value;
                        }
                    }
                    float num       = Vector2.Distance(pointer.enterPoint, pointer2.enterPoint);
                    float num2      = Vector2.Distance(pointer.offsetPoint + pointer.enterPoint, pointer2.offsetPoint + pointer2.enterPoint);
                    float f         = num - num2;
                    float zoomDelta = (f * Time.deltaTime) * 4f;
                    if (!pointer.isDrag && (Mathf.Abs(f) > 20f))
                    {
                        pointer.isDrag = true;
                        Singleton <CameraManager> .Instance.GetMainCamera().FollowControlledRotateStart();
                    }
                    if (pointer.isDrag)
                    {
                        this._dragOffset = data.delta;
                        Singleton <CameraManager> .Instance.GetMainCamera().SetFollowControledZoomingData(zoomDelta);
                    }
                }
                else if ((currentTouchType == CameraControlType.OnePoint) && (this._preControlType == CameraControlType.None))
                {
                    if (!pointer.isDrag)
                    {
                        float num5 = ((data.position.x - pointer.enterPoint.x) / ((float)Screen.width)) * this._screenWidthInInch;
                        float num6 = ((data.position.y - pointer.enterPoint.y) / ((float)Screen.height)) * this._screenHeightInInch;
                        float num7 = (num5 * num5) + (num6 * num6);
                        if (num7 > 0.0036f)
                        {
                            pointer.isDrag = true;
                            Singleton <CameraManager> .Instance.GetMainCamera().FollowControlledRotateStart();
                        }
                    }
                    if (pointer.isDrag)
                    {
                        Vector2 delta = data.delta;
                        delta.x = (delta.x / ((float)Screen.width)) * this._screenWidthInInch;
                        delta.y = (delta.y / ((float)Screen.height)) * this._screenHeightInInch;
                        Singleton <CameraManager> .Instance.GetMainCamera().SetFollowControledRotationData(delta);
                    }
                }
                else if ((currentTouchType == CameraControlType.OnePoint) && (this._preControlType == CameraControlType.TwoPoint))
                {
                    Singleton <CameraManager> .Instance.GetMainCamera().SetFollowControledRotationData(data.delta - this._dragOffset);
                }
            }
        }