Skip to content

Commit cfb0a45

Browse files
committed
modified do all rule for close all, hide all, reveal all (v2.12.0)
1 parent 71c5daf commit cfb0a45

File tree

6 files changed

+94
-237
lines changed

6 files changed

+94
-237
lines changed

Assets/OxGFrame/CHANGELOG.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# CHANGELOG
22

3+
## [2.12.0] - 2024-10-24 (rule changed)
4+
- Modified CloseAll, HideAll, RevealAll rules of method for UIFrame and SRFrame.
5+
- Set the default group id to 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.
6+
- ex: CloseAll(-1) do all without any group id.
7+
- ex: HideAll(-1) do all without any group id.
8+
- ex: RevealAll(-1) do all without any group id.
9+
- Modified CloseAllAndExcluded and HideAllAndExcluded to support the withoutAssetNames param.
10+
311
## [2.11.12] - 2024-10-17
412
- Optimized the bundle decryption memory allocation method to avoid allocating excessively large memory in a single ReadAllBytes operation.
513

Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/CoreFrames.cs

+73-19
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ namespace OxGFrame.CoreFrame
1212
{
1313
public static class CoreFrames
1414
{
15+
/// <summary>
16+
/// Default group id
17+
/// </summary>
18+
internal const int DEFAULT_GROUP_ID = 0;
19+
1520
public static class UIFrame
1621
{
1722
public static bool ignoreTimeScale
@@ -200,6 +205,7 @@ public static async UniTask Preload(string packageName, string[] assetNames, uin
200205
#region Show
201206
/// <summary>
202207
/// If use prefix "res#" will load from resources else will load from bundle
208+
/// <para>Default group id is 0</para>
203209
/// </summary>
204210
/// <param name="assetName"></param>
205211
/// <param name="data"></param>
@@ -211,12 +217,12 @@ public static async UniTask Preload(string packageName, string[] assetNames, uin
211217
public static async UniTask<UIBase> Show(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
212218
{
213219
var packageName = AssetPatcher.GetDefaultPackageName();
214-
return await UIManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
220+
return await UIManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
215221
}
216222

217223
public static async UniTask<UIBase> Show(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
218224
{
219-
return await UIManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
225+
return await UIManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
220226
}
221227

222228
public static async UniTask<UIBase> Show(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
@@ -233,12 +239,12 @@ public static async UniTask<UIBase> Show(int groupId, string packageName, string
233239
public static async UniTask<T> Show<T>(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : UIBase
234240
{
235241
var packageName = AssetPatcher.GetDefaultPackageName();
236-
return await UIManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
242+
return await UIManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
237243
}
238244

239245
public static async UniTask<T> Show<T>(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : UIBase
240246
{
241-
return await UIManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
247+
return await UIManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
242248
}
243249

244250
public static async UniTask<T> Show<T>(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : UIBase
@@ -259,19 +265,31 @@ public static void Close(string assetName, bool disabledPreClose = false, bool f
259265
UIManager.GetInstance().Close(assetName, disabledPreClose, forceDestroy);
260266
}
261267

268+
/// <summary>
269+
/// 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
270+
/// </summary>
271+
/// <param name="disabledPreClose"></param>
272+
/// <param name="forceDestroy"></param>
273+
/// <param name="withoutAssetNames"></param>
262274
public static void CloseAll(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
263275
{
264-
UIManager.GetInstance().CloseAll(disabledPreClose, forceDestroy, false, withoutAssetNames);
276+
UIManager.GetInstance().CloseAll(DEFAULT_GROUP_ID, disabledPreClose, forceDestroy, false, withoutAssetNames);
265277
}
266278

267279
public static void CloseAll(int groupId, bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
268280
{
269281
UIManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, false, withoutAssetNames);
270282
}
271283

284+
/// <summary>
285+
/// 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
286+
/// </summary>
287+
/// <param name="disabledPreClose"></param>
288+
/// <param name="forceDestroy"></param>
289+
/// <param name="withoutAssetNames"></param>
272290
public static void CloseAllAndExcluded(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
273291
{
274-
UIManager.GetInstance().CloseAll(disabledPreClose, forceDestroy, true, withoutAssetNames);
292+
UIManager.GetInstance().CloseAll(DEFAULT_GROUP_ID, disabledPreClose, forceDestroy, true, withoutAssetNames);
275293
}
276294

277295
public static void CloseAllAndExcluded(int groupId, bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
@@ -287,7 +305,7 @@ public static void CloseAllAndExcluded(int groupId, bool disabledPreClose = fals
287305
/// <param name="forceDestroy"></param>
288306
public static void CloseStackByStack(string canvasName, bool disabledPreClose = false, bool forceDestroy = false)
289307
{
290-
UIManager.GetInstance().CloseStackByStack(0, canvasName, disabledPreClose, forceDestroy);
308+
UIManager.GetInstance().CloseStackByStack(DEFAULT_GROUP_ID, canvasName, disabledPreClose, forceDestroy);
291309
}
292310

293311
/// <summary>
@@ -309,9 +327,12 @@ public static void Reveal(string assetName)
309327
UIManager.GetInstance().Reveal(assetName);
310328
}
311329

330+
/// <summary>
331+
/// 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
332+
/// </summary>
312333
public static void RevealAll()
313334
{
314-
UIManager.GetInstance().RevealAll();
335+
UIManager.GetInstance().RevealAll(DEFAULT_GROUP_ID);
315336
}
316337

317338
public static void RevealAll(int groupId)
@@ -326,19 +347,27 @@ public static void Hide(string assetName)
326347
UIManager.GetInstance().Hide(assetName);
327348
}
328349

350+
/// <summary>
351+
/// 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
352+
/// </summary>
353+
/// <param name="withoutAssetNames"></param>
329354
public static void HideAll(params string[] withoutAssetNames)
330355
{
331-
UIManager.GetInstance().HideAll(false, withoutAssetNames);
356+
UIManager.GetInstance().HideAll(DEFAULT_GROUP_ID, false, withoutAssetNames);
332357
}
333358

334359
public static void HideAll(int groupId, params string[] withoutAssetNames)
335360
{
336361
UIManager.GetInstance().HideAll(groupId, false, withoutAssetNames);
337362
}
338363

364+
/// <summary>
365+
/// 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
366+
/// </summary>
367+
/// <param name="withoutAssetNames"></param>
339368
public static void HideAllAndExcluded(params string[] withoutAssetNames)
340369
{
341-
UIManager.GetInstance().HideAll(true, withoutAssetNames);
370+
UIManager.GetInstance().HideAll(DEFAULT_GROUP_ID, true, withoutAssetNames);
342371
}
343372

344373
public static void HideAllAndExcluded(int groupId, params string[] withoutAssetNames)
@@ -505,6 +534,7 @@ public static async UniTask Preload(string packageName, string[] assetNames, uin
505534
#region Show
506535
/// <summary>
507536
/// If use prefix "res#" will load from resources else will load from bundle
537+
/// <para>Default group id is 0</para>
508538
/// </summary>
509539
/// <param name="assetName"></param>
510540
/// <param name="data"></param>
@@ -516,12 +546,12 @@ public static async UniTask Preload(string packageName, string[] assetNames, uin
516546
public static async UniTask<SRBase> Show(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
517547
{
518548
var packageName = AssetPatcher.GetDefaultPackageName();
519-
return await SRManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
549+
return await SRManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
520550
}
521551

522552
public static async UniTask<SRBase> Show(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
523553
{
524-
return await SRManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
554+
return await SRManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent);
525555
}
526556

527557
public static async UniTask<SRBase> Show(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null)
@@ -538,12 +568,12 @@ public static async UniTask<SRBase> Show(int groupId, string packageName, string
538568
public static async UniTask<T> Show<T>(string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : SRBase
539569
{
540570
var packageName = AssetPatcher.GetDefaultPackageName();
541-
return await SRManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
571+
return await SRManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
542572
}
543573

544574
public static async UniTask<T> Show<T>(string packageName, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : SRBase
545575
{
546-
return await SRManager.GetInstance().Show(0, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
576+
return await SRManager.GetInstance().Show(DEFAULT_GROUP_ID, packageName, assetName, data, awaitingUIAssetName, priority, progression, parent) as T;
547577
}
548578

549579
public static async UniTask<T> Show<T>(int groupId, string assetName, object data = null, string awaitingUIAssetName = null, uint priority = 0, Progression progression = null, Transform parent = null) where T : SRBase
@@ -564,19 +594,31 @@ public static void Close(string assetName, bool disabledPreClose = false, bool f
564594
SRManager.GetInstance().Close(assetName, disabledPreClose, forceDestroy);
565595
}
566596

597+
/// <summary>
598+
/// 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
599+
/// </summary>
600+
/// <param name="disabledPreClose"></param>
601+
/// <param name="forceDestroy"></param>
602+
/// <param name="withoutAssetNames"></param>
567603
public static void CloseAll(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
568604
{
569-
SRManager.GetInstance().CloseAll(disabledPreClose, forceDestroy, false, withoutAssetNames);
605+
SRManager.GetInstance().CloseAll(DEFAULT_GROUP_ID, disabledPreClose, forceDestroy, false, withoutAssetNames);
570606
}
571607

572608
public static void CloseAll(int groupId, bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
573609
{
574610
SRManager.GetInstance().CloseAll(groupId, disabledPreClose, forceDestroy, false, withoutAssetNames);
575611
}
576612

613+
/// <summary>
614+
/// 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
615+
/// </summary>
616+
/// <param name="disabledPreClose"></param>
617+
/// <param name="forceDestroy"></param>
618+
/// <param name="withoutAssetNames"></param>
577619
public static void CloseAllAndExcluded(bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
578620
{
579-
SRManager.GetInstance().CloseAll(disabledPreClose, forceDestroy, true, withoutAssetNames);
621+
SRManager.GetInstance().CloseAll(DEFAULT_GROUP_ID, disabledPreClose, forceDestroy, true, withoutAssetNames);
580622
}
581623

582624
public static void CloseAllAndExcluded(int groupId, bool disabledPreClose = false, bool forceDestroy = false, params string[] withoutAssetNames)
@@ -591,9 +633,12 @@ public static void Reveal(string assetName)
591633
SRManager.GetInstance().Reveal(assetName);
592634
}
593635

636+
/// <summary>
637+
/// 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
638+
/// </summary>
594639
public static void RevealAll()
595640
{
596-
SRManager.GetInstance().RevealAll();
641+
SRManager.GetInstance().RevealAll(DEFAULT_GROUP_ID);
597642
}
598643

599644
public static void RevealAll(int groupId)
@@ -610,17 +655,26 @@ public static void Hide(string assetName)
610655

611656
public static void HideAll(params string[] withoutAssetNames)
612657
{
613-
SRManager.GetInstance().HideAll(false, withoutAssetNames);
658+
SRManager.GetInstance().HideAll(DEFAULT_GROUP_ID, false, withoutAssetNames);
614659
}
615660

661+
/// <summary>
662+
/// 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
663+
/// </summary>
664+
/// <param name="groupId"></param>
665+
/// <param name="withoutAssetNames"></param>
616666
public static void HideAll(int groupId, params string[] withoutAssetNames)
617667
{
618668
SRManager.GetInstance().HideAll(groupId, false, withoutAssetNames);
619669
}
620670

671+
/// <summary>
672+
/// 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
673+
/// </summary>
674+
/// <param name="withoutAssetNames"></param>
621675
public static void HideAllAndExcluded(params string[] withoutAssetNames)
622676
{
623-
SRManager.GetInstance().HideAll(true, withoutAssetNames);
677+
SRManager.GetInstance().HideAll(DEFAULT_GROUP_ID, true, withoutAssetNames);
624678
}
625679

626680
public static void HideAllAndExcluded(int groupId, params string[] withoutAssetNames)

Assets/OxGFrame/CoreFrame/Scripts/Runtime/Core/Implement/FrameManager.cs

-18
Original file line numberDiff line numberDiff line change
@@ -573,14 +573,6 @@ public async virtual UniTask<T> Show(int groupId, string packageName, string ass
573573
/// <param name="forceDestroy"></param>
574574
public virtual void Close(string assetName, bool disabledPreClose = false, bool forceDestroy = false) { }
575575

576-
/// <summary>
577-
/// 全部關閉
578-
/// </summary>
579-
/// <param name="disabledPreClose"></param>
580-
/// <param name="forceDestroy"></param>
581-
/// <param name="withoutAssetNames"></param>
582-
public virtual void CloseAll(bool disabledPreClose = false, bool forceDestroy = false, bool forceCloseExcluded = false, params string[] withoutAssetNames) { }
583-
584576
/// <summary>
585577
/// 透過 id 群組進行全部關閉
586578
/// </summary>
@@ -598,11 +590,6 @@ public virtual void CloseAll(int groupId, bool disabledPreClose = false, bool fo
598590
/// <param name="assetName"></param>
599591
public virtual void Reveal(string assetName) { }
600592

601-
/// <summary>
602-
/// 全部解除隱藏 (只允許 Hide, 如果透過 Close 則無法進行 Reveal)
603-
/// </summary>
604-
public virtual void RevealAll() { }
605-
606593
/// <summary>
607594
/// 透過 id 群組進行全部解除隱藏 (只允許 Hide, 如果透過 Close 則無法進行 Reveal)
608595
/// </summary>
@@ -617,11 +604,6 @@ public virtual void RevealAll(int groupId) { }
617604
/// <param name="assetName"></param>
618605
public virtual void Hide(string assetName) { }
619606

620-
/// <summary>
621-
/// 全部隱藏 (可透過 Show 或者 Reveal 進行顯示, 差別在於初始行為)
622-
/// </summary>
623-
public virtual void HideAll(bool forceHideExcluded = false, params string[] withoutAssetNames) { }
624-
625607
/// <summary>
626608
/// 透過 id 群組進行全部隱藏 (可透過 Show 或者 Reveal 進行顯示, 差別在於初始行為)
627609
/// </summary>

0 commit comments

Comments
 (0)