Exemplo n.º 1
0
        private void AddKey(Text text)
        {
            EditorGUILayout.BeginVertical("box");
            if (!string.IsNullOrEmpty(currentKey))
            {
                EditorGUILayout.BeginVertical("box");
                EditorGUILayout.LabelField(currentKey);
                EditorGUILayout.EndVertical();
            }
            if (tree == null)
            {
                tree = Localization.instance.textTree;
            }
            foreach (var child in tree.children)
            {
                if (!string.IsNullOrEmpty(child.Value.text))
                {
                    if (GUILayout.Button(child.Value.text))
                    {
                        m_TextKey.stringValue += "{" + "s:{0}".FormatStr(child.Value.text) + "}";
                        GetText(text, m_Text.stringValue);
                        OnKeyAdded();
                    }
                }
                if (!string.IsNullOrEmpty(child.Value.path))
                {
                    var rect = EditorGUILayout.GetControlRect();
                    rect.width -= 20f;
                    EditorGUI.LabelField(rect, child.Value.path);
                    rect.x    += rect.width;
                    rect.width = 20f;

                    if (GUI.Button(rect, ">"))
                    {
                        currentKey += child.Value.path + "_";
                        tree        = child.Value;
                        break;
                    }
                }
            }
            EditorGUILayout.EndVertical();
        }
Exemplo n.º 2
0
 private void OnKeyAdded()
 {
     currentKey = "";
     tree       = null;
     isAddKey   = false;
 }