示例#1
0
        GameObject GetRoot(Constants.ModuleName moduleName)
        {
            GameObject module;

            _modules.TryGetValue(moduleName, out module);
            return(module);
        }
示例#2
0
        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))));
            }
        }
示例#3
0
        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);
                }
            }
        }