예제 #1
0
        void DrawOptions()
        {
            // Only allow adding of keys if there is at least
            // one language present
            if (LEStringTableEditor.AllLangsVisual.Count > 0)
            {
                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button(LEConstants.AddNewKeyLbl))
                {
                    newKey    = string.Empty;
                    nextState = LELocalizeState.AddingNewKey;
                }

                if (GUILayout.Button(LEConstants.ExistingKeyLbl))
                {
                    nextState = LELocalizeState.Initialized;
                }
                EditorGUILayout.EndHorizontal();
            }
            else
            {
                EditorGUILayout.HelpBox(LEConstants.AddLanguageWarning, MessageType.Warning);
                if (GUILayout.Button(LEConstants.LaunchLEBtn))
                {
                    LEMenu.ShowLEManagerWindow();
                }
            }
        }
예제 #2
0
        void DrawAddNewKey(LELocalize leLocalize)
        {
            newKey = EditorGUILayout.TextField(LEConstants.KeyLbl, newKey);
            if (!string.IsNullOrEmpty(newKey) && GUILayout.Button(LEConstants.AddStringBtn))
            {
                LEStringTableEditor.AddNewString(newKey, leLocalize.Text);
                LEStringTableEditor.Save();

                leLocalize.localized_string_key = newKey;
                nextState = LELocalizeState.Initialized;
            }
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            LELocalize leLocalize = target as LELocalize;

            nextState = leLocalize.State;

            if (leLocalize.State.Equals(LELocalizeState.Initialized))
            {
                DrawComponent(leLocalize);
            }
            else if (leLocalize.State.Equals(LELocalizeState.AddingNewKey))
            {
                DrawAddNewKey(leLocalize);
            }
            else
            {
                DrawOptions();
            }

            leLocalize.State = nextState;
        }