1:ResMgr upper game call
member: getObj(name,objType,callBack<string,bool,obj>) ;//Get gameObject objType=pool subtype desObj(obj) ;//Destroy gameObject 2:PoolMgr manages all object pool members: Dict<string,BasePool> pools; //All pools getObj(name,poolType,callBack); //Get gameObject poolType=pool life cycle type time pool, card pool, global pool desObj(obj); //Recycle gameObject 3 :BasePool manages all gameobject derived modelPool, uipool... member: string name; //pool name GameObjct tempObj; //template obj E_PoolType pType ;//pool life cycle type List<GameObjct> objLst; //cache obj List<callBack > loadHandler; //load callback
List<string> depends; //Dependency
getObj(callBack); //Add a LoaderTask without a template, there is a template cache lst>0 Take lst==0 from the cache lst, instantiate it with the template, and take obj elsewhere in the load, Add handler callback
saveObj(poolObj); //Recycle an obj, if PoolObj is not mounted, it will not enter the pool and directly destroy it at the poolMgr layer
4:LoaderMgr is responsible for detecting the loading queue and loading
member:
Dict<string,LoaderTask> tasks; //Loading Queue
addTask(name,callBack<string,bool,TBundle>); //Adding a loading task will get all dependencies. First add the dependency bundle loading task (recursively put the deepest dependencies in the front of the queue), if there is this task, load LoaderTask. addhandler(callBack)
onTick(); //traverse the loading queue and load the next
5:LoaderTask responsible for real loading
member:
addhandler(callBack<string,bool,TBundle>); //Add a loading callback
IEnumerator load() ;//Coroutine loading If AssetMgr.isHave() has bundle cache direct callback, if not, AssetBundle.LoadFromFileAsync does an asynchronous load, and caches it to AssetMgr after loading
6:AssetMgr manages AB
member:
Dict<string, TBundle> bundlePool; //bundle list
onTick(); //Check whether the last use time of ab expires unload(bool) bool
isHave() ;//Whether it contains
getBundle (); //Get bundle
addBundle(); //Add bundle
releaseRef(); //Decrease refCount
addRef(); //Increase refCount
disposeBundle(); //Release bundle
7:TBundle package once AB
member:
AssetBundle ab;
RefCount count;
onDispose();
Github:https://github.com/tianjiuwan/ECS_XLua