Example #1
0
        public static void DisableLibstAtPath(string path)
        {
            List <string> files = SA_AssetDatabase.FindAssetsWithExtentions(path);

            for (int i = 0; i < files.Count; i++)
            {
                var filePath = files[i];

                //Make sure this is not a folder
                if (SA_AssetDatabase.IsValidFolder(filePath))
                {
                    continue;
                }

                //Already disabled
                if (SA_AssetDatabase.GetExtension(filePath).Equals(DISABLED_LIB_EXTENSION))
                {
                    continue;
                }

                string newFilePath;
                newFilePath = filePath + DISABLED_LIB_EXTENSION;


                float  progress = (float)(i + 1) / (float)files.Count;
                string fileName = SA_AssetDatabase.GetFileName(newFilePath);
                EditorUtility.DisplayProgressBar("Stan's Assets.", "Packing: " + fileName, progress);
                SA_AssetDatabase.MoveAsset(filePath, newFilePath);
                SA_AssetDatabase.ImportAsset(newFilePath);
            }

            EditorUtility.ClearProgressBar();
        }
Example #2
0
        public static void EnableLibsAtPath(string path)
        {
            List <string> files = SA_AssetDatabase.FindAssetsWithExtentions(path);

            for (int i = 0; i < files.Count; i++)
            {
                var file = files[i];
                //Make sure this is not a folder
                if (SA_AssetDatabase.IsValidFolder(file))
                {
                    continue;
                }


                if (SA_AssetDatabase.GetExtension(file).Equals(DISABLED_LIB_EXTENSION))
                {
                    string newFileName = file.Replace(DISABLED_LIB_EXTENSION, string.Empty);

                    string fileName = SA_AssetDatabase.GetFileName(newFileName);

                    float progress = (float)(i + 1) / (float)files.Count;
                    EditorUtility.DisplayProgressBar("Stan's Assets.", "Installing: " + fileName, progress);


                    SA_AssetDatabase.MoveAsset(file, newFileName);
                    SA_AssetDatabase.ImportAsset(newFileName);
                }
            }

            EditorUtility.ClearProgressBar();
        }
Example #3
0
        private static void ResolveXMLConfig(List <string> dependencies)
        {
            //Clean up file if we have no Dependencies
            if (dependencies.Count == 0)
            {
                if (SA_AssetDatabase.IsDirectoryExists(AN_Settings.DEPENDENCIES_FOLDER))
                {
                    SA_AssetDatabase.DeleteAsset(AN_Settings.DEPENDENCIES_FOLDER);
                }
                s_activeDependencies = new List <string>();
                return;
            }

            if (IsEqualsToActiveDependencies(dependencies))
            {
                return;
            }

            if (!SA_AssetDatabase.IsValidFolder(AN_Settings.DEPENDENCIES_FOLDER))
            {
                SA_AssetDatabase.CreateFolder(AN_Settings.DEPENDENCIES_FOLDER);
            }


            var doc = new XmlDocument();
            var dependenciesElement    = doc.CreateElement("dependencies");
            var androidPackagesElement = doc.CreateElement("androidPackages");


            foreach (var dependency in dependencies)
            {
                var androidPackage = doc.CreateElement("androidPackage");

                var spec = doc.CreateAttribute("spec");
                spec.Value = dependency;
                androidPackage.Attributes.Append(spec);

                androidPackagesElement.AppendChild(androidPackage);
            }

            dependenciesElement.AppendChild(androidPackagesElement);
            doc.AppendChild(dependenciesElement);
            doc.Save(SA_PathUtil.ConvertRelativeToAbsolutePath(AN_Settings.DEPENDENCIES_FILE_PATH));
            SA_AssetDatabase.ImportAsset(AN_Settings.DEPENDENCIES_FILE_PATH);
            s_activeDependencies = ReadDependencies();
        }
 public static void OverrideGamesIds(string data)
 {
     SA_FilesUtil.Write(AN_Settings.ANDROID_GAMES_IDS_FILE_PATH, data);
     SA_AssetDatabase.ImportAsset(AN_Settings.ANDROID_GAMES_IDS_FILE_PATH);
 }