Files
taptap2024_GJ_chidouren/Assets/Scripts/System/Loader/IC_AddressabelConfig.cs
2024-10-16 00:03:41 +08:00

64 lines
1.6 KiB
C#

using System.Collections.Generic;
using Framework.Asset;
using IcecreamView;
using UnityEngine;
namespace System.Loader
{
public class IC_AddressabelConfig : IC_IViewConfig
{
private Dictionary<string, IC_IViewInfo> mViewDic;
public void OnInit()
{
this.mViewDic = new Dictionary<string, IC_IViewInfo>();
var views = AssetManager.Instance.LoadAssetsForComponent<IC_AbstractView>($"{AssetManager.ResRootPath}View");
if (views == null || views.Count <= 0)
{
return;
}
foreach (var view in views)
{
this.mViewDic[view.name] = new IC_ViewInfo()
{
View = view,
Table = view.name,
isOnce = true
};
// Debug.Log("Load View : " + view.name);
}
}
public string GetDefaultViewTable()
{
return null;
}
public bool ContainsKey(string viewTable)
{
return this.mViewDic.ContainsKey(viewTable);
}
public List<string> GetCacheTables()
{
return new List<string>();
}
public IC_IViewInfo OnAddView(string viewTable)
{
return this.mViewDic[viewTable];
}
public void OnRemoveView(IC_AbstractView view)
{
UnityEngine.Object.Destroy(view.gameObject);
}
public void OnDispose()
{
this.mViewDic.Clear();
GC.Collect();
}
}
}