/// <summary> /// 结束初始化 /// </summary> public void FinishInit() { if (_dataSource == null) { throw new ConfigException("数据源为空,是否没调用Init?"); } _dataSource.Uninit(); _dataSource = null; Logger.LogInfo(LogModule.Data, $"数据库加载耗时{(DateTime.Now - _beginInitTime).TotalMilliseconds:F2}ms"); }
protected override void Init() { _dictConfigData = new Dictionary <Type, object>(); _dictEmptyConfig = new Dictionary <Type, BaseConfig>(); try { // 加载 _beginInitTime = DateTime.Now; #if UNITY_EDITOR _dataSource = new ExcelDataSource(); #else _dataSource = new SqlDataSource(); #endif _dataSource.Init(); } catch (Exception e) { Logger.LogError(LogModule.Data, "加载数据库出错:" + e); } }
protected override void Init() { _dictConfigData = new Dictionary <Type, object>(); _dictEmptyConfig = new Dictionary <Type, BaseConfig>(); try { // 加载 _beginInitTime = DateTime.Now; #if UNITY_EDITOR string path = null; if (ForceUseBinary) { _dataSource = new BinaryDataSource(); if (IsTesting) { path = $"{Application.dataPath}/Framework/Tests/TestData/TestBinData.bin"; } } else { _dataSource = new ExcelDataSource(); if (IsTesting) { path = $"{Application.dataPath}/Framework/Tests/TestData/TestExcelData/"; } } _dataSource.Init(path); #else _dataSource = new BinaryDataSource(); _dataSource.Init(); #endif } catch (Exception e) { Logger.LogError(LogModule.Data, "加载数据库出错:" + e); } }