guodong 1 vuosi sitten
vanhempi
commit
e86a53a080

+ 0 - 1
GameClient/Assets/Editor/ToolsMenu.cs

@@ -173,7 +173,6 @@ namespace GFGEditor
             Log.ILog = new UnityLogger();
             ET.Options.Instance = new ET.Options();
             EditorUtility.DisplayProgressBar("进度", "正在导入表格", 1);
-            SqliteController.Instance.dirPath = Path.Combine(Environment.CurrentDirectory, ResPathUtil.CONFIG_DIR_PATH);
             SqliteController.Instance.Init(false, null);
             SQLiteHelper.Instance.OpenConnection();
             //try

+ 11 - 52
GameClient/Assets/Game/HotUpdate/Sqlite/SqliteController.cs

@@ -1,5 +1,5 @@
-using UnityEngine;
-using System.IO;
+using System;
+using UnityEngine;
 using YooAsset;
 
 namespace GFGGame
@@ -7,31 +7,23 @@ namespace GFGGame
     public class SqliteController : SingletonBase<SqliteController>
     {
 
-        /// <summary>
-        /// 数据库文件文件夹路径
-        /// </summary>
-        [HideInInspector]
-        public string dirPath;
-
         public void Init(bool logable, string resPath)
         {
-            string dbPath = null;
 
-            if (string.IsNullOrEmpty(dirPath))
-                dirPath = $"{Application.persistentDataPath}";
-
-            //dbPath = $"{dirPath}/{LauncherConfig.SQL_FILE_NAME}";
+            string dbPath = null;
+            string connectionPath;
+#if UNITY_EDITOR
+            dbPath = $"{Environment.CurrentDirectory}/{ResPathUtil.SQLITE_FILE_PATH}";
 
+#else
             dbPath = GetSqlFilePath(resPath);
-            var connectionPath = "data source=" + dbPath;
+#endif
+
 #if !UNITY_EDITOR && UNITY_ANDROID
             connectionPath =  "uri=file:" + dbPath;
+#else
+            connectionPath = "data source=" + dbPath;
 #endif
-            //Debug.Log($"connectionPath {connectionPath}");
-            //if(resPath != null)
-            //{
-                //CheckSqlFile(dbPath, resPath);
-            //}
             SQLiteHelper.Instance.Init(logable, connectionPath);
         }
 
@@ -41,38 +33,5 @@ namespace GFGGame
             return handle.GetRawFilePath();
         }
 
-        /// <summary>
-        /// 检查数据库文件是否存在并且是最新版
-        /// </summary>
-//        private void CheckSqlFile(string dbPath, string resPath)
-//        {
-//#if UNITY_EDITOR
-//            if(GameLauncher.Instance.PlayMode != YooAsset.EPlayMode.OfflinePlayMode)
-//            {
-//#endif
-//                bool needWrite = true;
-//                var crcKey = "crc" + resPath;
-//                string crc = "";
-//                VEngine.ManifestBundle version;
-//                if (File.Exists(dbPath))
-//                {
-//                    version = VEngine.Versions.GetBundle(resPath);
-//                    crc = PlayerPrefs.GetString(crcKey, "");
-//                    needWrite = crc != version.crc.ToString();
-//                }
-//                if(needWrite)
-//                {
-//                    var asset = GFGAsset.Load<TextAsset>(resPath);
-//                    byte[] bytes = asset.bytes;
-//                    File.WriteAllBytes(dbPath, bytes);
-//                    GFGAsset.Release(resPath);
-//                    version = VEngine.Versions.GetBundle(resPath);
-//                    PlayerPrefs.SetString(crcKey, version.crc.ToString());
-//                }
-
-//#if UNITY_EDITOR
-//            }
-//#endif
-//        }
     }
 }