Exemplo n.º 1
0
    static int And(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2)
            {
                Nova.AnimationEntry     obj  = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
                Nova.IAnimationProperty arg0 = (Nova.IAnimationProperty)ToLua.CheckObject <Nova.IAnimationProperty>(L, 2);
                Nova.AnimationEntry     o    = obj.And(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3)
            {
                Nova.AnimationEntry     obj  = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
                Nova.IAnimationProperty arg0 = (Nova.IAnimationProperty)ToLua.CheckObject <Nova.IAnimationProperty>(L, 2);
                float arg1            = (float)LuaDLL.luaL_checknumber(L, 3);
                Nova.AnimationEntry o = obj.And(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 4)
            {
                Nova.AnimationEntry     obj  = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
                Nova.IAnimationProperty arg0 = (Nova.IAnimationProperty)ToLua.CheckObject <Nova.IAnimationProperty>(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                Nova.AnimationEntry.EasingFunction arg2 = (Nova.AnimationEntry.EasingFunction)ToLua.CheckDelegate <Nova.AnimationEntry.EasingFunction>(L, 4);
                Nova.AnimationEntry o = obj.And(arg0, arg1, arg2);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 5)
            {
                Nova.AnimationEntry     obj  = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
                Nova.IAnimationProperty arg0 = (Nova.IAnimationProperty)ToLua.CheckObject <Nova.IAnimationProperty>(L, 2);
                float arg1 = (float)LuaDLL.luaL_checknumber(L, 3);
                Nova.AnimationEntry.EasingFunction arg2 = (Nova.AnimationEntry.EasingFunction)ToLua.CheckDelegate <Nova.AnimationEntry.EasingFunction>(L, 4);
                int arg3 = (int)LuaDLL.luaL_checknumber(L, 5);
                Nova.AnimationEntry o = obj.And(arg0, arg1, arg2, arg3);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Nova.AnimationEntry.And"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Exemplo n.º 2
0
        protected override void OnExit(Action onAnimationFinish)
        {
            AnimationEntry current      = GetBaseAnimationEntry();
            bool           hasAnimation = false;

            if (fade)
            {
                current      = current.Then(GetOpacityAnimationProperty(1, 0), duration);
                hasAnimation = true;
            }

            if (movementDirection != UIViewMovementDirection.None || scalingDirection != UIViewScalingDirection.None)
            {
                var delta = size0.InverseScale(RealScreen.uiSize) * (UICameraHelper.Active.orthographicSize * 2);
                delta.Scale(Dir2Vector[(int)movementDirection] * movementPercentage);
                var size = size0 * (1 + Dir2Scale[(int)scalingDirection] * scalingPercentage);
                var prop = new RectTransformAnimationProperty(rt, pos0, pos0 - delta, size0.CloneScale(scale0),
                                                              size.CloneScale(scale0));
                current = hasAnimation ? current.And(prop, duration) : current.Then(prop, duration);
                current.With(exitFunction);
                hasAnimation = true;
            }

            if (rotationDirection != UIViewRotationDirection.None)
            {
                float angle = 360 * rotationPercentage * (int)rotationDirection;
                var   prop  = new RotationAnimationProperty(rt, new Vector3(0, 0, angle));
                rt.rotation = Quaternion.identity;
                current     = hasAnimation ? current.And(prop, duration) : current.Then(prop, duration);
                current.With(exitFunction);
            }

            current.Then(new ActionAnimationProperty(() =>
            {
                onAnimationFinish?.Invoke();
                SetToTransitionTarget();
            }));
        }