protected override void OnExit(Action onAnimationFinish)
        {
            CalculateTransform(out var newPos, out var newSize);
            AnimationEntry entry = GetBaseAnimationEntry();

            if (barrelMaterial != null)
            {
                barrelMaterialInstance.SetFloat(BarrelShaderCurvaturePropertyID, barrelCurvature);
                entry = entry.Then(new RectTransformAnimationProperty(rt, pos0, newPos, size0, newSize), scaleDuration)
                        .With(exitFunction)
                        .Then(GetOpacityAnimationProperty(1, 0), fadeDuration)
                        .Then(new ActionAnimationProperty(() => uiPP.PushMaterial(barrelMaterialInstance)))
                        .Then(
                    new MaterialFloatAnimationProperty(barrelMaterialInstance, BarrelShaderCurvatureProperty,
                                                       barrelCurvature, 0), barrelDuration)
                        .Then(new ActionAnimationProperty(() => uiPP.ClearLayer()));
            }
            else
            {
                entry = entry.Then(new RectTransformAnimationProperty(rt, pos0, newPos, size0, newSize), scaleDuration)
                        .With(exitFunction)
                        .Then(GetOpacityAnimationProperty(1, 0), fadeDuration);
            }

            entry.Then(new ActionAnimationProperty(() =>
            {
                SetToTransitionTarget();
                onAnimationFinish?.Invoke();
            }));
        }
        protected override void OnEnter(Action onAnimationFinish)
        {
            CalculateTransform(out var newPos, out var newSize);
            AnimationEntry entry = GetBaseAnimationEntry();

            if (barrelMaterial != null)
            {
                uiPP.PushMaterial(barrelMaterialInstance);
                barrelMaterialInstance.SetFloat(BarrelShaderCurvaturePropertyID, 0);
                entry = entry.Then(
                    new MaterialFloatAnimationProperty(barrelMaterialInstance, BarrelShaderCurvatureProperty, 0,
                                                       barrelCurvature),
                    barrelDuration
                    )
                        .Then(new ActionAnimationProperty(() => uiPP.ClearLayer()))
                        .Then(GetOpacityAnimationProperty(0, 1), fadeDuration)
                        .Then(new RectTransformAnimationProperty(rt, newPos, pos0, newSize, size0), scaleDuration)
                        .With(enterFunction);
            }
            else
            {
                entry = entry.Then(GetOpacityAnimationProperty(0, 1), fadeDuration)
                        .Then(new RectTransformAnimationProperty(rt, newPos, pos0, newSize, size0), scaleDuration)
                        .With(enterFunction);
            }

            if (onAnimationFinish != null)
            {
                entry.Then(new ActionAnimationProperty(onAnimationFinish));
            }
        }
Beispiel #3
0
        public AnimationEntry Do(IAnimationProperty property, float duration = 0,
                                 AnimationEntry.EasingFunction easing        = null, int repeatNum = 0)
        {
            var entry = AnimationEntry.CreateEntry(property, duration, easing, repeatNum, transform);

            entry.Play();
            return(entry);
        }
Beispiel #4
0
    static int Then(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.Then(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.Then(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.Then(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.Then(arg0, arg1, arg2, arg3);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: Nova.AnimationEntry.Then"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
Beispiel #5
0
 static int DestroyEntry(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Nova.AnimationEntry arg0 = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
         Nova.AnimationEntry.DestroyEntry(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #6
0
 static int Stop(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         Nova.AnimationEntry obj = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
         obj.Stop();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #7
0
 static int DebugPrint(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Nova.AnimationEntry obj = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
         int arg0 = (int)LuaDLL.luaL_checknumber(L, 2);
         obj.DebugPrint(arg0);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #8
0
 static int With(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Nova.AnimationEntry obj = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
         Nova.AnimationEntry.EasingFunction arg0 = (Nova.AnimationEntry.EasingFunction)ToLua.CheckDelegate <Nova.AnimationEntry.EasingFunction>(L, 2);
         Nova.AnimationEntry o = obj.With(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #9
0
 static int For(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         Nova.AnimationEntry obj = (Nova.AnimationEntry)ToLua.CheckObject <Nova.AnimationEntry>(L, 1);
         float arg0            = (float)LuaDLL.luaL_checknumber(L, 2);
         Nova.AnimationEntry o = obj.For(arg0);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #10
0
    static int set_evaluateOnStop(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.evaluateOnStop = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index evaluateOnStop on a nil value"));
        }
    }
Beispiel #11
0
    static int set_easing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            Nova.AnimationEntry.EasingFunction arg0 = (Nova.AnimationEntry.EasingFunction)ToLua.CheckDelegate <Nova.AnimationEntry.EasingFunction>(L, 2);
            obj.easing = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index easing on a nil value"));
        }
    }
Beispiel #12
0
    static int get_isStopped(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            bool ret = obj.isStopped;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index isStopped on a nil value"));
        }
    }
Beispiel #13
0
    static int get_status(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry       obj = (Nova.AnimationEntry)o;
            Nova.AnimationEntryStatus ret = obj.status;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index status on a nil value"));
        }
    }
Beispiel #14
0
    static int get_totalTimeRemaining(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            float ret = obj.totalTimeRemaining;
            LuaDLL.lua_pushnumber(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index totalTimeRemaining on a nil value"));
        }
    }
Beispiel #15
0
    static int get_repeatNumRemaining(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            int ret = obj.repeatNumRemaining;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index repeatNumRemaining on a nil value"));
        }
    }
Beispiel #16
0
    static int get_property(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry     obj = (Nova.AnimationEntry)o;
            Nova.IAnimationProperty ret = obj.property;
            ToLua.PushObject(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index property on a nil value"));
        }
    }
Beispiel #17
0
    static int get_easing(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            Nova.AnimationEntry obj = (Nova.AnimationEntry)o;
            Nova.AnimationEntry.EasingFunction ret = obj.easing;
            ToLua.Push(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index easing on a nil value"));
        }
    }
Beispiel #18
0
 static int Init(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 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);
         obj.Init(arg0, arg1, arg2, arg3);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #19
0
 static int CreateEntry(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 5);
         Nova.IAnimationProperty arg0 = (Nova.IAnimationProperty)ToLua.CheckObject <Nova.IAnimationProperty>(L, 1);
         float arg1 = (float)LuaDLL.luaL_checknumber(L, 2);
         Nova.AnimationEntry.EasingFunction arg2 = (Nova.AnimationEntry.EasingFunction)ToLua.CheckDelegate <Nova.AnimationEntry.EasingFunction>(L, 3);
         int arg3 = (int)LuaDLL.luaL_checknumber(L, 4);
         UnityEngine.Transform arg4 = (UnityEngine.Transform)ToLua.CheckObject <UnityEngine.Transform>(L, 5);
         Nova.AnimationEntry   o    = Nova.AnimationEntry.CreateEntry(arg0, arg1, arg2, arg3, arg4);
         ToLua.Push(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Beispiel #20
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();
            }));
        }
Beispiel #21
0
 private void Start()
 {
     AnimationEntry.InitFactory();
 }