Пример #1
0
        private void SaveAndRebuild()
        {
            //Copy everything into a dictionary
            Dictionary <string, string> newLanguageValues = new Dictionary <string, string>();

            foreach (var objectPair in loadedLanguageValues)
            {
                if (objectPair.changedValue.ObjectType == LocalizedObjectType.STRING)
                {
                    newLanguageValues.Add(objectPair.changedValue.GetFullKey(objectPair.keyValue), objectPair.changedValue.TextValue);
                }
                else
                {
                    //Delete the file in case there was a file there previously
                    LanguageHandlerEditor.DeleteFileFromResources(objectPair.changedValue.GetFullKey(objectPair.keyValue), currentCultureInfo);

                    //Store the path to the file
                    string pathValue = string.Empty;
                    if (objectPair.changedValue.OverrideLocalizedObject)
                    {
                        pathValue = "override=" + objectPair.changedValue.OverrideObjectLanguageCode;
                    }
                    else
                    {
                        pathValue = LanguageHandlerEditor.CopyFileIntoResources(objectPair, currentCultureInfo);
                    }
                    newLanguageValues.Add(objectPair.changedValue.GetFullKey(objectPair.keyValue), pathValue);
                }
            }
            LanguageHandlerEditor.SaveLanguageFile(newLanguageValues, LocalizationWorkspace.LanguageFilePath(currentCultureInfo.languageCode));
            guiChanged = false;
            GUIUtility.keyboardControl = 0;

            if (Application.isPlaying && LanguageManager.HasInstance)
            {
                LanguageManager.Instance.ChangeLanguage(currentCultureInfo.languageCode);
            }
        }