void OnGUI()
        {
            if (localizedObjectContextMenu == null ||
                localizedObjectAdaptor == null ||
                settingsContextMenu == null ||
                settingsAdaptor == null)
            {
                Initialize();
            }


            if (LocalizationWindowUtility.ShouldShowWindow())
            {
                ReorderableListGUI.Title("Edit Root Values");
                EditorGUILayout.Space();

                settingsContextMenu.Draw(settingsAdaptor);

                bool shouldRepaint = listColumns.DrawColumns();
                scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
                localizedObjectContextMenu.Draw(localizedObjectAdaptor);
                EditorGUILayout.EndScrollView();

                if (guiChanged)
                {
                    GUILayout.Label("- You have unsaved changes", EditorStyles.miniLabel);
                }

                //If any changes to the gui is made
                if (GUI.changed)
                {
                    guiChanged = true;
                }

                GUILayout.Label("Save Changes", EditorStyles.boldLabel);
                GUILayout.Label("Remember to always press save when you have changed values", EditorStyles.miniLabel);
                if (GUILayout.Button("Save Root Language File"))
                {
                    SaveRootLanguageFile();
                    guiChanged = false;
                    GUIUtility.keyboardControl = 0;
                }

                if (shouldRepaint)
                {
                    Repaint();
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws the settings window and the main translation view where all the keys are.
        /// </summary>
        void DrawMainTranslationView()
        {
            ReorderableListGUI.Title("Language - " + thisLanguage);
            EditorGUILayout.Space();

            settingsContextMenu.Draw(settingsAdaptor);

            GUILayout.Label("Language Values", EditorStyles.boldLabel);

            bool shouldRepaintColumns = listColumns.DrawColumns();

            if (shouldRepaintColumns)
            {
                shouldRepaint = true;
            }

            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            localizedObjectContextMenu.Draw(localizedObjectAdaptor);
            EditorGUILayout.EndScrollView();

            if (guiChanged)
            {
                GUILayout.Label("- You have unsaved changes", EditorStyles.miniLabel);
            }

            //If any changes to the gui is made
            if (GUI.changed)
            {
                guiChanged = true;
            }

            GUILayout.Label("Save Changes", EditorStyles.boldLabel);
            GUILayout.Label("Remember to always press save when you have changed values", EditorStyles.miniLabel);
            if (GUILayout.Button("Save/Rebuild"))
            {
                SaveAndRebuild();
            }

            if (shouldRepaint)
            {
                Repaint();
                shouldRepaint = false;
            }
        }
        void ShowCreateAndSettingsActions()
        {
            float maxWidth = position.width * 0.5f;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.BeginVertical();
            Rect positionCheck = EditorGUILayout.GetControlRect(GUILayout.MaxWidth(maxWidth));

            ReorderableListGUI.Title(positionCheck, "Add / Update Languages");
            createScrollPosition = GUILayout.BeginScrollView(createScrollPosition, GUILayout.MaxHeight(350), GUILayout.MaxWidth(maxWidth));
            createListContextMenu.Draw(createListAdaptor);
            GUILayout.EndScrollView();
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();

            EditorGUILayout.BeginVertical();
            positionCheck = EditorGUILayout.GetControlRect(GUILayout.MaxWidth(maxWidth));
            ReorderableListGUI.Title(positionCheck, "Settings");
            settingsContextMenu.Draw(settingsAdaptor);
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndHorizontal();
        }