public static void CreateGUIStampListAsset() { GUIStampList list = ScriptableObjectUtil.CreateAsset <GUIStampList>(); list.stampList = new List <GUIStamp>(); string stampFolder = "Assets/Assets/Textures/stamps/Resources"; string[] filePaths = Directory.GetFiles(stampFolder); for (int i = 0; i < filePaths.Length; i++) { string filePath = filePaths[i]; if (!filePath.EndsWith(".meta")) { string fileName = Path.GetFileName(filePath); if (!fileName.StartsWith("stamp")) { continue; } GUIStamp stampObj = new GUIStamp(); stampObj.stampPath = fileName.Replace(".psd", ""); stampObj.iconPath = stampObj.stampPath + ".icon"; list.stampList.Add(stampObj); } } EditorUtility.SetDirty(list); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (GUILayout.Button("set paths")) { GUIStampList sl = (GUIStampList)target; foreach (GUIStamp stamp in sl.stampList) { stamp.iconPath = stamp.iconTexture.name; stamp.stampPath = stamp.stampTexture.name; } } }
void preprocess(IosBuildConfig config) { oldLanguage = PropertiesSingleton.instance.language; PropertiesSingleton.instance.language = config.language; oldStampList = PropertiesSingleton.instance.guiStampList; PropertiesSingleton.instance.guiStampList = config.stampList; oldAlbums = PropertiesSingleton.instance.albums; PropertiesSingleton.instance.albums = config.albums; oldBundleId = PlayerSettings.bundleIdentifier; PlayerSettings.bundleIdentifier = config.bundleId; tempDir = Directory.GetParent(Application.dataPath) + "/temp" + EditorApplication.timeSinceStartup.GetHashCode(); Directory.CreateDirectory(tempDir); movedDirResources = new List <MovedResource>(); movedFileResources = new List <MovedResource>(); List <string> pictureNames = new List <string>(); foreach (Album album in config.albums.album) { if (album.sheetList != null) { foreach (SheetObject sheet in album.sheetList.sheetList) { pictureNames.Add(sheet.persistentBorderLayerPath); } } } foreach (string resourceDir in Directory.GetDirectories(Application.dataPath + "/" + PICTURE_RESOURCE_DIR, "Resources", SearchOption.AllDirectories)) { string[] filePaths = Directory.GetFiles(resourceDir, "*.border.*"); if (filePaths.Length > 0) { string borderName = Path.GetFileNameWithoutExtension(filePaths[0]); if (!pictureNames.Contains(borderName)) { movedDirResources.Add(new MovedResource(resourceDir, tempDir + "/" + resourceDir.GetHashCode())); movedFileResources.Add(new MovedResource(resourceDir + ".meta", tempDir + "/" + resourceDir.GetHashCode() + "meta")); } } } List <string> stamps = new List <string>(); foreach (GUIStamp stamp in config.stampList.stampList) { stamps.Add(stamp.stampPath); } foreach (string filePath in Directory.GetFiles(Application.dataPath + "/" + STAMP_RESOURCE_DIR, "*.icon")) { if (filePath.EndsWith("meta")) { continue; } string fileName = Path.GetFileNameWithoutExtension(filePath); fileName = fileName.Replace(".icon", ""); if (!stamps.Contains(fileName)) { movedFileResources.Add(new MovedResource(filePath, tempDir + "/" + filePath.GetHashCode() + ".icon")); movedFileResources.Add(new MovedResource(filePath + ".meta", tempDir + "/" + filePath.GetHashCode() + ".icon.meta")); } } foreach (string filePath in Directory.GetFiles(Application.dataPath + "/" + STAMP_RESOURCE_DIR + "/Resources")) { if (filePath.EndsWith("meta")) { continue; } string fileName = Path.GetFileNameWithoutExtension(filePath); if (!stamps.Contains(fileName)) { movedFileResources.Add(new MovedResource(filePath, tempDir + "/" + filePath.GetHashCode())); movedFileResources.Add(new MovedResource(filePath + ".meta", tempDir + "/" + filePath.GetHashCode() + ".meta")); } } foreach (MovedResource mr in movedDirResources) { Directory.Move(mr.from, mr.to); } foreach (MovedResource mr in movedFileResources) { File.Move(mr.from, mr.to); } AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); PropertiesSingleton.instance.language = config.language; }
void preprocess(IosBuildConfig config) { oldLanguage = PropertiesSingleton.instance.language; PropertiesSingleton.instance.language = config.language; oldStampList = PropertiesSingleton.instance.guiStampList; PropertiesSingleton.instance.guiStampList = config.stampList; oldAlbums = PropertiesSingleton.instance.albums; PropertiesSingleton.instance.albums = config.albums; oldBundleId = PlayerSettings.bundleIdentifier; PlayerSettings.bundleIdentifier = config.bundleId; tempDir = Directory.GetParent( Application.dataPath)+"/temp"+EditorApplication.timeSinceStartup.GetHashCode(); Directory.CreateDirectory(tempDir); movedDirResources = new List<MovedResource>(); movedFileResources = new List<MovedResource>(); List<string> pictureNames = new List<string>(); foreach(Album album in config.albums.album){ if (album.sheetList!=null) foreach(SheetObject sheet in album.sheetList.sheetList) pictureNames.Add(sheet.persistentBorderLayerPath); } foreach(string resourceDir in Directory.GetDirectories(Application.dataPath+"/"+ PICTURE_RESOURCE_DIR,"Resources", SearchOption.AllDirectories)){ string[] filePaths = Directory.GetFiles(resourceDir,"*.border.*"); if (filePaths.Length > 0){ string borderName = Path.GetFileNameWithoutExtension(filePaths[0]); if (!pictureNames.Contains(borderName)){ movedDirResources.Add(new MovedResource( resourceDir , tempDir + "/" + resourceDir.GetHashCode())); movedFileResources.Add(new MovedResource( resourceDir+".meta", tempDir + "/" + resourceDir.GetHashCode()+"meta")); } } } List<string> stamps = new List<string>(); foreach (GUIStamp stamp in config.stampList.stampList) stamps.Add(stamp.stampPath); foreach(string filePath in Directory.GetFiles(Application.dataPath + "/" + STAMP_RESOURCE_DIR, "*.icon")){ if (filePath.EndsWith("meta")) continue; string fileName =Path.GetFileNameWithoutExtension(filePath); fileName = fileName.Replace(".icon",""); if (!stamps.Contains(fileName)){ movedFileResources.Add(new MovedResource(filePath , tempDir + "/" + filePath.GetHashCode()+ ".icon")); movedFileResources.Add(new MovedResource(filePath+".meta", tempDir + "/" + filePath.GetHashCode()+ ".icon.meta")); } } foreach(string filePath in Directory.GetFiles(Application.dataPath + "/" + STAMP_RESOURCE_DIR+"/Resources")){ if (filePath.EndsWith("meta")) continue; string fileName =Path.GetFileNameWithoutExtension(filePath); if (!stamps.Contains(fileName)){ movedFileResources.Add(new MovedResource(filePath , tempDir + "/" + filePath.GetHashCode())); movedFileResources.Add(new MovedResource(filePath+".meta", tempDir + "/" + filePath.GetHashCode()+".meta")); } } foreach(MovedResource mr in movedDirResources){ Directory.Move(mr.from, mr.to); } foreach(MovedResource mr in movedFileResources) File.Move(mr.from, mr.to); AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate); PropertiesSingleton.instance.language = config.language; }