public override void OnBeAdded(IMono mono) { base.OnBeAdded(mono); string fullpath = Const.Path_Settings; TDBSetting settings = default; if (File.Exists(fullpath)) { using (Stream stream = File.OpenRead(fullpath)) { if (stream != null) { try { settings = FileUtil.LoadJson <TDBSetting>(stream); } catch (Exception e) { settings = default; CLog.Error("载入settings出错{0}", e); } } } } if (settings == null) { IsFirstCreateSettings = true; settings = new TDBSetting(); Save(); } SetSettings(settings); }
public IEnumerator Load() { foreach (var item in GetDLCItemConfigs()) { DLCManager.LoadDLC(item); yield return(new WaitForEndOfFrame()); } //初始化的加载所有Bundle if (!DLCConfig.IsEditorMode) { if (DLCConfig.IsInitLoadSharedBundle) { foreach (var bundle in DLCManager.LoadAllSharedBundle()) { while (!bundle.IsDone) { yield return(new WaitForEndOfFrame()); } } } if (DLCConfig.IsInitLoadDirBundle) { foreach (var bundle in DLCManager.LoadAllDirBundle()) { while (!bundle.IsDone) { yield return(new WaitForEndOfFrame()); } } } } if (DLCConfig.IsWarmupAllShaders) { Shader.WarmupAllShaders(); } yield break; // 获得DLC的根目录 List <DLCItemConfig> GetDLCItemConfigs() { if (DLCConfig.IsEditorOrAssetBundleMode) { return(DLCConfig.ConfigAll); } else { List <DLCItemConfig> ret = new List <DLCItemConfig>(); string[] files = Directory.GetFiles(Const.Path_StreamingAssets, Const.STR_DLCItem + ".json", SearchOption.AllDirectories); foreach (var item in files) { ret.Add(FileUtil.LoadJson <DLCItemConfig>(item)); } return(ret); } } }