提交 df614faf 编写于 作者: T tanghai

1.热更层ObjectPool可视化池的名字修复

2.ABInfo改用池
上级 212109ee
......@@ -96,6 +96,9 @@ namespace ETHotfix
{
queue = new ComponentQueue(type.Name);
queue.Parent = this;
#if !SERVER
queue.GameObject.name = $"{type.Name}s";
#endif
this.dictionary.Add(type, queue);
}
queue.Enqueue(obj);
......
......@@ -97,7 +97,7 @@ namespace ETModel
queue = new ComponentQueue(type.Name);
queue.Parent = this;
#if !SERVER
queue.GameObject.name = type.Name;
queue.GameObject.name = $"{type.Name}s";
#endif
this.dictionary.Add(type, queue);
}
......
......@@ -23,20 +23,20 @@ namespace ILRuntime.Runtime.Generated
Type[] args;
Type type = typeof(ETModel.IdGenerater);
args = new Type[]{};
method = type.GetMethod("GenerateId", flag, null, args, null);
app.RegisterCLRMethodRedirection(method, GenerateId_0);
method = type.GetMethod("GenerateInstanceId", flag, null, args, null);
app.RegisterCLRMethodRedirection(method, GenerateInstanceId_0);
}
static StackObject* GenerateId_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
static StackObject* GenerateInstanceId_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
{
ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
StackObject* __ret = ILIntepreter.Minus(__esp, 0);
var result_of_this_method = ETModel.IdGenerater.GenerateId();
var result_of_this_method = ETModel.IdGenerater.GenerateInstanceId();
__ret->ObjectType = ObjectTypes.Long;
*(long*)&__ret->Value = result_of_this_method;
......
......@@ -10,33 +10,24 @@ using UnityEditor;
namespace ETModel
{
public class ABInfo : Component
[ObjectSystem]
public class ABInfoAwakeSystem : AwakeSystem<ABInfo, string, AssetBundle>
{
private int refCount;
public string Name { get; }
public int RefCount
public override void Awake(ABInfo self, string abName, AssetBundle a)
{
get
{
return this.refCount;
}
set
{
//Log.Debug($"{this.Name} refcount: {value}");
this.refCount = value;
}
self.AssetBundle = a;
self.Name = abName;
self.RefCount = 1;
}
}
public class ABInfo : Component
{
public string Name { get; set; }
public AssetBundle AssetBundle { get; }
public int RefCount { get; set; }
public ABInfo(string name, AssetBundle ab)
{
this.Name = name;
this.AssetBundle = ab;
this.RefCount = 1;
//Log.Debug($"load assetbundle: {this.Name}");
}
public AssetBundle AssetBundle;
public override void Dispose()
{
......@@ -53,6 +44,9 @@ namespace ETModel
{
this.AssetBundle.Unload(true);
}
this.RefCount = 0;
this.Name = "";
}
}
......@@ -191,7 +185,7 @@ namespace ETModel
foreach (var abInfo in this.bundles)
{
abInfo.Value?.AssetBundle?.Unload(true);
abInfo.Value.Dispose();
}
this.bundles.Clear();
......@@ -217,7 +211,7 @@ namespace ETModel
public void UnloadBundle(string assetBundleName)
{
assetBundleName = assetBundleName.ToLower();
assetBundleName = assetBundleName.BundleNameToLower();
string[] dependencies = AssetBundleHelper.GetSortedDependencies(assetBundleName);
......@@ -230,7 +224,7 @@ namespace ETModel
private void UnloadOneBundle(string assetBundleName)
{
assetBundleName = assetBundleName.ToLower();
assetBundleName = assetBundleName.BundleNameToLower();
ABInfo abInfo;
if (!this.bundles.TryGetValue(assetBundleName, out abInfo))
......@@ -249,6 +243,7 @@ namespace ETModel
this.bundles.Remove(assetBundleName);
this.resourceCache.Remove(assetBundleName);
abInfo.Dispose();
//Log.Debug($"cache count: {this.cacheDictionary.Count}");
}
......@@ -307,7 +302,7 @@ namespace ETModel
AddResource(assetBundleName, assetName, resource);
}
abInfo = new ABInfo(assetBundleName, null);
abInfo = ComponentFactory.CreateWithParent<ABInfo, string, AssetBundle>(this, assetBundleName, null);
abInfo.Parent = this;
this.bundles[assetBundleName] = abInfo;
#endif
......@@ -341,8 +336,7 @@ namespace ETModel
}
}
abInfo = new ABInfo(assetBundleName, assetBundle);
abInfo.Parent = this;
abInfo = ComponentFactory.CreateWithParent<ABInfo, string, AssetBundle>(this, assetBundleName, assetBundle);
this.bundles[assetBundleName] = abInfo;
}
......@@ -388,8 +382,7 @@ namespace ETModel
AddResource(assetBundleName, assetName, resource);
}
abInfo = new ABInfo(assetBundleName, null);
abInfo.Parent = this;
abInfo = ComponentFactory.CreateWithParent<ABInfo, string, AssetBundle>(this, assetBundleName, null);
this.bundles[assetBundleName] = abInfo;
#endif
return;
......@@ -426,8 +419,7 @@ namespace ETModel
}
}
abInfo = new ABInfo(assetBundleName, assetBundle);
abInfo.Parent = this;
abInfo = ComponentFactory.CreateWithParent<ABInfo, string, AssetBundle>(this, assetBundleName, assetBundle);
this.bundles[assetBundleName] = abInfo;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册