Loaded assets can now be copied to a selected folder

This commit is contained in:
katboi01
2025-08-02 07:47:02 +02:00
parent 37cd7d2ee3
commit b3d179c0c7
7 changed files with 218 additions and 83 deletions
+50 -8
View File
@@ -1,7 +1,9 @@
#if !UNITY_ANDROID || UNITY_EDITOR
using SFB;
#endif
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using static PageManager;
@@ -50,17 +52,57 @@ public class UISettingsAssets : MonoBehaviour
}
}
public void CopyAllLoadedAssetsPath()
public void CopyAllLoadedAssets()
{
StringBuilder sb = new StringBuilder();
foreach (var entry in LoadedAssetEntries.Keys)
#if !UNITY_ANDROID || UNITY_EDITOR
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
{
if (UmaViewerMain.Instance.AbList.TryGetValue(entry, out var asset))
foreach (var entry in LoadedAssetEntries.Keys)
{
sb.AppendLine(asset.FilePath);
if (!UmaViewerMain.Instance.AbList.TryGetValue(entry, out var asset)) continue;
var outName = Path.Combine(path[0], asset.Name);
if (File.Exists(asset.FilePath) && !File.Exists(outName))
{
Directory.CreateDirectory(Path.GetDirectoryName(outName));
File.Copy(asset.FilePath, outName);
}
}
UmaViewerUI.Instance.ShowMessage($"{LoadedAssetEntries.Count} files copied", UIMessageType.Success);
}
GUIUtility.systemCopyBuffer = sb.ToString();
UmaViewerUI.Instance.ShowMessage($"{LoadedAssetEntries.Count} Path copied", UIMessageType.Success);
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}
public void CopyCurrentUmaAssets()
{
#if !UNITY_ANDROID || UNITY_EDITOR
if(UmaViewerBuilder.Instance.CurrentUMAContainer == null)
{
UmaViewerUI.Instance.ShowMessage("No Umamusume loaded", UIMessageType.Warning);
return;
}
var assets = UmaViewerBuilder.Instance.CurrentUMAContainer.GetAssetsList();
var path = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Config.Instance.MainPath, false);
if (path != null && path.Length > 0 && !string.IsNullOrEmpty(path[0]))
{
foreach (var asset in assets)
{
var outName = Path.Combine(path[0], asset.Name);
if (File.Exists(asset.FilePath) && !File.Exists(outName))
{
Directory.CreateDirectory(Path.GetDirectoryName(outName));
File.Copy(asset.FilePath, outName);
}
}
UmaViewerUI.Instance.ShowMessage($"{assets.Count} files copied", UIMessageType.Success);
}
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}
}
@@ -110,6 +110,8 @@ public class UISettingsModel : MonoBehaviour
ModelExporter.ExportModel(container, path);
}
}
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}
}
@@ -74,6 +74,8 @@ public class UISettingsOther : MonoBehaviour
Config.Instance.UpdateConfig(true);
}
}
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}
@@ -88,6 +90,8 @@ public class UISettingsOther : MonoBehaviour
UseShellExecute = true
});
}
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}
@@ -91,6 +91,8 @@ public class UISettingsSound : MonoBehaviour
}
}
#else
UmaViewerUI.Instance.ShowMessage("Not supported on this platform", UIMessageType.Warning);
#endif
}