修改ui样式
This commit is contained in:
@@ -24,7 +24,6 @@ namespace NBC
|
||||
public virtual bool IsCanVisible => ContentPane != null && ContentPane.parent != null && ContentPane.visible;
|
||||
|
||||
public bool IsDotDel { get; protected set; }
|
||||
public bool IsDontBack { get; protected set; }
|
||||
public virtual string UIPackRootUrl => string.Empty;
|
||||
|
||||
public virtual string UIPackName { get; set; }
|
||||
@@ -43,12 +42,12 @@ namespace NBC
|
||||
/// <summary>
|
||||
/// 面板打开动画
|
||||
/// </summary>
|
||||
public NTask ShowAnim = null;
|
||||
public UIAnimTask ShowAnim = null;
|
||||
|
||||
/// <summary>
|
||||
/// 面板关闭动画
|
||||
/// </summary>
|
||||
public NTask HideAnim = null;
|
||||
public UIAnimTask HideAnim = null;
|
||||
|
||||
private object _paramData;
|
||||
private bool _isInited;
|
||||
@@ -141,16 +140,23 @@ namespace NBC
|
||||
if (!IsShowing)
|
||||
{
|
||||
GRoot.inst.AddChild(ContentPane);
|
||||
ContentPane.visible = true;
|
||||
_ui.AdjustModalLayer();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!IsTop) _ui.BringToFront(this);
|
||||
if (IsModal)
|
||||
{
|
||||
_ui.AdjustModalLayer();
|
||||
}
|
||||
}
|
||||
|
||||
_ui.TryPlayPanelTween(ContentPane);
|
||||
OpenAnimBegin();
|
||||
if (ShowAnim != null)
|
||||
{
|
||||
ShowAnim.SetDefaultInfo();
|
||||
ShowAnim.OnCompleted(OpenAnimFinished, true);
|
||||
ShowAnim.Run(UIRunner.Def);
|
||||
}
|
||||
@@ -171,6 +177,7 @@ namespace NBC
|
||||
if (!IsShowing) return;
|
||||
if (HideAnim != null)
|
||||
{
|
||||
HideAnim.SetDefaultInfo();
|
||||
HideAnim.OnCompleted(HideAnimFinished);
|
||||
HideAnim.Run(UIRunner.Def);
|
||||
}
|
||||
|
||||
@@ -1,139 +0,0 @@
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
/// <summary>
|
||||
/// ui界面默认动画
|
||||
/// </summary>
|
||||
public class PanelAnimationDef : NTask
|
||||
{
|
||||
public enum AnimType
|
||||
{
|
||||
CenterScaleBig = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 上往中滑动--
|
||||
/// </summary>
|
||||
UpToSlide = 1,
|
||||
|
||||
/// <summary>
|
||||
/// //下往中滑动
|
||||
/// </summary>
|
||||
DownToSlide = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 左往中--
|
||||
/// </summary>
|
||||
LeftToSlide = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 右往中--
|
||||
/// </summary>
|
||||
RightToSlide = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 透明度
|
||||
/// </summary>
|
||||
Fade = 5
|
||||
}
|
||||
|
||||
private bool _isClose;
|
||||
private GComponent _node;
|
||||
private AnimType _animType;
|
||||
|
||||
|
||||
public PanelAnimationDef(GComponent node, AnimType animType = AnimType.CenterScaleBig, bool close = false)
|
||||
{
|
||||
_node = node;
|
||||
_isClose = close;
|
||||
_animType = animType;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
if (_animType == AnimType.CenterScaleBig)
|
||||
{
|
||||
var strat = _isClose ? Vector3.one : Vector3.zero;
|
||||
var end = _isClose ? Vector3.zero : Vector3.one;
|
||||
var easeType = _isClose ? EaseType.BackIn : EaseType.BackOut;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(easeType)
|
||||
.SetTarget(_node, TweenPropType.Scale)
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
else if (_animType == AnimType.UpToSlide || _animType == AnimType.DownToSlide)
|
||||
{
|
||||
var hight = GRoot.inst.viewHeight;
|
||||
var y = _animType == AnimType.UpToSlide ? -hight : hight;
|
||||
var strat = _isClose ? 0 : y;
|
||||
var end = _isClose ? y : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(_node, TweenPropType.Y)
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
else if (_animType == AnimType.LeftToSlide || _animType == AnimType.RightToSlide)
|
||||
{
|
||||
var width = GRoot.inst.viewWidth;
|
||||
|
||||
var x = _animType == AnimType.LeftToSlide ? -width : width;
|
||||
|
||||
var strat = _isClose ? 0 : x;
|
||||
var end = _isClose ? x : 0;
|
||||
|
||||
GTween.To(strat, end, 0.5f)
|
||||
.SetEase(EaseType.CubicOut)
|
||||
.SetTarget(_node, TweenPropType.X)
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
else if (_animType == AnimType.Fade)
|
||||
{
|
||||
var s = _isClose ? 1 : 0;
|
||||
var end = _isClose ? 0 : 1;
|
||||
_node.alpha = s;
|
||||
GTween.To(s, end, 0.5f)
|
||||
.SetEase(EaseType.Linear)
|
||||
.SetTarget(_node, TweenPropType.Alpha)
|
||||
.OnStart(() => { })
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static class UIPanelAnimation
|
||||
{
|
||||
public static NTask GetCenterScaleBig(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.CenterScaleBig, close);
|
||||
}
|
||||
|
||||
public static NTask GetUpToSlide(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.UpToSlide, close);
|
||||
}
|
||||
|
||||
public static NTask GetDownToSlide(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.DownToSlide, close);
|
||||
}
|
||||
|
||||
public static NTask GetLeftToSlide(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.LeftToSlide, close);
|
||||
}
|
||||
|
||||
public static NTask GetRightToSlide(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.RightToSlide, close);
|
||||
}
|
||||
|
||||
public static NTask GetFade(IUIPanel panel, bool close = false)
|
||||
{
|
||||
return new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.Fade, close);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 506db39b69774ef7bcafb6f744370e81
|
||||
timeCreated: 1607328227
|
||||
Reference in New Issue
Block a user