Example #1
0
    public void DoLocalScaleTo(Transform trans, Vector3 from, Vector3 to, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null)
    {
        Vector3 dealta = (to - from);

        DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam(0f, duration, duration, delegate(float value, DispatchManager.DispatchItem item) {
            if (value > item.FloatParam1)
            {
                value = item.FloatParam1;
            }
            Vector3 scale = Vector3.zero;
            if (item.EaseType == EaseType.EaseIn)
            {
                scale = QuadEaseIn(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }
            else if (item.EaseType == EaseType.EaseOut)
            {
                scale = QuadEaseOut(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }
            else
            {
                scale = Linear(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }

            item.TransParam1.localScale = scale;
        }, key ?? trans, delay);

        result.FloatParam1 = duration;
        result.VecParam1   = from;
        result.VecParam2   = dealta;
        result.TransParam1 = trans;
        result.EaseType    = easyType;
    }
Example #2
0
    public void DoFadeTo(CanvasGroup group, float from, float to, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null)
    {
        float dealta = (to - from);

        group.alpha = from;
        DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam(0f, duration, duration, delegate(float value, DispatchManager.DispatchItem item) {
            if (value > item.FloatParam1)
            {
                value = item.FloatParam1;
            }
            float alpha = 0;
            if (item.EaseType == EaseType.EaseIn)
            {
                alpha = QuadEaseIn(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }
            else if (item.EaseType == EaseType.EaseOut)
            {
                alpha = QuadEaseOut(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }
            else
            {
                alpha = Linear(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }

            item.CanvasParam1.alpha = alpha;
        }, key ?? group, delay);

        result.FloatParam1  = duration;
        result.FloatParam2  = from;
        result.FloatParam3  = dealta;
        result.CanvasParam1 = group;
        result.EaseType     = easyType;
    }
Example #3
0
    public void DoFadeTo(Graphic graphic, float from, float to, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null)
    {
        graphic.CrossFadeAlpha(from, 0, false);
        DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam(0f, 1f, 0f, delegate(float value, DispatchManager.DispatchItem item) {
            item.GraphicParam1.CrossFadeAlpha(item.FloatParam2, item.FloatParam1, false);
        }, key ?? graphic, delay);

        result.FloatParam1   = duration;
        result.FloatParam2   = to;
        result.GraphicParam1 = graphic;
        result.EaseType      = easyType;
    }
Example #4
0
//	public void DoLocalMoveXTo(Transform trans, Vector3 from, Vector3 to, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null) {
//		Vector3 dealta = (to - from);
//
//		DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam (0f, duration, duration, delegate(float value, DispatchManager.DispatchItem item) {
//			if (value > item.FloatParam1) {
//				value = item.FloatParam1;
//			}
//			if (item.VecParam3 == Vector3.zero) {
//				item.VecParam3 = item.VecParam1;
//			}
//			Vector3 position = Vector3.zero;
//			if (item.EaseType == EaseType.EaseIn) {
//				position = QuadEaseIn(value, item.VecParam1, item.VecParam2, item.FloatParam1);
//			}
//			else if (item.EaseType == EaseType.EaseOut) {
//				position = QuadEaseOut(value, item.VecParam1, item.VecParam2, item.FloatParam1);
//			}
//			else {
//				position = Linear(value, item.VecParam1, item.VecParam2, item.FloatParam1);
//			}
//
//			item.TransParam1.localPosition += (position - item.VecParam3);
//			item.VecParam3 = position;
//		}, key ?? trans, delay);
//
//		result.FloatParam1 = duration;
//		result.VecParam1 = from;
//		result.VecParam2 = dealta;
//		result.VecParam3 = Vector3.zero;
//		result.TransParam1 = trans;
//		result.EaseType = easyType;
//	}

    public void DoMoveBy(Transform trans, Vector3 delta, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null)
    {
        DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam(0f, duration, duration, delegate(float value, DispatchManager.DispatchItem item) {
            if (value > item.FloatParam1)
            {
                value = item.FloatParam1;
            }
            if (item.VecParam1 == Vector3.zero)
            {
                item.VecParam1 = item.TransParam1.position;
                item.VecParam3 = item.TransParam1.position;
            }

            Vector3 position = Vector3.zero;
            if (item.EaseType == EaseType.EaseIn)
            {
                position = QuadEaseIn(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }
            else if (item.EaseType == EaseType.EaseOut)
            {
                position = QuadEaseOut(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }
            else
            {
                position = Linear(value, item.VecParam1, item.VecParam2, item.FloatParam1);
            }

            item.TransParam1.position += (position - item.VecParam3);
            item.VecParam3             = position;
        }, key ?? trans, delay);

        result.FloatParam1 = duration;
        result.VecParam1   = Vector3.zero;
        result.VecParam2   = delta;
        result.VecParam3   = Vector3.zero;
        result.TransParam1 = trans;
        result.EaseType    = easyType;
    }
Example #5
0
    public void DoFadeImgTo(Image img, float from, float to, float duration, float delay = 0f, EaseType easyType = EaseType.None, object key = null)
    {
        float dealta = (to - from);
        Color c      = img.color;

        c.a       = from;
        img.color = c;
        DispatchManager.DispatchItem result = DispatchManager.Instance.RunWithParam(0f, duration, duration, delegate(float value, DispatchManager.DispatchItem item) {
            if (value > item.FloatParam1)
            {
                value = item.FloatParam1;
            }
            float alpha = 0;
            if (item.EaseType == EaseType.EaseIn)
            {
                alpha = QuadEaseIn(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }
            else if (item.EaseType == EaseType.EaseOut)
            {
                alpha = QuadEaseOut(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }
            else
            {
                alpha = Linear(value, item.FloatParam2, item.FloatParam3, item.FloatParam1);
            }
            Color col = item.ImageParam1.color;
            col.a     = alpha;
            item.ImageParam1.color = col;
        }, key ?? img, delay);

        result.FloatParam1 = duration;
        result.FloatParam2 = from;
        result.FloatParam3 = dealta;
        result.ImageParam1 = img;
        result.EaseType    = easyType;
    }