Beispiel #1
0
            public static void SaveStrings()
            {
                foreach (KeyValuePair <string, LocalisationMap> languagePair in _localisationMaps)
                {
                    SystemLanguage languageCode = LanguageCodes.GetLanguageFromCode(languagePair.Key);

                    if (languageCode != SystemLanguage.Unknown)
                    {
                        string resourceName = GetLocalisationMapName(languageCode);
                        string assetsPath   = LocalisationProjectSettings.Get()._localisationFolder;
                        string resourcePath = AssetUtils.GetResourcePath(assetsPath) + "/" + resourceName;
                        string filePath     = AssetUtils.GetAppllicationPath();

                        TextAsset asset = Resources.Load(resourcePath) as TextAsset;
                        if (asset != null)
                        {
                            filePath += AssetDatabase.GetAssetPath(asset);
                        }
                        else
                        {
                            filePath += assetsPath + "/" + resourceName + ".xml";
                        }

                        languagePair.Value._language = LanguageCodes.GetLanguageFromCode(languagePair.Key);
                        languagePair.Value.SortStrings();

                        Serializer.ToFile(languagePair.Value, filePath);
                    }
                }

                _dirty = false;
            }
                private void OnGUI()
                {
                    GUILayout.BeginVertical();
                    {
                        _bundleOptions = (BuildAssetBundleOptions)EditorGUILayout.EnumPopup("Bundle Options", _bundleOptions);
                        _buildTarget   = (BuildTarget)EditorGUILayout.EnumPopup("Build Target", _buildTarget);

                        if (GUILayout.Button("Build Asset Bundles"))
                        {
                            _exportFolder = AssetUtils.GetAppllicationPath(EditorUtility.SaveFolderPanel("Asset Bundle Folder", _exportFolder, ""));

                            if (!string.IsNullOrEmpty(_exportFolder))
                            {
                                BuildPipeline.BuildAssetBundles(_exportFolder, _bundleOptions, _buildTarget);
                            }
                        }
                    }
                    GUILayout.EndVertical();
                }