コード例 #1
0
    public void UpdateTweenValues()
    {
        thisTween = thisTween.ChangeEndValue(GetEndValues());

        #region LocalFunction
        //From DOTween.cs Punch()
        Vector3[] GetEndValues()
        {
            float magnitude = data.endPos.magnitude;
            int   length    = (int)(data.vibrato * data.Duration);
            float num1      = magnitude / length;

            if (length < 2)
            {
                length = 2;
            }

            Vector3[] endValues = new Vector3[length];
            for (int index = 0; index < length; ++index)
            {
                if (index < length - 1)
                {
                    endValues[index] = index != 0 ? (index % 2 == 0 ? Vector3.ClampMagnitude(data.endPos, magnitude)
                        : -Vector3.ClampMagnitude(data.endPos, magnitude * data.elasticity)) : data.endPos;
                    magnitude -= num1;
                }
                else
                {
                    endValues[index] = Vector3.zero;
                }
            }

            return(endValues);
        }

        #endregion
    }
コード例 #2
0
    private static int ChangeEndValue(IntPtr L)
    {
        int result;

        try
        {
            int num = LuaDLL.lua_gettop(L);
            if (num == 3 && TypeChecker.CheckTypes(L, 1, typeof(TweenerCore <float, float, FloatOptions>), typeof(object), typeof(bool)))
            {
                TweenerCore <float, float, FloatOptions> tweenerCore = (TweenerCore <float, float, FloatOptions>)ToLua.ToObject(L, 1);
                object  newEndValue    = ToLua.ToVarObject(L, 2);
                bool    snapStartValue = LuaDLL.lua_toboolean(L, 3);
                Tweener o = tweenerCore.ChangeEndValue(newEndValue, snapStartValue);
                ToLua.PushObject(L, o);
                result = 1;
            }
            else if (num == 4 && TypeChecker.CheckTypes(L, 1, typeof(TweenerCore <float, float, FloatOptions>), typeof(object), typeof(float), typeof(bool)))
            {
                TweenerCore <float, float, FloatOptions> tweenerCore2 = (TweenerCore <float, float, FloatOptions>)ToLua.ToObject(L, 1);
                object  newEndValue2    = ToLua.ToVarObject(L, 2);
                float   newDuration     = (float)LuaDLL.lua_tonumber(L, 3);
                bool    snapStartValue2 = LuaDLL.lua_toboolean(L, 4);
                Tweener o2 = tweenerCore2.ChangeEndValue(newEndValue2, newDuration, snapStartValue2);
                ToLua.PushObject(L, o2);
                result = 1;
            }
            else
            {
                result = LuaDLL.luaL_throw(L, "invalid arguments to method: DG.Tweening.Core.TweenerCore<float,float,DG.Tweening.Plugins.Options.FloatOptions>.ChangeEndValue");
            }
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
コード例 #3
0
        public unsafe void TweenZoom(float scrollDelta)
        {
            //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
            if (!m_allowInteraction)
            {
                return;
            }
            float num  = Mathf.Sign(scrollDelta) * m_zoomIncrement;
            float num2 = Mathf.Clamp01(m_targetZoomLevel + num);

            if (!(Mathf.Abs(num2 - m_targetZoomLevel) < float.Epsilon))
            {
                float num3 = Mathf.Lerp(0f, m_zoomTweenDuration, (num2 - m_zoomLevel) / num);
                m_targetZoomLevel = num2;
                if (m_zoomTween != null && TweenExtensions.IsPlaying(m_zoomTween))
                {
                    m_zoomTween.ChangeEndValue((object)num2, num3, true);
                }
                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*/), num2, num3), m_zoomEase);
                }
            }
        }
コード例 #4
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;
        }