Skip to content

Commit

Permalink
updated to v2.12.3
Browse files Browse the repository at this point in the history
  • Loading branch information
michael811125 committed Dec 27, 2024
1 parent e2badf0 commit 1dfda88
Show file tree
Hide file tree
Showing 13 changed files with 147 additions and 62 deletions.
13 changes: 13 additions & 0 deletions Assets/OxGFrame/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# CHANGELOG

## [2.12.3] - 2024-12-27
- Added to CoreFrames.SRFrame & CoreFrames.UIFrame:
- Can use CheckHasAnyHidingAllGroups() to replace CheckHasAnyHiding(-1).
- Can use CloseAllForAllGroups() to replace CloseAll(-1).
- Can use CloseAllAndExcludedForAllGroups() to replace CloseAllAndExcluded(-1).
- Can use RevealAllForAllGroups() to replace RevealAll(-1).
- Can use HideAllForAllGroups() to replace HideAll(-1).
- Can use HideAllAndExcludedForAllGroups() to replace HideAllExcluded(-1).
- Modified access modifiers of certain methods.
- Modified CoreFrames.SRFrame & CoreFrames.UIFrame:
- Update the rules for CheckHasAnyHiding(). By default, groupId is set to 0, and -1 indicates that all groupIds should be processed.
- Fixed RevealAll not marking hidden as false.

## [2.12.2] - 2024-11-11
- Updated UniEvent of UniFramework.
- Added constructors in EncryptionServices (Editor).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private void OnDestroy()

public override void OnCreate() { }

public sealed override void InitFirst()
internal sealed override void InitFirst()
{
base.InitFirst();
}
Expand All @@ -77,7 +77,7 @@ protected override void OnFixedUpdate(float dt) { }

protected override void OnLateUpdate(float dt) { }

public sealed override void Display(object obj)
internal sealed override void Display(object obj)
{
this.gameObject.SetActive(true);
this.OnShow();
Expand Down Expand Up @@ -133,7 +133,7 @@ protected override void OnShow(object obj) { }
public override void OnReceiveAndRefresh(object obj = null) { }

[System.Obsolete("This is not supported in this class.")]
public sealed override void Hide(bool disabledPreClose = false) { }
internal sealed override void Hide(bool disabledPreClose = false) { }

[System.Obsolete("This is not supported in this class.")]
protected sealed override void CloseSelf() { }
Expand Down
79 changes: 76 additions & 3 deletions Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/CoreFrames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public static class CoreFrames
/// </summary>
internal const int DEFAULT_GROUP_ID = 0;

/// <summary>
/// Do all groups
/// </summary>
internal const int DO_ALL_GROUPS = -1;

/// <summary>
/// User Interface
/// </summary>
Expand Down Expand Up @@ -77,19 +82,28 @@ public static bool CheckIsHiding(UIBase uiBase)
return UIManager.GetInstance().CheckIsHiding(uiBase);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
/// <returns></returns>
public static bool CheckHasAnyHiding()
{
return UIManager.GetInstance().CheckHasAnyHiding();
return UIManager.GetInstance().CheckHasAnyHiding(DEFAULT_GROUP_ID);
}

public static bool CheckHasAnyHiding(int groupId)
{
return UIManager.GetInstance().CheckHasAnyHiding(groupId);
}

public static bool CheckHasAnyHidingForAllGroups()
{
return UIManager.GetInstance().CheckHasAnyHiding(DO_ALL_GROUPS);
}

public static int GetStackByStackCount(string canvasName)
{
return UIManager.GetInstance().GetStackByStackCount(0, canvasName);
return UIManager.GetInstance().GetStackByStackCount(DEFAULT_GROUP_ID, canvasName);
}

public static int GetStackByStackCount(int groupId, string canvasName)
Expand Down Expand Up @@ -284,6 +298,11 @@ public static void CloseAll(int groupId, bool disabledPreClose = false, bool for
UIManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, false, withoutAssetNames);
}

public static void CloseAllForAllGroups(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
{
UIManager.GetInstance().CloseAll(DO_ALL_GROUPS, disabledPreClose, forceDestroy, false, withoutAssetNames);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
Expand All @@ -300,6 +319,11 @@ public static void CloseAllAndExcluded(int groupId, bool disabledPreClose = fals
UIManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, true, withoutAssetNames);
}

public static void CloseAllAndExcludedForAllGroups(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
{
UIManager.GetInstance().CloseAll(DO_ALL_GROUPS, disabledPreClose, forceDestroy, true, withoutAssetNames);
}

/// <summary>
/// Only allow close stack by stack
/// </summary>
Expand Down Expand Up @@ -342,6 +366,11 @@ public static void RevealAll(int groupId)
{
UIManager.GetInstance().RevealAll(groupId);
}

public static void RevealAllForAllGroups()
{
UIManager.GetInstance().RevealAll(DO_ALL_GROUPS);
}
#endregion

#region Hide
Expand All @@ -364,6 +393,11 @@ public static void HideAll(int groupId, params string[] withoutAssetNames)
UIManager.GetInstance().HideAll(groupId, false, withoutAssetNames);
}

public static void HideAllForAllGroups(params string[] withoutAssetNames)
{
UIManager.GetInstance().HideAll(DO_ALL_GROUPS, false, withoutAssetNames);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
Expand All @@ -377,6 +411,11 @@ public static void HideAllAndExcluded(int groupId, params string[] withoutAssetN
{
UIManager.GetInstance().HideAll(groupId, true, withoutAssetNames);
}

public static void HideAllAndExcludedForAllGroups(params string[] withoutAssetNames)
{
UIManager.GetInstance().HideAll(DO_ALL_GROUPS, true, withoutAssetNames);
}
#endregion
}

Expand Down Expand Up @@ -431,16 +470,25 @@ public static bool CheckIsHiding(SRBase srBase)
return SRManager.GetInstance().CheckIsHiding(srBase);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
/// <returns></returns>
public static bool CheckHasAnyHiding()
{
return SRManager.GetInstance().CheckHasAnyHiding();
return SRManager.GetInstance().CheckHasAnyHiding(DEFAULT_GROUP_ID);
}

public static bool CheckHasAnyHiding(int groupId)
{
return SRManager.GetInstance().CheckHasAnyHiding(groupId);
}

public static bool CheckHasAnyHidingForAllGroups()
{
return SRManager.GetInstance().CheckHasAnyHiding(DO_ALL_GROUPS);
}

/// <summary>
/// Send refresh message to specific with data
/// </summary>
Expand Down Expand Up @@ -616,6 +664,11 @@ public static void CloseAll(int groupId, bool disabledPreClose = false, bool for
SRManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, false, withoutAssetNames);
}

public static void CloseAllForAllGroups(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
{
SRManager.GetInstance().CloseAll(DO_ALL_GROUPS, disabledPreClose, forceDestroy, false, withoutAssetNames);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
Expand All @@ -631,6 +684,11 @@ public static void CloseAllAndExcluded(int groupId, bool disabledPreClose = fals
{
SRManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, true, withoutAssetNames);
}

public static void CloseAllAndExcludedForAllGroups(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
{
SRManager.GetInstance().CloseAll(DO_ALL_GROUPS, disabledPreClose, forceDestroy, true, withoutAssetNames);
}
#endregion

#region Reveal
Expand All @@ -651,6 +709,11 @@ public static void RevealAll(int groupId)
{
SRManager.GetInstance().RevealAll(groupId);
}

public static void RevealAllForAllGroups()
{
SRManager.GetInstance().RevealAll(DO_ALL_GROUPS);
}
#endregion

#region Hide
Expand All @@ -674,6 +737,11 @@ public static void HideAll(int groupId, params string[] withoutAssetNames)
SRManager.GetInstance().HideAll(groupId, false, withoutAssetNames);
}

public static void HideAllForAllGroups(params string[] withoutAssetNames)
{
SRManager.GetInstance().HideAll(DO_ALL_GROUPS, false, withoutAssetNames);
}

/// <summary>
/// Default group id is 0, but if you don't want to execute based on the group id and want to do all, can set the group id to -1
/// </summary>
Expand All @@ -687,6 +755,11 @@ public static void HideAllAndExcluded(int groupId, params string[] withoutAssetN
{
SRManager.GetInstance().HideAll(groupId, true, withoutAssetNames);
}

public static void HideAllAndExcludedForAllGroups(params string[] withoutAssetNames)
{
SRManager.GetInstance().HideAll(DO_ALL_GROUPS, true, withoutAssetNames);
}
#endregion
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private void OnValidate()
/// <summary>
/// 綁定與初次初始
/// </summary>
public virtual void InitFirst()
internal virtual void InitFirst()
{
// 未綁定的話就執行綁定流程
if (!this._isBinded)
Expand All @@ -171,7 +171,7 @@ public virtual void InitFirst()
/// 預初始
/// </summary>
/// <returns></returns>
public async UniTask PreInit()
internal async UniTask PreInit()
{
// 等待異步加載, 進行異步加載動作
await this.OnPreShow();
Expand Down Expand Up @@ -202,12 +202,12 @@ protected virtual void OnAutoBind() { }
/// 顯示相關流程
/// </summary>
/// <param name="obj"></param>
public abstract void Display(object obj);
internal abstract void Display(object obj);

/// <summary>
/// 隱藏相關流程
/// </summary>
public abstract void Hide(bool disabledPreClose);
internal abstract void Hide(bool disabledPreClose);

/// <summary>
/// 開啟時每次都會被呼叫
Expand Down Expand Up @@ -268,7 +268,7 @@ public virtual void OnRelease() { }
/// 設置名稱
/// </summary>
/// <param name="assetName"></param>
public void SetNames(string assetName)
internal void SetNames(string assetName)
{
this.assetName = assetName;
}
Expand All @@ -277,7 +277,7 @@ public void SetNames(string assetName)
/// 設置群組 Id
/// </summary>
/// <param name="groupId"></param>
public void SetGroupId(int groupId)
internal void SetGroupId(int groupId)
{
this.groupId = groupId;
}
Expand All @@ -286,7 +286,7 @@ public void SetGroupId(int groupId)
/// 設置隱藏開關
/// </summary>
/// <param name="isHidden"></param>
public void SetHidden(bool isHidden)
internal void SetHidden(bool isHidden)
{
this.isHidden = isHidden;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,22 +324,10 @@ public bool CheckHasAnyHiding(int groupId)
{
foreach (var fBase in this._dictAllCache.Values)
{
if (fBase.Peek().groupId == groupId && fBase.Peek().isHidden) return true;
}

return false;
}

/// <summary>
/// 判斷是否有任一隱藏
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public bool CheckHasAnyHiding()
{
foreach (var fBase in this._dictAllCache.Values)
{
if (fBase.Peek().isHidden) return true;
if (groupId == -1 && fBase.Peek().isHidden)
return true;
else if (fBase.Peek().groupId == groupId && fBase.Peek().isHidden)
return true;
}

return false;
Expand Down
15 changes: 10 additions & 5 deletions Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/SRFrame/SRBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class SRBase : FrameBase

public override void OnCreate() { }

public sealed override void InitFirst()
internal sealed override void InitFirst()
{
base.InitFirst();
}
Expand All @@ -31,15 +31,20 @@ protected override void OnFixedUpdate(float dt) { }

protected override void OnLateUpdate(float dt) { }

public sealed override void Display(object obj)
internal sealed override void Display(object obj)
{
this.gameObject.SetActive(true);

if (!this.isHidden) this.OnShow(obj);
else this.OnReveal();
if (!this.isHidden)
this.OnShow(obj);
else
{
this.OnReveal();
this.SetHidden(false);
}
}

public sealed override void Hide(bool disabledPreClose = false)
internal sealed override void Hide(bool disabledPreClose = false)
{
if (!this.gameObject.activeSelf) return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,8 @@ public override void HideAll(int groupId, bool forceHideExcluded = false, params
#region 顯示場景 & 關閉場景
protected async UniTask LoadAndDisplay(SRBase srBase, object obj = null)
{
if (!srBase.isHidden) await srBase.PreInit();
if (!srBase.isHidden)
await srBase.PreInit();
srBase.Display(obj);
}

Expand Down
Loading

0 comments on commit 1dfda88

Please sign in to comment.