修改ui样式
This commit is contained in:
@@ -38,7 +38,7 @@ namespace NBF
|
||||
break;
|
||||
}
|
||||
}
|
||||
Log.Error($"showCursor={showCursor}");
|
||||
Log.Info($"showCursor={showCursor}");
|
||||
InputManager.IsUIStopInput = showCursor;
|
||||
InputManager.SetMouseCursor(showCursor);
|
||||
}
|
||||
|
||||
@@ -153,13 +153,14 @@ namespace NBF
|
||||
|
||||
private void InitUI()
|
||||
{
|
||||
UI.Inst.SetUITween<UITweenConfig>();
|
||||
Binder.BindAll();
|
||||
UIObjectFactory.SetLoaderExtension(typeof(XGLoader));
|
||||
UIConst.UIPackRootUrl = UIDef.UIRoot;
|
||||
UIConfig.verticalScrollBar = "ui://6hgkvlauoomej";
|
||||
UIConfig.defaultFont = "AlibabaPuHuiTi-3-Medium";
|
||||
UI.Inst.SetUILanguage<UILangeageConfig>();
|
||||
UIConfig.modalLayerColor = new Color(0, 0, 0, 0.99f);
|
||||
UIConfig.modalLayerColor = new Color(1, 1, 1, 0.2f);
|
||||
AddUIPackages();
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,9 @@ namespace NBF
|
||||
// await Task.Delay(100);
|
||||
CommonTopPanel.Show();
|
||||
// SettingPanel.Show();
|
||||
LoginPanel.Show();
|
||||
// LoginPanel.Show();
|
||||
// MessageBox.Show();
|
||||
FishingShopPanel.Show();
|
||||
// PreviewPanel.Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
/// </summary>
|
||||
/// <param name="task">任务对象</param>
|
||||
void Run(ITask task);
|
||||
|
||||
|
||||
void Process();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace NBC
|
||||
{
|
||||
ReadyTask.Enqueue(task);
|
||||
}
|
||||
|
||||
|
||||
public virtual void Process()
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,8 +16,12 @@ namespace NBC
|
||||
|
||||
private GGraph _modalLayer;
|
||||
private GRoot _uiRoot;
|
||||
|
||||
private UIComponentLanguagePack _uiLanguageConfig;
|
||||
|
||||
// 新增 Tween 配置
|
||||
private UIComponentTweenPack _uiTweenConfig;
|
||||
|
||||
public void Start()
|
||||
{
|
||||
Log.Info("UI 模块初始化");
|
||||
@@ -55,6 +59,7 @@ namespace NBC
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplyPanelRootTween(panel); // 根动效设置为 ShowAnim
|
||||
panel.Show();
|
||||
}
|
||||
}
|
||||
@@ -94,6 +99,51 @@ namespace NBC
|
||||
|
||||
#endregion
|
||||
|
||||
#region 动画
|
||||
|
||||
public void SetUITween<T>() where T : UIComponentTweenPack
|
||||
{
|
||||
_uiTweenConfig = Activator.CreateInstance<T>();
|
||||
}
|
||||
|
||||
public void TryPlayComponentTween(GComponent component)
|
||||
{
|
||||
_uiTweenConfig?.TryPlayComponentTween(component);
|
||||
}
|
||||
|
||||
public void TryPlayPanelTween(GComponent component)
|
||||
{
|
||||
_uiTweenConfig?.TryPlayPanelTween(component);
|
||||
}
|
||||
|
||||
private void ApplyPanelRootTween(IUIPanel panel)
|
||||
{
|
||||
if (panel?.ContentPane == null || _uiTweenConfig == null) return;
|
||||
var url = panel.ContentPane.resourceURL;
|
||||
if (string.IsNullOrEmpty(url)) return;
|
||||
var tweenName = _uiTweenConfig.GetRootTween(url);
|
||||
if (string.IsNullOrEmpty(tweenName)) return;
|
||||
if (panel is not UIPanel upPanel) return; // 需要具体 UIPanel 才能设置 ShowAnim
|
||||
|
||||
if (upPanel.ShowAnim != null) return;
|
||||
switch (tweenName)
|
||||
{
|
||||
case "Fade": upPanel.ShowAnim = UIPanelAnimation.GetFade(upPanel); break;
|
||||
case "Scale": upPanel.ShowAnim = UIPanelAnimation.GetCenterScaleBig(upPanel); break;
|
||||
case "Pop": upPanel.ShowAnim = UIPanelAnimation.GetCenterPopScaleFade(upPanel); break;
|
||||
case "SlideInL": upPanel.ShowAnim = UIPanelAnimation.GetLeftToSlideFade(upPanel); break;
|
||||
case "SlideInR": upPanel.ShowAnim = UIPanelAnimation.GetRightToSlideFade(upPanel); break;
|
||||
case "SlideInT": upPanel.ShowAnim = UIPanelAnimation.GetUpToSlideFade(upPanel); break;
|
||||
case "SlideInB": upPanel.ShowAnim = UIPanelAnimation.GetDownToSlideFade(upPanel); break;
|
||||
case "Bounce": upPanel.ShowAnim = UIPanelAnimation.GetBounceVertical(upPanel); break;
|
||||
case "Rotate": upPanel.ShowAnim = UIPanelAnimation.GetRotate(upPanel); break;
|
||||
case "Shake": upPanel.ShowAnim = UIPanelAnimation.GetShake(upPanel); break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void OpenUI<T>(object param = null)
|
||||
{
|
||||
Type type = typeof(T);
|
||||
|
||||
3
Assets/Scripts/NBC/UI/Runtime/UITween.meta
Normal file
3
Assets/Scripts/NBC/UI/Runtime/UITween.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b2fcace3b3ca4e21948ba0bce5002c82
|
||||
timeCreated: 1770173105
|
||||
7
Assets/Scripts/NBC/UI/Runtime/UITween/UIAnimTask.cs
Normal file
7
Assets/Scripts/NBC/UI/Runtime/UITween/UIAnimTask.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace NBC
|
||||
{
|
||||
public abstract class UIAnimTask : NTask
|
||||
{
|
||||
public abstract void SetDefaultInfo();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/NBC/UI/Runtime/UITween/UIAnimTask.cs.meta
Normal file
3
Assets/Scripts/NBC/UI/Runtime/UITween/UIAnimTask.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 22a6b4eac2614a4e9d0872508f9f7249
|
||||
timeCreated: 1770179810
|
||||
103
Assets/Scripts/NBC/UI/Runtime/UITween/UIPackageTween.cs
Normal file
103
Assets/Scripts/NBC/UI/Runtime/UITween/UIPackageTween.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
public class UIComponentTween : Dictionary<string, string>
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 组件动效配置包。与 UIComponentLanguagePack 结构类似,根据 resourceURL 映射到每个组件的子节点动效名称。
|
||||
/// </summary>
|
||||
public abstract class UIComponentTweenPack : Dictionary<string, UIComponentTween>
|
||||
{
|
||||
public bool Has(string url)
|
||||
{
|
||||
return ContainsKey(url);
|
||||
}
|
||||
|
||||
public void TryPlayComponentTween(GComponent component)
|
||||
{
|
||||
if (component == null || component.packageItem == null) return;
|
||||
if (!Has(component.resourceURL)) return;
|
||||
PlayComponentTween(component);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 面板调用,不判断是否存在,根节点如果配置了 __root__ 会播放。
|
||||
/// </summary>
|
||||
public void TryPlayPanelTween(GComponent component)
|
||||
{
|
||||
if (component == null) return;
|
||||
PlayComponentTween(component);
|
||||
}
|
||||
|
||||
public string GetRootTween(string url)
|
||||
{
|
||||
if (TryGetValue(url, out var cfg) && cfg != null && cfg.TryGetValue("__root__", out var tween))
|
||||
return tween;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void PlayComponentTween(GComponent component)
|
||||
{
|
||||
if (component == null) return;
|
||||
bool comHasTweenConfig = false;
|
||||
UIComponentTween tweenCfg = null;
|
||||
if (component.packageItem != null && TryGetValue(component.resourceURL, out tweenCfg))
|
||||
{
|
||||
comHasTweenConfig = true;
|
||||
}
|
||||
|
||||
var count = component.numChildren;
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var child = component.GetChildAt(i);
|
||||
if (child.packageItem != null && child is GComponent childCom)
|
||||
{
|
||||
PlayComponentTween(childCom); // 先递归子组件
|
||||
}
|
||||
|
||||
if (comHasTweenConfig)
|
||||
{
|
||||
var id = child.id;
|
||||
if (tweenCfg.TryGetValue(id, out var tweenName))
|
||||
{
|
||||
PlayTween(child, tweenName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 顶层UIPanel根节点动效改由 UIManager 设置 ShowAnim,不在这里直接播放
|
||||
if (component.parent == GRoot.inst) return;
|
||||
// if (comHasTweenConfig && tweenCfg.TryGetValue("__root__", out var rootTween))
|
||||
// {
|
||||
// PlayTween(component, rootTween);
|
||||
// }
|
||||
}
|
||||
|
||||
private static readonly Dictionary<string, Action<GObject>> TweenMap =
|
||||
new()
|
||||
{
|
||||
["Fade"] = o => o.TweenFadeShow(),
|
||||
["Scale"] = o => o.TweenScaleShow(),
|
||||
["Pop"] = o => o.TweenPopShow(),
|
||||
["SlideInL"] = o => o.TweenSlideInLeft(),
|
||||
["SlideInR"] = o => o.TweenSlideInRight(),
|
||||
["SlideInT"] = o => o.TweenSlideInTop(),
|
||||
["SlideInB"] = o => o.TweenSlideInBottom(),
|
||||
["Bounce"] = o => o.TweenBounceShow(),
|
||||
["Rotate"] = o => o.TweenRotateShow(),
|
||||
["Shake"] = o => o.TweenShake()
|
||||
};
|
||||
|
||||
private void PlayTween(GObject target, string tweenName)
|
||||
{
|
||||
if (target == null || string.IsNullOrEmpty(tweenName)) return;
|
||||
if (TweenMap.TryGetValue(tweenName, out var act))
|
||||
act(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7cd2e8cf13594c1fbef585689b1fbffa
|
||||
timeCreated: 1770173219
|
||||
266
Assets/Scripts/NBC/UI/Runtime/UITween/UIPanelAnimation.cs
Normal file
266
Assets/Scripts/NBC/UI/Runtime/UITween/UIPanelAnimation.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
/// <summary>
|
||||
/// ui界面默认动画
|
||||
/// </summary>
|
||||
public class PanelAnimationDef : UIAnimTask
|
||||
{
|
||||
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,
|
||||
|
||||
//
|
||||
CenterPopScaleFade = 6,
|
||||
UpToSlideFade = 7,
|
||||
DownToSlideFade = 8,
|
||||
LeftToSlideFade = 9,
|
||||
RightToSlideFade = 10,
|
||||
BounceVertical = 11,
|
||||
Rotate = 12,
|
||||
Shake = 13,
|
||||
}
|
||||
|
||||
private bool _isClose;
|
||||
private GComponent _node;
|
||||
private AnimType _animType;
|
||||
private float _animTime;
|
||||
|
||||
|
||||
public PanelAnimationDef(GComponent node, AnimType animType = AnimType.CenterScaleBig, bool close = false,
|
||||
float animTime = 0.5F)
|
||||
{
|
||||
_node = node;
|
||||
_isClose = close;
|
||||
_animType = animType;
|
||||
_animTime = animTime;
|
||||
}
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
if (_node == null)
|
||||
{
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// 直接使用 UITweenDynamic 扩展方法处理新增复合效果
|
||||
switch (_animType)
|
||||
{
|
||||
case AnimType.CenterPopScaleFade:
|
||||
if (!_isClose)
|
||||
_node.TweenPopShow(callback: Finish);
|
||||
else
|
||||
_node.TweenPopHide(callback: Finish);
|
||||
return;
|
||||
case AnimType.UpToSlideFade:
|
||||
if (!_isClose)
|
||||
_node.TweenSlideInTop(callback: Finish);
|
||||
else
|
||||
_node.TweenSlideOutTop(callback: Finish);
|
||||
return;
|
||||
case AnimType.DownToSlideFade:
|
||||
if (!_isClose)
|
||||
_node.TweenSlideInBottom(callback: Finish);
|
||||
else
|
||||
_node.TweenSlideOutBottom(callback: Finish);
|
||||
return;
|
||||
case AnimType.LeftToSlideFade:
|
||||
if (!_isClose)
|
||||
_node.TweenSlideInLeft(callback: Finish);
|
||||
else
|
||||
_node.TweenSlideOutLeft(callback: Finish);
|
||||
return;
|
||||
case AnimType.RightToSlideFade:
|
||||
if (!_isClose)
|
||||
_node.TweenSlideInRight(callback: Finish);
|
||||
else
|
||||
_node.TweenSlideOutRight(callback: Finish);
|
||||
return;
|
||||
case AnimType.BounceVertical:
|
||||
if (!_isClose)
|
||||
_node.TweenBounceShow(callback: Finish); // 向上偏移进入
|
||||
else
|
||||
_node.TweenBounceHide(callback: Finish);
|
||||
return;
|
||||
case AnimType.Rotate:
|
||||
if (!_isClose)
|
||||
_node.TweenRotateShow(callback: Finish);
|
||||
else
|
||||
_node.TweenRotateHide(callback: Finish);
|
||||
return;
|
||||
case AnimType.Shake:
|
||||
// shake 只在打开时使用,关闭直接结束
|
||||
if (_isClose)
|
||||
{
|
||||
Finish();
|
||||
return;
|
||||
}
|
||||
|
||||
_node.TweenShakeShow(callback: Finish);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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, _animTime)
|
||||
.SetEase(easeType)
|
||||
.SetTarget(_node, TweenPropType.Scale)
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
else if (_animType == AnimType.UpToSlide || _animType == AnimType.DownToSlide)
|
||||
{
|
||||
var safeAreaY = UI.Inst.GetSafeArea().y;
|
||||
var hight = GRoot.inst.viewHeight;
|
||||
var y = _animType == AnimType.UpToSlide ? -hight : hight;
|
||||
var strat = _isClose ? 0 : y;
|
||||
var end = _isClose ? y : safeAreaY;
|
||||
GTween.To(strat, end, _animTime)
|
||||
.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, _animTime)
|
||||
.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, _animTime)
|
||||
.SetEase(EaseType.Linear)
|
||||
.SetTarget(_node, TweenPropType.Alpha)
|
||||
.OnComplete(Finish);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置默认的状态
|
||||
/// </summary>
|
||||
public override void SetDefaultInfo()
|
||||
{
|
||||
switch (_animType)
|
||||
{
|
||||
case AnimType.CenterScaleBig:
|
||||
_node.scale = _isClose ? Vector2.one : Vector2.zero;
|
||||
break;
|
||||
case AnimType.UpToSlide:
|
||||
case AnimType.DownToSlide:
|
||||
var hight = GRoot.inst.viewHeight;
|
||||
var y = _animType == AnimType.UpToSlide ? -hight : hight;
|
||||
_node.y = _isClose ? 0 : y;
|
||||
break;
|
||||
case AnimType.LeftToSlide:
|
||||
case AnimType.RightToSlide:
|
||||
var width = GRoot.inst.viewWidth;
|
||||
var x = _animType == AnimType.LeftToSlide ? -width : width;
|
||||
_node.x = _isClose ? 0 : x;
|
||||
break;
|
||||
case AnimType.Fade:
|
||||
_node.alpha = _isClose ? 1 : 0;
|
||||
break;
|
||||
case AnimType.CenterPopScaleFade:
|
||||
_node.scale = _isClose ? Vector2.one : new Vector2(0.8f, 0.8f);
|
||||
_node.alpha = _isClose ? 1 : 0;
|
||||
break;
|
||||
case AnimType.UpToSlideFade:
|
||||
|
||||
break;
|
||||
case AnimType.DownToSlideFade:
|
||||
|
||||
break;
|
||||
case AnimType.LeftToSlideFade:
|
||||
|
||||
break;
|
||||
case AnimType.RightToSlideFade:
|
||||
|
||||
break;
|
||||
case AnimType.BounceVertical:
|
||||
|
||||
break;
|
||||
case AnimType.Rotate:
|
||||
|
||||
break;
|
||||
case AnimType.Shake:
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class UIPanelAnimation
|
||||
{
|
||||
public static UIAnimTask GetCenterScaleBig(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.CenterScaleBig, close, animTime);
|
||||
|
||||
public static UIAnimTask GetUpToSlide(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.UpToSlide, close, animTime);
|
||||
|
||||
public static UIAnimTask GetDownToSlide(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.DownToSlide, close, animTime);
|
||||
|
||||
public static UIAnimTask GetLeftToSlide(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.LeftToSlide, close, animTime);
|
||||
|
||||
public static UIAnimTask GetRightToSlide(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.RightToSlide, close, animTime);
|
||||
|
||||
public static UIAnimTask GetFade(IUIPanel panel, bool close = false, float animTime = 0.5F)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.Fade, close, animTime);
|
||||
|
||||
// 新增复合动效获取方法
|
||||
public static UIAnimTask GetCenterPopScaleFade(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.CenterPopScaleFade, close);
|
||||
|
||||
public static UIAnimTask GetUpToSlideFade(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.UpToSlideFade, close);
|
||||
|
||||
public static UIAnimTask GetDownToSlideFade(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.DownToSlideFade, close);
|
||||
|
||||
public static UIAnimTask GetLeftToSlideFade(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.LeftToSlideFade, close);
|
||||
|
||||
public static UIAnimTask GetRightToSlideFade(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.RightToSlideFade, close);
|
||||
|
||||
public static UIAnimTask GetBounceVertical(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.BounceVertical, close);
|
||||
|
||||
public static UIAnimTask GetRotate(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.Rotate, close);
|
||||
|
||||
public static UIAnimTask GetShake(IUIPanel panel, bool close = false)
|
||||
=> new PanelAnimationDef(panel.ContentPane, PanelAnimationDef.AnimType.Shake, close);
|
||||
}
|
||||
}
|
||||
840
Assets/Scripts/NBC/UI/Runtime/UITween/UITweenDynamic.cs
Normal file
840
Assets/Scripts/NBC/UI/Runtime/UITween/UITweenDynamic.cs
Normal file
@@ -0,0 +1,840 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NBC
|
||||
{
|
||||
public enum UISlideDirection
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Top,
|
||||
Bottom
|
||||
}
|
||||
|
||||
public static class UITweenDynamic
|
||||
{
|
||||
private class TweenContext
|
||||
{
|
||||
public GObject target;
|
||||
public float alpha;
|
||||
public float scaleX;
|
||||
public float scaleY;
|
||||
public Vector3 position;
|
||||
public float rotation;
|
||||
public bool visible;
|
||||
public Action callback;
|
||||
}
|
||||
|
||||
private static readonly Dictionary<GObject, TweenContext> _contexts = new Dictionary<GObject, TweenContext>();
|
||||
|
||||
private static TweenContext Capture(GObject target, Action callback)
|
||||
{
|
||||
return new TweenContext
|
||||
{
|
||||
target = target,
|
||||
alpha = target.alpha,
|
||||
scaleX = target.scaleX,
|
||||
scaleY = target.scaleY,
|
||||
position = target.position,
|
||||
rotation = target.rotation,
|
||||
visible = target.visible,
|
||||
callback = callback
|
||||
};
|
||||
}
|
||||
|
||||
// 启动新动画:如存在旧动画,先还原并调用旧回调,再杀死旧 tweens,注册新上下文
|
||||
private static TweenContext StartNewAnimation(GObject target, Action newCallback)
|
||||
{
|
||||
if (target == null) return null;
|
||||
if (_contexts.TryGetValue(target, out var oldCtx))
|
||||
{
|
||||
// 还原旧动画状态
|
||||
if (oldCtx.target != null)
|
||||
{
|
||||
oldCtx.target.alpha = oldCtx.alpha;
|
||||
oldCtx.target.SetScale(oldCtx.scaleX, oldCtx.scaleY);
|
||||
oldCtx.target.position = oldCtx.position;
|
||||
oldCtx.target.rotation = oldCtx.rotation;
|
||||
oldCtx.target.visible = oldCtx.visible;
|
||||
}
|
||||
|
||||
// 调用旧动画的回调
|
||||
oldCtx.callback?.Invoke();
|
||||
_contexts.Remove(target);
|
||||
}
|
||||
|
||||
GTween.Kill(target);
|
||||
var ctx = Capture(target, newCallback);
|
||||
_contexts[target] = ctx;
|
||||
return ctx;
|
||||
}
|
||||
|
||||
private static void FinishAnimation(GObject target)
|
||||
{
|
||||
if (target == null) return;
|
||||
if (_contexts.TryGetValue(target, out var ctx))
|
||||
{
|
||||
_contexts.Remove(target);
|
||||
ctx.callback?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#region UIPanel UI动效 (wrappers)
|
||||
|
||||
public static void TweenFadeShow<T>(this T self, float duration = 0.45f, Action callback = null)
|
||||
where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenFadeShow(duration, callback);
|
||||
}
|
||||
|
||||
public static void TweenFadeHide<T>(this T self, float duration = 0.3f, Action callback = null)
|
||||
where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenFadeHide(duration, callback);
|
||||
}
|
||||
|
||||
public static void TweenScaleShow<T>(this T self, float duration = 0.3f,
|
||||
float fromScale = 0.8f, EaseType ease = EaseType.BackOut, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
// GComponent.TweenScaleShow signature: (duration, callback, fromScale, ease)
|
||||
pane.TweenScaleShow(duration, callback, fromScale, ease);
|
||||
}
|
||||
|
||||
public static void TweenScaleHide<T>(this T self, float duration = 0.2f,
|
||||
float toScale = 0.8f, EaseType ease = EaseType.QuadIn, bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
// GComponent.TweenScaleHide signature: (duration, callback, toScale, ease, resetAfter, setInvisible)
|
||||
pane.TweenScaleHide(duration, callback, toScale, ease, resetAfter, setInvisible);
|
||||
}
|
||||
|
||||
public static void TweenPopShow<T>(this T self, float duration = 0.2f,
|
||||
float fromScale = 0.8f, EaseType ease = EaseType.BackOut, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenPopShow(duration, callback, fromScale, ease);
|
||||
}
|
||||
|
||||
public static void TweenPopHide<T>(this T self, float duration = 0.2f, Action callback = null,
|
||||
float toScale = 0.8f, EaseType ease = EaseType.QuadIn, bool setInvisible = true) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenPopHide(duration, callback, toScale, ease, setInvisible);
|
||||
}
|
||||
|
||||
public static void TweenSlideInLeft<T>(this T self, float moveTime = 0.5f, float startFadeTimeRate = 0.42f,
|
||||
float startAlpha = 0, float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideInLeft(moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset, ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutLeft<T>(this T self, float moveTime = 0.3f, float startFadeTimeRate = 0,
|
||||
float alphaTime = 0.08f, float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideOutLeft(moveTime, startFadeTimeRate, alphaTime, extraOffset, ease, resetAfter, setInvisible,
|
||||
callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInRight<T>(this T self, float moveTime = 0.5f, float startFadeTimeRate = 0.42f,
|
||||
float startAlpha = 0, float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideInRight(moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset, ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutRight<T>(this T self, float moveTime = 0.3f, float startFadeTimeRate = 0,
|
||||
float alphaTime = 0.08f, float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideOutRight(moveTime, startFadeTimeRate, alphaTime, extraOffset, ease, resetAfter, setInvisible,
|
||||
callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInTop<T>(this T self, float moveTime = 0.35f, float startFadeTimeRate = 0.3f,
|
||||
float startAlpha = 0, float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideInTop(moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset, ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutTop<T>(this T self, float moveTime = 0.3f, float startFadeTimeRate = 0,
|
||||
float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideOutTop(moveTime, startFadeTimeRate, alphaTime, extraOffset, ease, resetAfter, setInvisible,
|
||||
callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInBottom<T>(this T self, float moveTime = 0.35f, float startFadeTimeRate = 0.3f,
|
||||
float startAlpha = 0, float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideInBottom(moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset, ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutBottom<T>(this T self, float moveTime = 0.3f, float startFadeTimeRate = 0,
|
||||
float alphaTime = 0.1f, float extraOffset = 0f, EaseType ease = EaseType.QuadIn, bool resetAfter = true,
|
||||
bool setInvisible = true, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideOutBottom(moveTime, startFadeTimeRate, alphaTime, extraOffset, ease, resetAfter,
|
||||
setInvisible, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideIn<T>(this T self, UISlideDirection direction, float moveTime = 0.35f,
|
||||
float startFadeTimeRate = 0.1f,
|
||||
float startAlpha = 0, float alphaTime = 0.2f, float extraOffset = 0f, EaseType ease = EaseType.QuadOut,
|
||||
Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideIn(direction, moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset, ease,
|
||||
callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOut<T>(this T self, UISlideDirection direction, float moveTime = 0.35f,
|
||||
float startFadeTimeRate = 0.1f,
|
||||
float alphaTime = 0.2f, float extraOffset = 0f, EaseType ease = EaseType.QuadIn, bool resetAfter = true,
|
||||
bool setInvisible = true, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenSlideOut(direction, moveTime, startFadeTimeRate, alphaTime, extraOffset, ease, resetAfter,
|
||||
setInvisible, callback);
|
||||
}
|
||||
|
||||
public static void TweenBounceShow<T>(this T self, float duration = 0.4f, Action callback = null,
|
||||
float fromYOffset = -100f) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenBounceShow(duration, callback, fromYOffset);
|
||||
}
|
||||
|
||||
public static void TweenBounceHide<T>(this T self, float duration = 0.25f, Action callback = null,
|
||||
float toYOffset = 100f, bool resetAfter = true, bool setInvisible = true) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenBounceHide(duration, callback, toYOffset, resetAfter, setInvisible);
|
||||
}
|
||||
|
||||
public static void TweenRotateShow<T>(this T self, float duration = 0.2f, Action callback = null,
|
||||
float fromRotation = -90f, EaseType ease = EaseType.BackOut) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenRotateShow(duration, callback, fromRotation, ease);
|
||||
}
|
||||
|
||||
public static void TweenRotateHide<T>(this T self, float duration = 0.2f, Action callback = null,
|
||||
float toRotation = -90f, EaseType ease = EaseType.QuadIn, bool resetAfter = true, bool setInvisible = true)
|
||||
where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenRotateHide(duration, callback, toRotation, ease, resetAfter, setInvisible);
|
||||
}
|
||||
|
||||
public static void TweenShake<T>(this T self, float duration = 0.4f, Action callback = null,
|
||||
float amplitude = 12f, bool horizontal = true, int vibrato = 6) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenShake(duration, callback, amplitude, horizontal, vibrato);
|
||||
}
|
||||
|
||||
public static void TweenShakeShow<T>(this T self, float durationScale = 0.2f, float ScaleStart = 0.3f,
|
||||
float ScaleEnd = 1f, int shake = 4,
|
||||
float shakeRotation = 18f, float duration = 1, Action callback = null) where T : IUIPanel
|
||||
{
|
||||
var pane = self?.ContentPane;
|
||||
if (pane == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
pane.TweenShakeShow(durationScale, ScaleStart, ScaleEnd, shake, shakeRotation, duration, callback);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GComponent UI动效
|
||||
|
||||
public static void TweenFadeShow(this GObject self, float duration = 0.45f, Action callback = null)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
self.alpha = 0f;
|
||||
self.TweenFade(1f, duration).OnComplete(() => { FinishAnimation(self); });
|
||||
}
|
||||
|
||||
public static void TweenFadeHide(this GObject self, float duration = 0.3f, Action callback = null)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
self.alpha = 1f;
|
||||
self.TweenFade(0f, duration).OnComplete(() => { FinishAnimation(self); });
|
||||
}
|
||||
|
||||
public static void TweenScaleShow(this GObject self, float duration = 0.3f, Action callback = null,
|
||||
float fromScale = 0f, EaseType ease = EaseType.BackOut)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
self.SetPivot(0.5f, 0.5f, false);
|
||||
self.SetScale(0, 0);
|
||||
var ox = self.scaleX;
|
||||
var oy = self.scaleY;
|
||||
self.visible = true;
|
||||
self.SetScale(fromScale, fromScale);
|
||||
self.TweenScale(new Vector2(ox, oy), duration).SetEase(ease).OnComplete(() => { FinishAnimation(self); });
|
||||
}
|
||||
|
||||
public static void TweenScaleHide(this GObject self, float duration = 0.2f, Action callback = null,
|
||||
float toScale = 0.8f, EaseType ease = EaseType.QuadIn, bool resetAfter = true, bool setInvisible = true)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
self.SetPivot(0.5f, 0.5f, false);
|
||||
self.SetScale(1, 1);
|
||||
var ox = self.scaleX;
|
||||
var oy = self.scaleY;
|
||||
self.TweenScale(new Vector2(toScale, toScale), duration).SetEase(ease).OnComplete(() =>
|
||||
{
|
||||
if (resetAfter) self.SetScale(ox, oy);
|
||||
if (setInvisible) self.visible = false;
|
||||
FinishAnimation(self);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenPopShow(this GObject self, float duration = 0.2f, Action callback = null,
|
||||
float fromScale = 0.8f, EaseType ease = EaseType.BackOut)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ox = self.scaleX;
|
||||
var oy = self.scaleY;
|
||||
self.visible = true;
|
||||
self.SetScale(fromScale, fromScale);
|
||||
self.alpha = 0f;
|
||||
int remain = 2;
|
||||
|
||||
void Done()
|
||||
{
|
||||
if (--remain == 0) FinishAnimation(self);
|
||||
}
|
||||
|
||||
self.TweenScale(new Vector2(ox, oy), duration).SetEase(ease).OnComplete(Done);
|
||||
self.TweenFade(1f, duration * 0.9f).SetEase(EaseType.QuadOut).OnComplete(Done);
|
||||
}
|
||||
|
||||
public static void TweenPopHide(this GObject self, float duration = 0.2f, Action callback = null,
|
||||
float toScale = 0.8f, EaseType ease = EaseType.QuadIn, bool setInvisible = true)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ox = self.scaleX;
|
||||
var oy = self.scaleY;
|
||||
int remain = 2;
|
||||
|
||||
void Done()
|
||||
{
|
||||
if (--remain == 0)
|
||||
{
|
||||
self.SetScale(ox, oy);
|
||||
if (setInvisible) self.visible = false;
|
||||
FinishAnimation(self);
|
||||
}
|
||||
}
|
||||
|
||||
self.TweenScale(new Vector2(toScale, toScale), duration).SetEase(ease).OnComplete(Done);
|
||||
self.TweenFade(0f, duration * 0.9f).SetEase(EaseType.QuadIn).OnComplete(Done);
|
||||
}
|
||||
|
||||
public static void TweenSlideInLeft(this GObject self, float moveTime = 0.5f, float startFadeTimeRate = 0.42f
|
||||
, float startAlpha = 0, float alphaTime = 0.1f
|
||||
, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideIn(self, UISlideDirection.Left, moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset,
|
||||
ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutLeft(this GObject self, float moveTime = 0.3f, float startFadeTimeRate = 0
|
||||
, float alphaTime = 0.08f,
|
||||
float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideOut(self, UISlideDirection.Left, moveTime, startFadeTimeRate, alphaTime, extraOffset, ease,
|
||||
resetAfter, setInvisible, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInRight(this GObject self, float moveTime = 0.5f, float startFadeTimeRate = 0.42f
|
||||
, float startAlpha = 0, float alphaTime = 0.1f
|
||||
, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideIn(self, UISlideDirection.Right, moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset,
|
||||
ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutRight(this GObject self, float moveTime = 0.3f, float startFadeTimeRate = 0
|
||||
, float alphaTime = 0.08f,
|
||||
float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideOut(self, UISlideDirection.Right, moveTime, startFadeTimeRate, alphaTime, extraOffset, ease,
|
||||
resetAfter, setInvisible, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInTop(this GObject self, float moveTime = 0.35f, float startFadeTimeRate = 0.3f
|
||||
, float startAlpha = 0, float alphaTime = 0.1f
|
||||
, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideIn(self, UISlideDirection.Top, moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset,
|
||||
ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutTop(this GObject self, float moveTime = 0.3f, float startFadeTimeRate = 0
|
||||
, float alphaTime = 0.1f,
|
||||
float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideOut(self, UISlideDirection.Top, moveTime, startFadeTimeRate, alphaTime, extraOffset, ease,
|
||||
resetAfter, setInvisible, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideInBottom(this GObject self, float moveTime = 0.35f, float startFadeTimeRate = 0.3f
|
||||
, float startAlpha = 0, float alphaTime = 0.1f
|
||||
, float extraOffset = 0f, EaseType ease = EaseType.CubicOut,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideIn(self, UISlideDirection.Bottom, moveTime, startFadeTimeRate, startAlpha, alphaTime, extraOffset,
|
||||
ease, callback);
|
||||
}
|
||||
|
||||
public static void TweenSlideOutBottom(this GObject self, float moveTime = 0.3f, float startFadeTimeRate = 0
|
||||
, float alphaTime = 0.1f,
|
||||
float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
{
|
||||
TweenSlideOut(self, UISlideDirection.Bottom, moveTime, startFadeTimeRate, alphaTime, extraOffset, ease,
|
||||
resetAfter, setInvisible, callback);
|
||||
}
|
||||
|
||||
|
||||
public static void TweenSlideIn(this GObject self, UISlideDirection direction, float moveTime = 0.35f,
|
||||
float startFadeTimeRate = 0.1f
|
||||
, float startAlpha = 0, float alphaTime = 0.2f
|
||||
, float extraOffset = 0f, EaseType ease = EaseType.QuadOut,
|
||||
Action callback = null)
|
||||
{
|
||||
if (self == null || moveTime <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ori = self.position;
|
||||
float startX = ori.x;
|
||||
float startY = ori.y;
|
||||
switch (direction)
|
||||
{
|
||||
case UISlideDirection.Left: startX = startX + (-self.width / 2) - Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Right: startX = startX + (self.width / 2) + Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Top: startY = startY + (-self.height / 2) - Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Bottom: startY = startY + (self.height / 2) + Math.Max(0f, extraOffset); break;
|
||||
}
|
||||
|
||||
self.visible = true;
|
||||
self.alpha = startAlpha;
|
||||
self.position = new Vector3(startX, startY, ori.z);
|
||||
float startFadeTime = moveTime * startFadeTimeRate;
|
||||
int remain = 3;
|
||||
|
||||
void Done()
|
||||
{
|
||||
if (--remain == 0) FinishAnimation(self);
|
||||
}
|
||||
|
||||
GTweener moveTweener = (direction == UISlideDirection.Left || direction == UISlideDirection.Right)
|
||||
? self.TweenMoveX(ori.x, moveTime)
|
||||
: self.TweenMoveY(ori.y, moveTime);
|
||||
moveTweener.SetEase(ease).OnComplete(Done);
|
||||
self.TweenFade(startAlpha, startFadeTime).OnComplete(() =>
|
||||
{
|
||||
Done();
|
||||
self.TweenFade(1, alphaTime).SetEase(EaseType.QuadOut).OnComplete(Done);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenSlideOut(this GObject self, UISlideDirection direction, float moveTime = 0.35f,
|
||||
float startFadeTimeRate = 0.1f
|
||||
, float alphaTime = 0.2f,
|
||||
float extraOffset = 0f, EaseType ease = EaseType.QuadIn,
|
||||
bool resetAfter = true, bool setInvisible = true,
|
||||
Action callback = null)
|
||||
{
|
||||
if (self == null || moveTime <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ori = self.position;
|
||||
float endX = ori.x;
|
||||
float endY = ori.y;
|
||||
switch (direction)
|
||||
{
|
||||
case UISlideDirection.Left: endX = endX + (-self.width / 2) - Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Right: endX = endX + (self.width / 2) + Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Top: endY = endX + (-self.height / 2) - Math.Max(0f, extraOffset); break;
|
||||
case UISlideDirection.Bottom: endY = endX + (self.height / 2) + Math.Max(0f, extraOffset); break;
|
||||
}
|
||||
|
||||
float startAlpha = self.alpha;
|
||||
float startFadeTime = moveTime * startFadeTimeRate;
|
||||
int remain = 3;
|
||||
|
||||
void Done()
|
||||
{
|
||||
if (--remain == 0)
|
||||
{
|
||||
if (resetAfter) self.position = ori;
|
||||
if (setInvisible) self.visible = false;
|
||||
FinishAnimation(self);
|
||||
}
|
||||
}
|
||||
|
||||
GTweener moveTweener = (direction == UISlideDirection.Left || direction == UISlideDirection.Right)
|
||||
? self.TweenMoveX(endX, moveTime)
|
||||
: self.TweenMoveY(endY, moveTime);
|
||||
moveTweener.SetEase(ease).OnComplete(Done);
|
||||
|
||||
self.TweenFade(startAlpha, startFadeTime).OnComplete(() =>
|
||||
{
|
||||
Done();
|
||||
self.TweenFade(0, alphaTime).SetEase(EaseType.QuadOut).OnComplete(Done);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenBounceShow(this GObject self, float duration = 0.4f, Action callback = null,
|
||||
float fromYOffset = -100f)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ori = self.position;
|
||||
self.visible = true;
|
||||
self.position = new Vector3(ori.x, ori.y + fromYOffset, ori.z);
|
||||
self.TweenMoveY(ori.y, duration).SetEase(EaseType.BounceOut).OnComplete(() => { FinishAnimation(self); });
|
||||
}
|
||||
|
||||
public static void TweenBounceHide(this GObject self, float duration = 0.25f, Action callback = null,
|
||||
float toYOffset = 100f, bool resetAfter = true, bool setInvisible = true)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ori = self.position;
|
||||
self.TweenMoveY(ori.y + toYOffset, duration).SetEase(EaseType.QuadIn).OnComplete(() =>
|
||||
{
|
||||
if (resetAfter) self.position = ori;
|
||||
if (setInvisible) self.visible = false;
|
||||
FinishAnimation(self);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenRotateShow(this GObject self, float duration = 0.2f, Action callback = null,
|
||||
float fromRotation = -90f, EaseType ease = EaseType.BackOut)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
float ori = self.rotation;
|
||||
self.visible = true;
|
||||
self.rotation = fromRotation;
|
||||
self.TweenRotate(ori, duration).SetEase(ease).OnComplete(() => { FinishAnimation(self); });
|
||||
}
|
||||
|
||||
public static void TweenRotateHide(this GObject self, float duration = 0.2f, Action callback = null,
|
||||
float toRotation = -90f, EaseType ease = EaseType.QuadIn, bool resetAfter = true, bool setInvisible = true)
|
||||
{
|
||||
if (self == null || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
float ori = self.rotation;
|
||||
self.TweenRotate(toRotation, duration).SetEase(ease).OnComplete(() =>
|
||||
{
|
||||
if (resetAfter) self.rotation = ori;
|
||||
if (setInvisible) self.visible = false;
|
||||
FinishAnimation(self);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenShake(this GObject self, float duration = 0.4f, Action callback = null,
|
||||
float amplitude = 12f, bool horizontal = true, int vibrato = 6)
|
||||
{
|
||||
if (self == null || vibrato <= 0 || amplitude <= 0f || duration <= 0f)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
var ori = self.position;
|
||||
float single = duration / (vibrato * 2f);
|
||||
var end = horizontal
|
||||
? new Vector3(ori.x + amplitude, ori.y, ori.z)
|
||||
: new Vector3(ori.x, ori.y + amplitude, ori.z);
|
||||
self.TweenMove(end, single).SetEase(EaseType.Linear).SetRepeat(vibrato * 2, true).OnComplete(() =>
|
||||
{
|
||||
self.position = ori;
|
||||
FinishAnimation(self);
|
||||
});
|
||||
}
|
||||
|
||||
public static void TweenShakeShow(this GObject self, float durationScale = 0.2f, float ScaleStart = 0.3f,
|
||||
float ScaleEnd = 1f, int shake = 4,
|
||||
float shakeRotation = 18f, float duration = 1, Action callback = null)
|
||||
{
|
||||
if (self == null)
|
||||
{
|
||||
callback?.Invoke();
|
||||
return;
|
||||
}
|
||||
|
||||
StartNewAnimation(self, callback);
|
||||
|
||||
int remain = 4;
|
||||
|
||||
void Done()
|
||||
{
|
||||
if (--remain == 0)
|
||||
{
|
||||
FinishAnimation(self);
|
||||
}
|
||||
}
|
||||
|
||||
self.scale = Vector2.one * ScaleStart;
|
||||
self.rotation = -shakeRotation;
|
||||
|
||||
float scaleEndTime = 0.2f;
|
||||
float rotaEndTime = 0.1f;
|
||||
float allIns = durationScale + scaleEndTime + rotaEndTime;
|
||||
duration = allIns > duration ? allIns : duration;
|
||||
|
||||
float rotaTime = (duration - durationScale - scaleEndTime - rotaEndTime) / shake;
|
||||
self.TweenScale(Vector2.one * ScaleEnd * 1.1f, durationScale)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
FinishAnimation(self);
|
||||
self.TweenRotate(shakeRotation, rotaTime).SetRepeat(shake, true)
|
||||
.OnComplete(() =>
|
||||
{
|
||||
FinishAnimation(self);
|
||||
self.TweenRotate(0, rotaEndTime).OnComplete(() =>
|
||||
{
|
||||
FinishAnimation(self);
|
||||
self.TweenScale(Vector2.one * ScaleEnd, scaleEndTime).OnComplete(() =>
|
||||
{
|
||||
FinishAnimation(self);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d0b1d4565de947b99f0a88d7753e8897
|
||||
timeCreated: 1770172925
|
||||
@@ -16,7 +16,6 @@ namespace NBF
|
||||
UIObjectFactory.SetPackageItemExtension(ClassifyList.URL, typeof(ClassifyList));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonMenu.URL, typeof(CommonMenu));
|
||||
UIObjectFactory.SetPackageItemExtension(MarqueeTag.URL, typeof(MarqueeTag));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnSubMenuLeft.URL, typeof(BtnSubMenuLeft));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnTextInputControl.URL, typeof(BtnTextInputControl));
|
||||
UIObjectFactory.SetPackageItemExtension(CommonItemList.URL, typeof(CommonItemList));
|
||||
UIObjectFactory.SetPackageItemExtension(BtnTitleInputControl.URL, typeof(BtnTitleInputControl));
|
||||
|
||||
@@ -18,14 +18,16 @@ namespace NBF
|
||||
public Controller MessageStyle;
|
||||
[AutoFind(Name = "back")]
|
||||
public GImage back;
|
||||
[AutoFind(Name = "box")]
|
||||
public GImage box;
|
||||
[AutoFind(Name = "TextTitle")]
|
||||
public GTextField TextTitle;
|
||||
[AutoFind(Name = "TextContent")]
|
||||
public GTextField TextContent;
|
||||
[AutoFind(Name = "BtnCancel")]
|
||||
public BtnTitleInputControl BtnCancel;
|
||||
[AutoFind(Name = "BtnConfirm")]
|
||||
public BtnTitleInputControl BtnConfirm;
|
||||
[AutoFind(Name = "t0")]
|
||||
public Transition t0;
|
||||
public override string[] GetDependPackages(){ return new string[] {}; }
|
||||
|
||||
public static void Show(object param = null){ UI.Inst.OpenUI<MessageBox>(param); }
|
||||
|
||||
@@ -47,10 +47,8 @@ namespace NBF
|
||||
protected override void OnInit()
|
||||
{
|
||||
this.AutoAddClick(OnClick);
|
||||
// HideAnim = this.HideCenterScaleBig;
|
||||
// ShowAnim = this.ShowCenterScaleBig;
|
||||
IsModal = true;
|
||||
IsDontBack = true;
|
||||
HideAnim = UIPanelAnimation.GetCenterPopScaleFade(this, true);
|
||||
InputManager.OnUICanceled += OnUICanceled;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ namespace NBF
|
||||
protected override void OnInit()
|
||||
{
|
||||
IsShowCursor = false;
|
||||
IsDontBack = true;
|
||||
}
|
||||
|
||||
protected override void OnShow()
|
||||
|
||||
2
Assets/Scripts/UI/Home/HomePanel.Designer.cs
generated
2
Assets/Scripts/UI/Home/HomePanel.Designer.cs
generated
@@ -15,7 +15,7 @@ namespace NBF
|
||||
public override string UIResName => "HomePanel";
|
||||
|
||||
[AutoFind(Name = "Back")]
|
||||
public GLabel Back;
|
||||
public UIBlurBackground Back;
|
||||
[AutoFind(Name = "Pages")]
|
||||
public GComponent Pages;
|
||||
[AutoFind(Name = "Menu")]
|
||||
|
||||
2
Assets/Scripts/UI/Login/LoginPanel.Designer.cs
generated
2
Assets/Scripts/UI/Login/LoginPanel.Designer.cs
generated
@@ -15,7 +15,7 @@ namespace NBF
|
||||
public override string UIResName => "LoginPanel";
|
||||
|
||||
[AutoFind(Name = "Back")]
|
||||
public GLabel Back;
|
||||
public UIBlurBackground Back;
|
||||
[AutoFind(Name = "InputAccount")]
|
||||
public CommonInput InputAccount;
|
||||
[AutoFind(Name = "BtnLogin")]
|
||||
|
||||
@@ -22,7 +22,9 @@ namespace NBF
|
||||
{
|
||||
if (btn == BtnLogin)
|
||||
{
|
||||
OnLoginClick().Coroutine();
|
||||
// OnLoginClick().Coroutine();
|
||||
Debug.LogError("test");
|
||||
MessageBox.Show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +32,7 @@ namespace NBF
|
||||
{
|
||||
await LoginHelper.Login(InputAccount.text);
|
||||
|
||||
await Fishing.Instance.Go(RoleModel.Instance.Info.MapId);
|
||||
// await Fishing.Instance.Go(RoleModel.Instance.Info.MapId);
|
||||
// await MapHelper.EnterMap(mapId, role.RoomCode);
|
||||
|
||||
// BagPanel.Show();
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace NBF
|
||||
{
|
||||
base.OnInit();
|
||||
IsShowCursor = true;
|
||||
IsDontBack = true;
|
||||
//TEXT_SETTINGS_
|
||||
var groupNames = Settings.Instance.GetAllTabs();
|
||||
foreach (var group in groupNames)
|
||||
|
||||
4
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
4
Assets/Scripts/UI/Shops/ShopGearItem.Designer.cs
generated
@@ -11,7 +11,7 @@ namespace NBF
|
||||
{
|
||||
public const string URL = "ui://hxr7rc7poome9";
|
||||
|
||||
public GImage back;
|
||||
public GImage select;
|
||||
public GTextField TextPrice;
|
||||
public GImage Quality;
|
||||
public GTextField TextAmount;
|
||||
@@ -20,7 +20,7 @@ namespace NBF
|
||||
{
|
||||
base.ConstructFromXML(xml);
|
||||
|
||||
back = (GImage)GetChild("back");
|
||||
select = (GImage)GetChild("select");
|
||||
TextPrice = (GTextField)GetChild("TextPrice");
|
||||
Quality = (GImage)GetChild("Quality");
|
||||
TextAmount = (GTextField)GetChild("TextAmount");
|
||||
|
||||
3
Assets/Scripts/UI/Tween.meta
Normal file
3
Assets/Scripts/UI/Tween.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 034e1664c8564ba4985717b0ac055420
|
||||
timeCreated: 1770175824
|
||||
27
Assets/Scripts/UI/Tween/UITweenConfig.cs
Normal file
27
Assets/Scripts/UI/Tween/UITweenConfig.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
/**注册组件动效绑定。本脚本为自动生成,每次生成会覆盖!请勿手动修改,生成插件文档及项目地址:https://git.whoot.com/whoot-games/whoot.fguieditorplugin**/
|
||||
|
||||
using System.Collections.Generic;
|
||||
using FairyGUI;
|
||||
using NBC;
|
||||
|
||||
namespace NBF
|
||||
{
|
||||
public class UITweenConfig : UIComponentTweenPack
|
||||
{
|
||||
public UITweenConfig()
|
||||
{
|
||||
AddData();
|
||||
}
|
||||
|
||||
private void AddData()
|
||||
{
|
||||
// Common
|
||||
Add("ui://6hgkvlauips61", new UIComponentTween()
|
||||
{
|
||||
{ "__root__", "Fade" },
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UI/Tween/UITweenConfig.cs.meta
Normal file
2
Assets/Scripts/UI/Tween/UITweenConfig.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 290ed26c6e28f694b95cdb9c6ebd14d5
|
||||
Reference in New Issue
Block a user