This commit is contained in:
1605296300@qq.com
2022-09-09 11:31:07 +08:00
parent 280069987c
commit 9ed9a5feb0
2 changed files with 26 additions and 3 deletions
@@ -51,4 +51,7 @@ public enum UmaFileType
storyevent, storyevent,
supportcard, supportcard,
uianimation, uianimation,
transferevent,
teambuilding,
challengematch
} }
+23 -3
View File
@@ -380,6 +380,21 @@ public class UmaViewerBuilder : MonoBehaviour
AddAudioSource(BGclip[0]); AddAudioSource(BGclip[0]);
} }
} }
string lyricsVar = $"live/musicscores/m{songid}/m{songid}_lyrics";
UmaDatabaseEntry lyricsAsset = Main.AbList.FirstOrDefault(a => a.Name.Contains(nameVar));
if(lyricsAsset != null)
{
string filePath = GetABPath(lyricsAsset);
if (File.Exists(filePath))
{
AssetBundle bundle = AssetBundle.LoadFromFile(filePath);
Main.LoadedBundles.Add(lyricsAsset.Name, bundle);
UI.LoadedAssetsAdd(lyricsAsset);
TextAsset asset = bundle.LoadAsset<TextAsset>(Path.GetFileName(lyricsVar));
Debug.Log(asset.text);
}
}
} }
private void AddAudioSource(AudioClip clip) private void AddAudioSource(AudioClip clip)
@@ -404,7 +419,7 @@ public class UmaViewerBuilder : MonoBehaviour
{ {
List<AudioClip> clips = new List<AudioClip>(); List<AudioClip> clips = new List<AudioClip>();
UmaViewerUI.Instance.LoadedAssetsAdd(awb); UmaViewerUI.Instance.LoadedAssetsAdd(awb);
string awbPath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{awb.Url.Substring(0, 2)}\\{awb.Url}"; string awbPath = GetABPath(awb); ;
if (!File.Exists(awbPath)) return clips; if (!File.Exists(awbPath)) return clips;
FileStream awbFile = File.OpenRead(awbPath); FileStream awbFile = File.OpenRead(awbPath);
@@ -433,6 +448,7 @@ public class UmaViewerBuilder : MonoBehaviour
return clips; return clips;
} }
private void RecursiveLoadAsset(UmaDatabaseEntry entry, bool IsSubAsset = false) private void RecursiveLoadAsset(UmaDatabaseEntry entry, bool IsSubAsset = false)
{ {
if (!string.IsNullOrEmpty(entry.Prerequisites)) if (!string.IsNullOrEmpty(entry.Prerequisites))
@@ -450,7 +466,7 @@ public class UmaViewerBuilder : MonoBehaviour
Debug.Log("Loading " + entry.Name); Debug.Log("Loading " + entry.Name);
if (Main.LoadedBundles.ContainsKey(entry.Name)) return; if (Main.LoadedBundles.ContainsKey(entry.Name)) return;
string filePath = $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}"; string filePath = GetABPath(entry);
if (File.Exists(filePath)) if (File.Exists(filePath))
{ {
AssetBundle bundle = AssetBundle.LoadFromFile(filePath); AssetBundle bundle = AssetBundle.LoadFromFile(filePath);
@@ -748,7 +764,6 @@ public class UmaViewerBuilder : MonoBehaviour
} }
} }
private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects) private void UnloadBundle(AssetBundle bundle, bool unloadAllObjects)
{ {
var entry = Main.LoadedBundles.FirstOrDefault(b => b.Value == bundle); var entry = Main.LoadedBundles.FirstOrDefault(b => b.Value == bundle);
@@ -774,4 +789,9 @@ public class UmaViewerBuilder : MonoBehaviour
Main.LoadedBundles.Clear(); Main.LoadedBundles.Clear();
UI.LoadedAssetsClear(); UI.LoadedAssetsClear();
} }
private static string GetABPath(UmaDatabaseEntry entry)
{
return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
}
} }