Exemplo n.º 1
0
        void OnGUI()
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label("创建的位置");
            myCreateFolder = GUILayout.TextField(myCreateFolder);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("脚本的命名空间");
            myNameSpace = GUILayout.TextField(myNameSpace);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("db的位置");
            myDbPath = GUILayout.TextField(myDbPath);
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            GUILayout.Label("不用创建结构体的表数量");
            string tempStr = GUILayout.TextField(mLength.ToString());

            int.TryParse(tempStr, out mLength);
            GUILayout.EndHorizontal();

            if (mLength > 0)
            {
                if (mNotCreateTable == null || mNotCreateTable.Count != mLength)
                {
                    mNotCreateTable = new List <string>();
                    for (int i = 0; i < mLength; i++)
                    {
                        mNotCreateTable.Add("");
                    }
                }
                for (int i = 0; i < mLength; i++)
                {
                    GUILayout.BeginHorizontal();
                    GUILayout.Label(string.Format("第{0}个", i + 1));
                    mNotCreateTable[i] = GUILayout.TextField(mNotCreateTable[i]);
                    GUILayout.EndHorizontal();
                }
            }

            if (GUILayout.Button("根据表结构创建结构体") == true)
            {
                SqliteSyntax.CreateStructBySql(myCreateFolder, myNameSpace, myDbPath, mNotCreateTable);
                AssetDatabase.Refresh();
            }
        }
 public static void CreateStructBySql()
 {
     SqliteSyntax.CreateStructBySql(CreateFolder, NameSpace, DbPath);
 }