Esempio n. 1
0
 private void DrawCurrentTree(Rect rect)
 {
     if (Cache.FolderTree == null)
     {
         EditorGUILayout.LabelField("You need to select or create a folder tree first!");
         return;
     }
     _treeView.OnGUI(rect);
     BottomToolBar(BottomToolbarRect());
 }
    void EditorLanguageModuleFileGUI()
    {
        GUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("▲多语言模块列表(双击选择文件)");
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("新增模块", GUILayout.Width(70)))
        {
            AddLanguageModelGUI();
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(9);
        GUIStyle style = "box";

        if (!string.IsNullOrEmpty(selectItemFullName))
        {
            style = "U2D.createRect";
        }
        GUILayout.BeginHorizontal(style);
        GUILayout.Label("选择的文件:" + selectItemFullName);
        if (!string.IsNullOrEmpty(selectItemFullName))
        {
            if (GUILayout.Button("删除", GUILayout.Width(40)))
            {
                if (EditorUtility.DisplayDialog("提示", "确定删除 :" + selectItemFullName, "OK", "Cancel"))
                {
                    if (selectItemFullName == selectFullFileName)
                    {
                        selectFullFileName = "";
                    }
                    s_languageFullKeyFileNameList.Remove(selectItemFullName);


                    foreach (var lan in config.gameExistLanguages)
                    {
                        string path = LanguageDataUtils.GetLanguageSavePath(lan, selectItemFullName);
                        FileUtils.DeleteFile(path);
                    }
                    // SaveData();
                    AssetDatabase.Refresh();
                    selectItemFullName = "";
                    OnEnable();
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(8);
        Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);

        treeView.OnGUI(rect);
    }
    void EditorLanguageModuleFileGUI()
    {
        if (string.IsNullOrEmpty(m_currentLanguage))
        {
            return;
        }

        GUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("▲多语言模块列表(双击选择文件)");
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("新增模块", GUILayout.Width(70)))
        {
            AddLanguageModelGUI();
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(9);
        GUIStyle style = "box";

        if (!string.IsNullOrEmpty(selectItemFullName))
        {
            style = "U2D.createRect";
        }
        GUILayout.BeginHorizontal(style);
        GUILayout.Label("选择的文件:" + selectItemFullName);
        if (!string.IsNullOrEmpty(selectItemFullName))
        {
            if (GUILayout.Button("删除", GUILayout.Width(40)))
            {
                if (EditorUtility.DisplayDialog("提示", "确定删除 :" + selectItemFullName, "OK", "Cancel"))
                {
                    if (selectItemFullName == selectEditorModuleName)
                    {
                        selectEditorModuleName = "";
                    }
                    s_languageKeyDict.Remove(selectItemFullName);

                    foreach (var lan in s_languageList)
                    {
                        string moduleName = LanguageManager.GetLanguageDataName(lan, selectItemFullName) + ".txt";
                        FileUtils.DeleteFile(Application.dataPath + "/Resources/" + DataManager.c_directoryName + "/" + c_DataPath + "/" + lan + "/" + moduleName);
                    }
                    SaveData();
                    AssetDatabase.Refresh();
                    selectItemFullName = "";
                    OnEnable();
                }
            }
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(8);
        Rect rect = GUILayoutUtility.GetRect(0, 100000, 0, 100000);

        treeView.OnGUI(rect);
        //pos_editorField = EditorGUILayout.BeginScrollView(pos_editorField,"box", GUILayout.ExpandHeight(false));


        //int index = 0;
        //foreach (var item in s_languageKeyDict)
        //{
        //    EditorGUI.indentLevel = 2;

        //    GUIStyle style = "box";
        //    if (item.Key == selectEditorModuleName)
        //    {
        //        //GUI.color = Color.red;
        //        style = "U2D.createRect";
        //    }

        //    EditorGUILayout.BeginHorizontal(style);
        //    if (item.Key != selectEditorModuleName && GUILayout.Button("o",GUILayout.Width(20)))
        //    {
        //        selectEditorModuleName = item.Key;
        //        toolbarOption = 1;
        //    }
        //    GUILayout.Label(index+". " + item.Key);
        //    GUILayout.FlexibleSpace();

        //    GUILayout.Space(6);


        //    if (GUILayout.Button("删除",GUILayout.Width(40)))
        //    {

        //        if (EditorUtility.DisplayDialog("提示", "确定删除 :"+ item.Key, "OK", "Cancel"))
        //        {
        //            if (item.Key == selectEditorModuleName)
        //                selectEditorModuleName = "";
        //            s_languageKeyDict.Remove(item.Key);

        //            foreach (var lan in s_languageList)
        //            {
        //              string moduleName=  LanguageManager.GetLanguageDataName(lan, item.Key) + ".txt";
        //                FileUtils.DeleteFile(Application.dataPath + "/Resources/" + DataManager.c_directoryName + "/" + c_DataPath + "/" + lan + "/" + moduleName);
        //            }
        //            SaveData();
        //            AssetDatabase.Refresh();
        //            break;
        //        }

        //    }

        //    EditorGUILayout.EndHorizontal();

        //    GUI.color = Color.white;

        //    EditorGUILayout.Space();

        //    EditorGUI.indentLevel = 1;

        //    index++;
        //}

        //EditorGUILayout.EndScrollView();
    }