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)); } }
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)); } }
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(); })); }