GameObject GetRoot(Constants.ModuleName moduleName) { GameObject module; _modules.TryGetValue(moduleName, out module); return(module); }
IEnumerator Load(Constants.ModuleName moduleName) { var module = GetRoot(moduleName); if (module == null) { var fullpath = string.Format("Modules/{0}", moduleName); yield return(StartCoroutine(ResourceLoader.Instance.Load <GameObject>(fullpath, o => OnPostLoadProcess(o)))); } }
public void Unload(Constants.ModuleName moduleName) { var module = GetRoot(moduleName); if (module != null) { module.GetComponent <IModule>().Unload(); _modules.Remove(moduleName); var fullpath = string.Format("Modules/{0}", module.name); if (ResourceLoader.isAlive) { ResourceLoader.Instance.Unload(fullpath); } } }