111
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
@@ -6,6 +7,7 @@ using UnityEngine.UI;
|
||||
#if HotUpdate
|
||||
using YooAsset;
|
||||
#endif
|
||||
|
||||
namespace Stary.Evo.UIFarme
|
||||
{
|
||||
public interface IBasePanel : IController
|
||||
@@ -14,6 +16,7 @@ namespace Stary.Evo.UIFarme
|
||||
/// UI信息
|
||||
/// </summary>
|
||||
string UIName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 绑定这个面板的实例
|
||||
/// </summary>
|
||||
@@ -28,7 +31,7 @@ namespace Stary.Evo.UIFarme
|
||||
/// <summary>
|
||||
/// 虚方法,UI进入时执行的操作,只会执行一次
|
||||
/// </summary>
|
||||
void OnEnter();
|
||||
void OnEnter(Action complete = null);
|
||||
|
||||
/// <summary>
|
||||
/// 虚方法,UI暂停时执行的操作,只会执行一次
|
||||
@@ -74,6 +77,8 @@ namespace Stary.Evo.UIFarme
|
||||
/// </summary>
|
||||
public string UIName { get; set; }
|
||||
|
||||
public abstract UITweenType TweenType { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 面板管理器
|
||||
/// </summary>
|
||||
@@ -118,11 +123,27 @@ namespace Stary.Evo.UIFarme
|
||||
}
|
||||
|
||||
|
||||
public virtual void OnEnter()
|
||||
public virtual void OnEnter(Action complete = null)
|
||||
{
|
||||
activePanel.SetActive(true);
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
canvasGroup.DOFade(1f, 1f);
|
||||
if (TweenType == UITweenType.Fade)
|
||||
{
|
||||
canvasGroup.alpha = 1f;
|
||||
}
|
||||
|
||||
if (TweenType == UITweenType.Fade)
|
||||
{
|
||||
canvasGroup.DOFade(1f, 2f).OnComplete(() => { complete?.Invoke(); });
|
||||
}
|
||||
else if (TweenType == UITweenType.Yoyo)
|
||||
{
|
||||
canvasGroup.DOFade(1, 2f).SetLoops(2, LoopType.Yoyo).OnComplete(() => { complete?.Invoke(); });
|
||||
}
|
||||
else
|
||||
{
|
||||
canvasGroup.DOFade(1, 2f).SetLoops(-1).OnComplete(() => { complete?.Invoke(); });
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnPause()
|
||||
@@ -169,15 +190,15 @@ namespace Stary.Evo.UIFarme
|
||||
}
|
||||
else
|
||||
{
|
||||
var package = YooAssets.TryGetPackage(packageName);
|
||||
if (package == null)
|
||||
{
|
||||
handle = YooAssets.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
handle = package.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
var package = YooAssets.TryGetPackage(packageName);
|
||||
if (package == null)
|
||||
{
|
||||
handle = YooAssets.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
else
|
||||
{
|
||||
handle = package.LoadAssetAsync<GameObject>(panelName);
|
||||
}
|
||||
}
|
||||
|
||||
await handle.Task;
|
||||
@@ -192,7 +213,7 @@ namespace Stary.Evo.UIFarme
|
||||
activePanel.name = this.GetType().Name;
|
||||
|
||||
|
||||
if (!activePanel.GetComponentInChildren<Canvas>() && !activePanel.GetComponentInParent<Canvas>())
|
||||
if (!activePanel.GetComponentInChildren<Canvas>() && !activePanel.GetComponentInParent<Canvas>())
|
||||
{
|
||||
Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{panelName}无法正常运行,进程已中断,请检查!!!!!");
|
||||
return null;
|
||||
@@ -236,5 +257,28 @@ namespace Stary.Evo.UIFarme
|
||||
{
|
||||
return PanelSystem.GetArchitecture();
|
||||
}
|
||||
|
||||
public enum UITweenType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无动画
|
||||
/// </summary>
|
||||
None,
|
||||
|
||||
/// <summary>
|
||||
/// 淡入淡出
|
||||
/// </summary>
|
||||
Fade,
|
||||
|
||||
/// <summary>
|
||||
/// 循环播放
|
||||
/// </summary>
|
||||
Loop,
|
||||
|
||||
/// <summary>
|
||||
/// 往返播放
|
||||
/// </summary>
|
||||
Yoyo,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@ namespace Stary.Evo.UIFarme
|
||||
/// </summary>
|
||||
void PopQueue<T>(string panelName=null) where T : IBasePanel, new();
|
||||
|
||||
void PopQueue<T>(T t, string panelName=null) where T : IBasePanel, new();
|
||||
/// <summary>
|
||||
/// 执行面板的出栈操作,此操作会执行面板的OnExit方法
|
||||
/// </summary>
|
||||
@@ -203,6 +204,11 @@ namespace Stary.Evo.UIFarme
|
||||
}
|
||||
}
|
||||
|
||||
public void PopQueue<T>(T t, string panelName = null) where T : IBasePanel, new()
|
||||
{
|
||||
PopQueue<T>(panelName);
|
||||
}
|
||||
|
||||
public void PopStack()
|
||||
{
|
||||
if (stackPanel.Count > 0)
|
||||
|
||||
@@ -31,6 +31,8 @@ public class VideoPanel : BasePanel
|
||||
}
|
||||
|
||||
|
||||
public override UITweenType TweenType => UITweenType.Fade;
|
||||
|
||||
public override void Initialize(GameObject panelGo)
|
||||
{
|
||||
base.Initialize(panelGo);
|
||||
@@ -43,9 +45,9 @@ public class VideoPanel : BasePanel
|
||||
_animator = area.GetComponentInChildren<Animator>();
|
||||
}
|
||||
|
||||
public override void OnEnter()
|
||||
public override void OnEnter(Action complete = null)
|
||||
{
|
||||
base.OnEnter();
|
||||
base.OnEnter(complete);
|
||||
|
||||
this.RegisterEvent<ModeType, VideoInfo>(ModeType.VideoStart, OnStartMove);
|
||||
this.RegisterEvent<ModeType>(ModeType.VideoEnd, OnStopMove);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.staryevo.tools",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"displayName": "00.StaryEvo.Tools",
|
||||
"description": "This is an Framework package(后台服务器版本,端口9527)",
|
||||
"unity": "2021.3",
|
||||
|
||||
Reference in New Issue
Block a user