12345678910111213141516171819202122232425262728293031323334353637 |
- using System;
- using UnityEngine;
- using YooAsset;
- namespace GFGGame
- {
- public class SqliteController : SingletonBase<SqliteController>
- {
- public void Init(bool logable, string resPath)
- {
- string dbPath = null;
- string connectionPath;
- #if UNITY_EDITOR
- dbPath = $"{Environment.CurrentDirectory}/{ResPathUtil.SQLITE_FILE_PATH}";
- #else
- dbPath = GetSqlFilePath(resPath);
- #endif
- #if !UNITY_EDITOR && UNITY_ANDROID
- connectionPath = "uri=file:" + dbPath;
- #else
- connectionPath = "data source=" + dbPath;
- #endif
- SQLiteHelper.Instance.Init(logable, connectionPath);
- }
- private string GetSqlFilePath(string resPath)
- {
- RawFileOperationHandle handle = YooAssets.LoadRawFileSync(resPath);
- return handle.GetRawFilePath();
- }
- }
- }
|