Skip to content

Commit ded427c

Browse files
committed
v1.0.195 release
1 parent 1fc197d commit ded427c

File tree

5 files changed

+52
-6
lines changed

5 files changed

+52
-6
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"Id": "",
3-
"Version": "v1.0.194",
3+
"Version": "v1.0.195",
44
"Type": 0,
55
"AccessRight": 0,
66
"DownloadUrl": "",
@@ -11,10 +11,10 @@
1111
],
1212
"DocUrl": "https://liangxiegame.com",
1313
"Readme": {
14-
"version": "v1.0.194",
15-
"content": "UIKit&CodeGenKit:UIPanel 与 ViewController 兼容(不重复拥有 Bind)",
14+
"version": "v1.0.195",
15+
"content": "* ResLoader 增加 RecycleWhenGameObjectDestroyed API",
1616
"author": "liangxie",
17-
"date": "2025 年 05 月 25 日 10:05",
17+
"date": "2025 年 05 月 26 日 10:17",
1818
"PackageId": ""
1919
}
2020
}

QFramework.Unity2018+/Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/IResLoader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright (c) 2016 ~ 2022 liangxiegame UNDER MIT LICENSE
2+
* Copyright (c) 2016 ~ 2025 liangxiegame UNDER MIT LICENSE
33
*
44
* https://qframework.cn
55
* https://github.com/liangxiegame/QFramework
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using System.Collections.Generic;
2+
using UnityEngine;
3+
4+
namespace QFramework
5+
{
6+
public class ResLoaderOnDestroyRecycler : MonoBehaviour
7+
{
8+
private HashSet<ResLoader> mResLoaders = new HashSet<ResLoader>();
9+
10+
public void AddResLoader(ResLoader loader)
11+
{
12+
mResLoaders.Add(loader);
13+
}
14+
15+
private void OnDestroy()
16+
{
17+
foreach (var resLoader in mResLoaders)
18+
{
19+
resLoader.Recycle2Cache();
20+
}
21+
22+
mResLoaders.Clear();
23+
mResLoaders = null;
24+
}
25+
}
26+
27+
public static class ResLoaderOnDestroyReleaserExtension
28+
{
29+
public static ResLoader RecycleWhenGameObjectDestroyed(this ResLoader self,Component component)
30+
{
31+
var recycler = component.GetOrAddComponent<ResLoaderOnDestroyRecycler>();
32+
recycler.AddResLoader(self);
33+
return self;
34+
}
35+
36+
public static ResLoader RecycleWhenGameObjectDestroyed(this ResLoader self,GameObject gameObj)
37+
{
38+
var recycler = gameObj.GetOrAddComponent<ResLoaderOnDestroyRecycler>();
39+
recycler.AddResLoader(self);
40+
return self;
41+
}
42+
}
43+
}

QFramework.Unity2018+/Assets/QFramework/Toolkits/ResKit/Scripts/Framework/ResLoader/ResLoaderOnDestroyRecycler.cs.meta

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

QFramework.Unity2018+/Assets/QFramework/Toolkits/ResKit/Scripts/ResKit.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright (c) 2016 - 2023 liangxiegame UNDER MIT License
2+
* Copyright (c) 2016 - 2025 liangxiegame UNDER MIT License
33
*
44
* https://qframework.cn
55
* https://github.com/liangxiegame/QFramework

0 commit comments

Comments
 (0)