NBC修改
This commit is contained in:
154
Assets/Scripts/NBC/Runtime/UI/Extension/UIAnimExtension.cs
Normal file
154
Assets/Scripts/NBC/Runtime/UI/Extension/UIAnimExtension.cs
Normal file
@@ -0,0 +1,154 @@
|
||||
using System.Threading.Tasks;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
public static class UIAnimExtension
|
||||
{
|
||||
public static FTask ShowCenterScaleBig(this UIPanel panel)
|
||||
{
|
||||
return CenterScaleBigAnim(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideCenterScaleBig(this UIPanel panel)
|
||||
{
|
||||
return CenterScaleBigAnim(panel, true);
|
||||
}
|
||||
|
||||
public static FTask ShowUpToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetUpToSlide(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideUpToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetUpToSlide(panel, true);
|
||||
}
|
||||
|
||||
public static FTask ShowDownToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetDownToSlide(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideDownToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetDownToSlide(panel, true);
|
||||
}
|
||||
|
||||
public static FTask ShowLeftToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetLeftToSlide(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideLeftToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetLeftToSlide(panel, true);
|
||||
}
|
||||
|
||||
|
||||
public static FTask ShowRightToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetRightToSlide(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideRightToSlide(this UIPanel panel)
|
||||
{
|
||||
return GetRightToSlide(panel, true);
|
||||
}
|
||||
|
||||
public static FTask ShowFade(this UIPanel panel)
|
||||
{
|
||||
return GetFade(panel, false);
|
||||
}
|
||||
|
||||
public static FTask HideFade(this UIPanel panel)
|
||||
{
|
||||
return GetFade(panel, true);
|
||||
}
|
||||
|
||||
private static async FTask CenterScaleBigAnim(UIPanel panel, bool close = false)
|
||||
{
|
||||
var strat = close ? Vector3.one : Vector3.zero;
|
||||
var end = close ? Vector3.zero : Vector3.one;
|
||||
var easeType = close ? EaseType.BackIn : EaseType.BackOut;
|
||||
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(easeType)
|
||||
.SetTarget(panel.ContentPane, TweenPropType.Scale);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
public static async FTask GetUpToSlide(UIPanel panel, bool close = false)
|
||||
{
|
||||
var hight = GRoot.inst.viewHeight;
|
||||
var y = -hight;
|
||||
var strat = close ? 0 : y;
|
||||
var end = close ? y : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(panel.ContentPane, TweenPropType.Y);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
public static async FTask GetDownToSlide(UIPanel panel, bool close = false)
|
||||
{
|
||||
var hight = GRoot.inst.viewHeight;
|
||||
var y = hight;
|
||||
var strat = close ? 0 : y;
|
||||
var end = close ? y : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(panel.ContentPane, TweenPropType.Y);
|
||||
// await App.Main.TimerComponent.Net.WaitAsync(500);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
public static async FTask GetLeftToSlide(UIPanel panel, bool close = false)
|
||||
{
|
||||
var width = GRoot.inst.viewWidth;
|
||||
|
||||
var x = -width;
|
||||
|
||||
var strat = close ? 0 : x;
|
||||
var end = close ? x : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(panel.ContentPane, TweenPropType.X);
|
||||
// await App.Main.TimerComponent.Net.WaitAsync(500);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
public static async FTask GetRightToSlide(UIPanel panel, bool close = false)
|
||||
{
|
||||
var width = GRoot.inst.viewWidth;
|
||||
|
||||
var x = width;
|
||||
|
||||
var strat = close ? 0 : x;
|
||||
var end = close ? x : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(panel.ContentPane, TweenPropType.X);
|
||||
// await App.Main.TimerComponent.Net.WaitAsync(500);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
|
||||
public static async FTask GetFade(UIPanel panel, bool close = false)
|
||||
{
|
||||
var s = close ? 1 : 0;
|
||||
var end = close ? 0 : 1;
|
||||
panel.ContentPane.alpha = s;
|
||||
GTween.To(s, end, 0.5f)
|
||||
.SetEase(EaseType.Linear)
|
||||
.SetTarget(panel, TweenPropType.Alpha);
|
||||
// await App.Main.TimerComponent.Net.WaitAsync(500);
|
||||
await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user