Beispiel #1
0
        private void LoadDocCommands()
        {
#if UNITY_EDITOR
            TextAsset textObj = EditorResourceLoader.LoadAssetAtPath("Assets/Res/DB/debug_command.csv", typeof(TextAsset)) as TextAsset;

            if (textObj != null)
            {
                string strData = xc.CommonTool.BytesToUtf8(textObj.bytes);

                if (!string.IsNullOrEmpty(strData))
                {
                    csv.Table table = new csv.Table();
                    table.InitFromString(strData);

                    for (int i = 0; i < table.Count; i++)
                    {
                        List <CommandInfo> list = DebugCommandConfig.COMMAND_LIST;

                        string id      = table.Select(i, "id");
                        string name    = table.Select(i, "name");
                        string command = table.Select(i, "doc_command");

                        string doc_name = "doc_" + id;
                        var    info     = new CommandInfo(doc_name, name, DebugCommandConfig.OnDefaultCommandProcessor, null, true, command);

                        list.Add(info);
                    }
                }
            }
#endif
        }
Beispiel #2
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");
            }
        }