private bool DrawTableStructure()
        {
            bool changed = false;

            if (NGUIEditorTools.DrawHeader("Table Structure"))
            {
                NGUIEditorTools.BeginContents();
                EditorGUILayout.HelpBox("Modifying structure values may occur unintented result", MessageType.Warning);
                changed = EditorGUILayoutUtil.PopupEnum <UITableLayout.Arrangement>("Orientation", ref grid.arrangement, GUILayout.ExpandWidth(false));
                string rowCol = grid.isHorizontal? "Column Size": "Row Size";
                if (EditorGUILayoutUtil.IntField(rowCol, ref grid.maxPerLine, GUILayout.ExpandWidth(false)))
                {
                    if (grid.maxPerLine <= 0)
                    {
                        grid.maxPerLine = 1;
                    }
                    changed = true;
                }
                changed |= EditorGUILayoutUtil.IntField("Row Header", ref grid.rowHeader, GUILayout.ExpandWidth(false));
                changed |= EditorGUILayoutUtil.IntField("Column Header", ref grid.columnHeader, GUILayout.ExpandWidth(false));
                changed |= EditorGUILayoutUtil.Toggle("Reuse Cell", ref grid.reuseCell, GUILayout.ExpandWidth(false));
                NGUIEditorTools.EndContents();
            }
            if (changed)
            {
                grid.InitArray();
            }
            return(changed);
        }
        private bool DrawSize()
        {
            bool changed = false;

            if (NGUIEditorTools.DrawHeader("Size"))
            {
                NGUIEditorTools.BeginContents();
                if (EditorGUILayoutUtil.PopupEnum <UITableLayout.HAlign>("Horizontal Align", ref grid.halign, GUILayout.ExpandWidth(false)))
                {
                    for (int i = 0; i < grid.haligns.Length; ++i)
                    {
                        grid.haligns[i] = grid.halign;
                    }
                    changed = true;
                }
                if (EditorGUILayoutUtil.PopupEnum <UITableLayout.VAlign>("Vertical Align", ref grid.valign, GUILayout.ExpandWidth(false)))
                {
                    for (int i = 0; i < grid.valigns.Length; ++i)
                    {
                        grid.valigns[i] = grid.valign;
                    }
                    changed = true;
                }
                changed |= EditorGUILayoutUtil.Vector2Field("Padding", ref grid.padding);
                if (grid.cellMinSize.x == 0 && grid.cellMinSize.y == 0)
                {
                    changed |= EditorGUILayoutUtil.Vector2Field("Cell Size", ref grid.cellSize);
                }
                if (grid.cellSize.x == 0 && grid.cellSize.y == 0)
                {
                    changed |= EditorGUILayoutUtil.Vector2Field("Cell Min Size", ref grid.cellMinSize);
                }
                changed |= EditorGUILayoutUtil.IntField("Total Width", ref grid.totalWidth);
                changed |= EditorGUILayoutUtil.Toggle("Resize Collider", ref grid.resizeCollider, GUILayout.ExpandWidth(false));
                if (grid.resizeCollider && grid.padding != Vector2.zero)
                {
                    EditorGUI.indentLevel += 1;
                    changed |= EditorGUILayoutUtil.Toggle("Expand Collider To Padding", ref grid.expandColliderToPadding, GUILayout.ExpandWidth(false));
                    EditorGUI.indentLevel -= 1;
                }
                NGUIEditorTools.EndContents();
            }
            return(changed);
        }
Пример #3
0
 public override void OnHeaderGUI()
 {
     EditorGUILayoutUtil.ObjectField <LexiconRegistry>("Lexicon Registry", ref lexReg, false);
     if (lexReg == null)
     {
         return;
     }
     EditorGUILayoutUtil.PopupEnum <SystemLanguage>("Mother language", ref motherLang);
     EditorGUILayoutUtil.PopupEnum <SystemLanguage>("Language", ref lang);
     fold = EditorGUILayout.Foldout(fold, "Translate All");
     if (fold)
     {
         if (GUILayout.Button("Convert all Scene and prefab") && EditorUtility.DisplayDialog("Confirm", "Convert All?", "OK", "Cancel"))
         {
             Lexicon.SetMotherLanguage(motherLang);
             Lexicon.SetLanguage(lang);
             TranslateLanguage();
         }
     }
     EditorGUILayoutUtil.Toggle("Lock", ref locked);
     if (EditorGUILayoutUtil.Toggle("Visible Only", ref visibleOnly))
     {
         roots = null;
     }
     EditorGUILayout.BeginHorizontal();
     if (GUILayout.Button("Reload Table", GUILayout.Height(30)))
     {
         ReloadTable();
         ApplyTableToText();
     }
     if (GUILayout.Button("Apply table to text", GUILayout.Height(30)))
     {
         ApplyTableToText();
     }
     if (GUILayout.Button("Revert", GUILayout.Height(30)))
     {
         Clear();
     }
     EditorGUILayout.EndHorizontal();
     DrawFindLexiconGUI();
 }