Esempio n. 1
0
        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            if (mInited)
            {
                return;
            }

            mInited = true;

            var sqlite_table = Resources.Load("sqlite_table") as TextAsset;

            if (sqlite_table != null)
            {
                var table = new csv.Table();
                table.InitFromString(sqlite_table.text);
                for (int i = 0; i < table.Count; ++i)
                {
                    var info = new SqliteTableInfo();
                    info.table_file      = table.Select(i, "table_file");
                    info.sqlite_file     = table.Select(i, "sqlite_file", "data");
                    info.use_password    = table.Select(i, "use_password", "1") == "1";
                    info.bundle_path     = table.Select(i, "bundle_path", "");
                    info.bundle_res_name = table.Select(i, "bundle_res_name", "1");
                    mSqliteTableInfos[info.table_file] = info;
                }

                table.Clear();

                Resources.UnloadAsset(sqlite_table);
            }
            else
            {
                GameDebug.LogError("DBTableManager init failed");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取指定表格对应的Sqlite数据库文件的名字
        /// </summary>
        /// <param name="table_name"></param>
        /// <returns></returns>
        public string GetSqliteFileName(string table_name)
        {
            SqliteTableInfo info = null;

            if (mSqliteTableInfos.TryGetValue(table_name, out info))
            {
                return(info.sqlite_file);
            }
            else
            {
                return("data");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 指定的表格是否使用了密码
        /// </summary>
        /// <param name="table_name"></param>
        /// <returns></returns>
        public bool IsUsePassword(string table_name)
        {
            SqliteTableInfo info = null;

            if (mSqliteTableInfos.TryGetValue(table_name, out info))
            {
                return(info.use_password);
            }
            else
            {
                return(true);
            }
        }
Esempio n. 4
0
        /// <summary>
        /// 获取表格对应的assetbundle资源
        /// </summary>
        /// <param name="table_name"></param>
        /// <returns></returns>
        public string GetBundleResName(string table_name)
        {
            SqliteTableInfo info = null;

            if (mSqliteTableInfos.TryGetValue(table_name, out info))
            {
                return(info.bundle_res_name);
            }
            else
            {
                return("");
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 获取表格对应的assetbundle资源
        /// </summary>
        /// <param name="table_name"></param>
        /// <returns></returns>
        public AssetBundle GetSqliteBundle(string table_name)
        {
            SqliteTableInfo info = null;

            if (mSqliteTableInfos.TryGetValue(table_name, out info))
            {
                if (string.IsNullOrEmpty(info.bundle_path))
                {
                    return(DBManager.Instance.DBBundle);
                }
                else
                {
                    return(info.bundle);
                }
            }
            else
            {
                return(DBManager.Instance.DBBundle);
            }
        }