Ejemplo n.º 1
0
        public unsafe IEnumerator FocusOnMapRegion([NotNull] IMapDefinition mapDefinition, int regionIndex, [CanBeNull] CameraControlParameters parameters = null)
        {
            if (m_regionFocusCoroutine != null)
            {
                this.StopCoroutine(m_regionFocusCoroutine);
                m_regionFocusCoroutine = null;
            }
            Camera    camera          = this.camera;
            Transform cameraContainer = m_cameraContainer;

            if (null == camera || null == cameraContainer)
            {
                yield break;
            }
            float panTweenDuration;
            Ease  val;
            float num;
            Ease  val2;

            if (null == parameters)
            {
                CameraControlParameters defaultControlParameters = m_defaultControlParameters;
                if (null == defaultControlParameters)
                {
                    panTweenDuration = m_panTweenDuration;
                    val  = 9;
                    num  = m_zoomTweenDuration;
                    val2 = 9;
                }
                else
                {
                    panTweenDuration = defaultControlParameters.panTweenDuration;
                    val  = defaultControlParameters.panTweenEase;
                    num  = defaultControlParameters.zoomTweenMaxDuration;
                    val2 = defaultControlParameters.zoomTweenEase;
                }
            }
            else
            {
                panTweenDuration = parameters.panTweenDuration;
                val  = parameters.panTweenEase;
                num  = parameters.zoomTweenMaxDuration;
                val2 = parameters.zoomTweenEase;
            }
            FightMapRegionDefinition region = mapDefinition.GetRegion(regionIndex);
            Vector3 val3 = Vector3Int.op_Implicit(mapDefinition.origin);
            Vector2 val4 = Vector2Int.op_Implicit(region.sizeMin);
            Vector2 val5 = Vector2Int.op_Implicit(region.sizeMax);
            Vector3 val6 = cameraContainer.get_rotation() * m_cameraPositionOffset;
            Vector2 val7 = val4 + 0.5f * (val5 - Vector2.get_one() - val4);
            Vector3 targetCameraPosition = new Vector3(((IntPtr)(void *)val7).x, 0f, ((IntPtr)(void *)val7).y) + val3 + val6;
            Vector3 val8 = default(Vector3);

            val8._002Ector(((IntPtr)(void *)val4).x, 0f, ((IntPtr)(void *)val4).y);
            Vector3 val9 = default(Vector3);

            val9._002Ector(((IntPtr)(void *)val5).x, 0f, ((IntPtr)(void *)val5).y);
            Vector3 val10 = default(Vector3);

            val10._002Ector(((IntPtr)(void *)val8).x, 0f, ((IntPtr)(void *)val9).z);
            Vector3 val11 = default(Vector3);

            val11._002Ector(((IntPtr)(void *)val9).x, 0f, ((IntPtr)(void *)val8).z);
            Vector3 val12       = cameraContainer.get_rotation() * new Vector3(1f, 0f, 1f);
            Vector3 normalized  = val12.get_normalized();
            Vector3 normalized2 = val6.get_normalized();

            val12 = val9 - val8;
            float num2 = Mathf.Abs(Vector3.Dot(val12.get_normalized(), normalized));

            val12 = val11 - val10;
            float   num3             = Mathf.Abs(Vector3.Dot(val12.get_normalized(), normalized));
            float   num4             = Mathf.Abs(Vector3.Dot(normalized2, normalized));
            float   num5             = Vector3.Distance(val8, val9);
            float   num6             = Vector3.Distance(val10, val11);
            float   num7             = 2f * val6.get_magnitude();
            Vector2 val13            = 2.828427f * m_regionFocusMargin;
            float   num8             = num2 * num5 + num3 * num6 + num4 * num7 + ((IntPtr)(void *)val13).y;
            float   num9             = (1f - num2) * num5 + (1f - num3) * num6 + (1f - num4) * num7 + ((IntPtr)(void *)val13).x;
            float   num10            = num8 / 4f;
            float   num11            = num9 / 2f / camera.get_aspect();
            float   num12            = Mathf.Max(num10, num11);
            float   targetZoomLevel2 = Mathf.InverseLerp(6f, m_maxOrthoSize, num12);

            targetZoomLevel2       = Mathf.Floor(targetZoomLevel2 / m_zoomIncrement) * m_zoomIncrement;
            m_targetCameraPosition = targetCameraPosition;
            m_targetZoomLevel      = targetZoomLevel2;
            m_userHasControl       = false;
            if (m_panTween != null && TweenExtensions.IsPlaying(m_panTween))
            {
                TweenSettingsExtensions.SetEase <Tweener>(m_panTween.ChangeEndValue((object)targetCameraPosition, panTweenDuration, true), val);
            }
            else
            {
                m_panTween = TweenSettingsExtensions.SetEase <TweenerCore <Vector3, Vector3, VectorOptions> >(DOTween.To(new DOGetter <Vector3>((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/), new DOSetter <Vector3>((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/), targetCameraPosition, panTweenDuration), val);
            }
            float num13 = Mathf.Lerp(0f, num, Mathf.Abs(targetZoomLevel2 - m_zoomLevel) / m_zoomIncrement);

            if (m_zoomTween != null && TweenExtensions.IsPlaying(m_zoomTween))
            {
                TweenSettingsExtensions.SetEase <Tweener>(m_zoomTween.ChangeEndValue((object)targetZoomLevel2, num13, true), val2);
            }
            else
            {
                m_zoomTween = TweenSettingsExtensions.SetEase <TweenerCore <float, float, FloatOptions> >(DOTween.To(new DOGetter <float>((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/), new DOSetter <float>((object)this, (IntPtr)(void *) /*OpCode not supported: LdFtn*/), targetZoomLevel2, num13), val2);
            }
            while (TweenExtensions.IsPlaying(m_panTween) || TweenExtensions.IsPlaying(m_zoomTween))
            {
                yield return(null);

                if (m_targetCameraPosition != targetCameraPosition || m_targetZoomLevel != targetZoomLevel2)
                {
                    break;
                }
            }
            m_regionFocusCoroutine = null;
            m_userHasControl       = true;
        }
Ejemplo n.º 2
0
            public unsafe CameraWorldRect(IMapDefinition mapDefinition, Vector2 margin)
            {
                //IL_0031: Unknown result type (might be due to invalid IL or missing references)
                //IL_0036: Unknown result type (might be due to invalid IL or missing references)
                //IL_0038: Unknown result type (might be due to invalid IL or missing references)
                //IL_003d: Unknown result type (might be due to invalid IL or missing references)
                //IL_0042: Unknown result type (might be due to invalid IL or missing references)
                //IL_0047: Unknown result type (might be due to invalid IL or missing references)
                //IL_0057: Unknown result type (might be due to invalid IL or missing references)
                //IL_0071: Unknown result type (might be due to invalid IL or missing references)
                //IL_0073: Unknown result type (might be due to invalid IL or missing references)
                //IL_0078: Unknown result type (might be due to invalid IL or missing references)
                //IL_007d: Unknown result type (might be due to invalid IL or missing references)
                //IL_007f: Unknown result type (might be due to invalid IL or missing references)
                //IL_0081: Unknown result type (might be due to invalid IL or missing references)
                //IL_0086: Unknown result type (might be due to invalid IL or missing references)
                //IL_008b: Unknown result type (might be due to invalid IL or missing references)
                //IL_008d: Unknown result type (might be due to invalid IL or missing references)
                //IL_0092: Unknown result type (might be due to invalid IL or missing references)
                //IL_0097: Unknown result type (might be due to invalid IL or missing references)
                //IL_0099: Unknown result type (might be due to invalid IL or missing references)
                //IL_009b: Unknown result type (might be due to invalid IL or missing references)
                //IL_00a0: Unknown result type (might be due to invalid IL or missing references)
                //IL_00a5: Unknown result type (might be due to invalid IL or missing references)
                //IL_00b3: Unknown result type (might be due to invalid IL or missing references)
                //IL_00bd: Unknown result type (might be due to invalid IL or missing references)
                //IL_00c7: Unknown result type (might be due to invalid IL or missing references)
                //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
                //IL_00eb: Unknown result type (might be due to invalid IL or missing references)
                //IL_00f5: Unknown result type (might be due to invalid IL or missing references)
                //IL_00ff: Unknown result type (might be due to invalid IL or missing references)
                //IL_0109: Unknown result type (might be due to invalid IL or missing references)
                //IL_0123: Unknown result type (might be due to invalid IL or missing references)
                //IL_012d: Unknown result type (might be due to invalid IL or missing references)
                //IL_0137: Unknown result type (might be due to invalid IL or missing references)
                //IL_0141: Unknown result type (might be due to invalid IL or missing references)
                //IL_015b: Unknown result type (might be due to invalid IL or missing references)
                //IL_0165: Unknown result type (might be due to invalid IL or missing references)
                //IL_016f: Unknown result type (might be due to invalid IL or missing references)
                //IL_0179: Unknown result type (might be due to invalid IL or missing references)
                //IL_0197: Unknown result type (might be due to invalid IL or missing references)
                //IL_019c: Unknown result type (might be due to invalid IL or missing references)
                //IL_01a1: Unknown result type (might be due to invalid IL or missing references)
                //IL_01a6: Unknown result type (might be due to invalid IL or missing references)
                //IL_01ab: Unknown result type (might be due to invalid IL or missing references)
                //IL_01ad: Unknown result type (might be due to invalid IL or missing references)
                //IL_01c1: Unknown result type (might be due to invalid IL or missing references)
                //IL_01d6: Unknown result type (might be due to invalid IL or missing references)
                //IL_01e8: Unknown result type (might be due to invalid IL or missing references)
                //IL_01fa: Unknown result type (might be due to invalid IL or missing references)
                //IL_020c: Unknown result type (might be due to invalid IL or missing references)
                //IL_022d: Unknown result type (might be due to invalid IL or missing references)
                //IL_0253: Unknown result type (might be due to invalid IL or missing references)
                float      num         = 0f;
                float      num2        = 0f;
                float      num3        = 0f;
                float      num4        = 0f;
                int        regionCount = mapDefinition.regionCount;
                Vector2Int val3        = default(Vector2Int);

                for (int i = 0; i < regionCount; i++)
                {
                    FightMapRegionDefinition region = mapDefinition.GetRegion(i);
                    Vector2Int sizeMin = region.sizeMin;
                    Vector2Int val     = region.sizeMax - Vector2Int.get_one();
                    Vector2Int val2    = new Vector2Int(sizeMin.get_x(), val.get_y());
                    val3._002Ector(val.get_x(), sizeMin.get_y());
                    Vector2 val4 = Translate(Vector2Int.op_Implicit(sizeMin));
                    Vector2 val5 = Translate(Vector2Int.op_Implicit(val));
                    Vector2 val6 = Translate(Vector2Int.op_Implicit(val2));
                    Vector2 val7 = Translate(Vector2Int.op_Implicit(val3));
                    num = Mathf.Max(new float[5]
                    {
                        num,
                        ((IntPtr)(void *)val4).y,
                        ((IntPtr)(void *)val5).y,
                        ((IntPtr)(void *)val6).y,
                        ((IntPtr)(void *)val7).y
                    });
                    num3 = Mathf.Min(new float[5]
                    {
                        num3,
                        ((IntPtr)(void *)val4).y,
                        ((IntPtr)(void *)val5).y,
                        ((IntPtr)(void *)val6).y,
                        ((IntPtr)(void *)val7).y
                    });
                    num2 = Mathf.Min(new float[5]
                    {
                        num2,
                        ((IntPtr)(void *)val4).x,
                        ((IntPtr)(void *)val5).x,
                        ((IntPtr)(void *)val6).x,
                        ((IntPtr)(void *)val7).x
                    });
                    num4 = Mathf.Max(new float[5]
                    {
                        num4,
                        ((IntPtr)(void *)val4).x,
                        ((IntPtr)(void *)val5).x,
                        ((IntPtr)(void *)val6).x,
                        ((IntPtr)(void *)val7).x
                    });
                }
                Vector3 val8 = Vector2.op_Implicit(Translate(Vector3Int.op_Implicit(mapDefinition.origin)));
                float   num5 = (((IntPtr)(void *)margin).x + 1f) * 0.707106769f;
                float   num6 = (((IntPtr)(void *)margin).y + 1f) * 0.707106769f;

                left   = ((IntPtr)(void *)val8).x + num2 - num5;
                right  = ((IntPtr)(void *)val8).x + num4 + num5;
                top    = ((IntPtr)(void *)val8).z + num + num6;
                bottom = ((IntPtr)(void *)val8).z + num3 - num6;
                if (bottom > top)
                {
                    top = (bottom = ((IntPtr)(void *)val8).z);
                }
                if (left > right)
                {
                    left = (right = ((IntPtr)(void *)val8).x);
                }
            }