예제 #1
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;
            }
        }
 void Save()
 {
     LEStringTableEditor.Save();
 }
        public static void ProcessScene()
        {
            try
            {
                // Force autoindex to start at 1
                if (LESettings.Instance.AutoIndex < 1)
                {
                    LESettings.Instance.AutoIndex = 1;
                }

                int totalConfigured = 0;
                int totalComponents = 0;

                        #if !UNITY_4_3 && !UNITY_4_5
                // Text components
                Text[] textComponents = GameObject.FindObjectsOfType <Text>();
                totalComponents += textComponents.Length;
                for (int i = 0; i < textComponents.Length; i++)
                {
                    if (ProcessGameObject(textComponents[i].gameObject, textComponents[i].text))
                    {
                        totalConfigured++;
                    }
                }
                #endif

                // GUIText components
                GUIText[] guiTextComponents = GameObject.FindObjectsOfType <GUIText>();
                totalComponents += guiTextComponents.Length;
                for (int i = 0; i < guiTextComponents.Length; i++)
                {
                    if (ProcessGameObject(guiTextComponents[i].gameObject, guiTextComponents[i].text))
                    {
                        totalConfigured++;
                    }
                }

                // TextMesh components
                TextMesh[] textMeshComponents = GameObject.FindObjectsOfType <TextMesh>();
                totalComponents += textMeshComponents.Length;
                for (int i = 0; i < textMeshComponents.Length; i++)
                {
                    if (ProcessGameObject(textMeshComponents[i].gameObject, textMeshComponents[i].text))
                    {
                        totalConfigured++;
                    }
                }

                // At the end of the process, save LE Editor
                LEStringTableEditor.Save();
                LESettings.Instance.Save();

                EditorUtility.DisplayDialog(LEConstants.ProcessSceneMsgTitle,
                                            string.Format(LEConstants.ProcessSceneCompleteMsg, totalComponents, totalConfigured, totalComponents - totalConfigured),
                                            LEConstants.OkLbl);
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }