forked from LiShengYang-yiyi/YIUI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
89d8a9e
commit f2c9692
Showing
7 changed files
with
222 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using Cysharp.Threading.Tasks; | ||
using UnityEngine; | ||
|
||
namespace YIUIFramework | ||
{ | ||
public abstract partial class BasePanel | ||
{ | ||
public void CloseView<T>(bool tween = true) | ||
where T : BaseView | ||
{ | ||
CloseViewAsync<T>(tween).Forget(); | ||
} | ||
|
||
public void CloseView(string resName, bool tween = true) | ||
{ | ||
CloseViewAsync(resName, tween).Forget(); | ||
} | ||
|
||
public async UniTask<bool> CloseViewAsync<TView>(bool tween = true) | ||
where TView : BaseView | ||
{ | ||
var (exist, entity) = ExistView<TView>(); | ||
if (!exist) return false; | ||
return await CloseViewAsync(entity, tween); | ||
} | ||
|
||
public async UniTask<bool> CloseViewAsync(string resName, bool tween = true) | ||
{ | ||
var (exist, entity) = ExistView(resName); | ||
if (!exist) return false; | ||
return await CloseViewAsync(entity, tween); | ||
} | ||
|
||
private async UniTask<bool> CloseViewAsync(BaseView view, bool tween) | ||
{ | ||
if (view == null) return false; | ||
await view.CloseAsync(tween); | ||
return true; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
namespace YIUIFramework | ||
{ | ||
public partial class PanelMgr | ||
{ | ||
#region 判断Panel是否存在且显示 | ||
|
||
public bool ActiveSelf(string panelName) | ||
{ | ||
var info = GetPanelInfo(panelName); | ||
return info?.ActiveSelf ?? false; | ||
} | ||
|
||
public bool ActiveSelf<T>() where T : BasePanel | ||
{ | ||
var info = GetPanelInfo<T>(); | ||
return info?.ActiveSelf ?? false; | ||
} | ||
|
||
#endregion | ||
|
||
#region 判断指定Panel的指定View是否存在且显示 | ||
|
||
public bool ActiveSelfView(string panelName, string viewName) | ||
{ | ||
var info = GetPanelInfo(panelName); | ||
if (info == null) return false; | ||
if (info.UIBasePanel == null) return false; | ||
var (exist, entity) = info.UIBasePanel.ExistView(viewName); | ||
if (!exist) return false; | ||
return entity.ActiveSelf; | ||
} | ||
|
||
public bool ActiveSelfView<TPanel, TView>() | ||
where TPanel : BasePanel | ||
where TView : BaseView | ||
{ | ||
var info = GetPanelInfo<TPanel>(); | ||
if (info == null) return false; | ||
if (info.UIBasePanel == null) return false; | ||
var (exist, entity) = info.UIBasePanel.ExistView<TView>(); | ||
if (!exist) return false; | ||
return entity.ActiveSelf; | ||
} | ||
|
||
public bool ActiveSelfViewByViewName<TPanel>(string viewName) | ||
where TPanel : BasePanel | ||
{ | ||
var info = GetPanelInfo<TPanel>(); | ||
if (info == null) return false; | ||
if (info.UIBasePanel == null) return false; | ||
var (exist, entity) = info.UIBasePanel.ExistView(viewName); | ||
if (!exist) return false; | ||
return entity.ActiveSelf; | ||
} | ||
|
||
public bool ActiveSelfViewByPanelName<TView>(string panelName) | ||
where TView : BaseView | ||
{ | ||
var info = GetPanelInfo(panelName); | ||
if (info == null) return false; | ||
if (info.UIBasePanel == null) return false; | ||
var (exist, entity) = info.UIBasePanel.ExistView<TView>(); | ||
if (!exist) return false; | ||
return entity.ActiveSelf; | ||
} | ||
|
||
#endregion | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters