コード例 #1
0
    /// <summary>
    /// display the list of the current available languages
    /// </summary>
    void displayLanguage()
    {
        EditorGUILayout.BeginVertical("Box", GUILayout.Width(leftSizeWidth));

        EditorGUILayout.LabelField("Languages : ", new GUIStyle(GUI.skin.label)
        {
            fontStyle = FontStyle.Bold, alignment = TextAnchor.MiddleCenter
        });
        EditorGUILayout.Space();

        leftScrollPos = EditorGUILayout.BeginScrollView(leftScrollPos, GUILayout.Width(leftSizeWidth + 130));

        for (int i = 0; i < localizationText.fileAndLang.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(localizationText.fileAndLang[i].language);
            if (GUILayout.Button("Edit"))
            {
                localizationText.loadLocalizedText(localizationText.fileAndLang[i].language);
                localizationTextOrdererByKey = localizationText.getElementsByType();
                displayKeyTypeCategory       = new bool[localizationTextOrdererByKey.Count];
                // display the first elements
                if (displayKeyTypeCategory.Length > 0)
                {
                    displayKeyTypeCategory[0] = true;
                }
            }

            if (GUILayout.Button("Remove"))
            {
                if (EditorUtility.DisplayDialog("Are you sure ?", "Do you want to delete " + localizationText.fileAndLang[i].language + " language ?", "Yes", "No"))
                {
                    localizationText.fileAndLang.RemoveAt(i);
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndVertical();
    }