A demo for using CriWare plugin.
This commit is contained in:
@@ -7178,8 +7178,8 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
- m_Target: {fileID: 1564959568}
|
- m_Target: {fileID: 1564959567}
|
||||||
m_TargetAssemblyTypeName: UmaViewerBuilder, umamusume
|
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
||||||
m_MethodName: SetCriWare
|
m_MethodName: SetCriWare
|
||||||
m_Mode: 6
|
m_Mode: 6
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
@@ -10278,8 +10278,8 @@ MonoBehaviour:
|
|||||||
m_StringArgument:
|
m_StringArgument:
|
||||||
m_BoolArgument: 0
|
m_BoolArgument: 0
|
||||||
m_CallState: 2
|
m_CallState: 2
|
||||||
- m_Target: {fileID: 1564959568}
|
- m_Target: {fileID: 1564959567}
|
||||||
m_TargetAssemblyTypeName: UmaViewerBuilder, umamusume
|
m_TargetAssemblyTypeName: UmaViewerUI, umamusume
|
||||||
m_MethodName: SetCriWare
|
m_MethodName: SetCriWare
|
||||||
m_Mode: 6
|
m_Mode: 6
|
||||||
m_Arguments:
|
m_Arguments:
|
||||||
@@ -15186,6 +15186,7 @@ MonoBehaviour:
|
|||||||
LoadedAssetsPanel: {fileID: 2126459761}
|
LoadedAssetsPanel: {fileID: 2126459761}
|
||||||
UIColor1: {r: 1, g: 1, b: 1, a: 0.39215687}
|
UIColor1: {r: 1, g: 1, b: 1, a: 0.39215687}
|
||||||
UIColor2: {r: 1, g: 1, b: 1, a: 1}
|
UIColor2: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
isCirware: 0
|
||||||
--- !u!114 &1564959568
|
--- !u!114 &1564959568
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class LoadSound : ScriptableObject
|
||||||
|
{
|
||||||
|
UmaViewerMain Main => UmaViewerMain.Instance;
|
||||||
|
public struct UmaSoundInfo
|
||||||
|
{
|
||||||
|
public string acbPath;
|
||||||
|
public string awbPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public UmaSoundInfo getSoundPath(string name) {
|
||||||
|
UmaSoundInfo info;
|
||||||
|
info.acbPath = UmaViewerBuilder.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb")));
|
||||||
|
info.awbPath = UmaViewerBuilder.GetABPath(Main.AbList.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")));
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: ef2081963b0a68f4e8558e38b24cc264
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using CriWareFormats;
|
using CriWare;
|
||||||
|
using CriWareFormats;
|
||||||
using Gallop;
|
using Gallop;
|
||||||
using NAudio.Wave;
|
using NAudio.Wave;
|
||||||
using NAudio.Wave.SampleProviders;
|
using NAudio.Wave.SampleProviders;
|
||||||
@@ -30,8 +31,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
public List<AudioSource> CurrentAudioSources = new List<AudioSource>();
|
public List<AudioSource> CurrentAudioSources = new List<AudioSource>();
|
||||||
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
||||||
|
|
||||||
public bool isCirware = false;
|
|
||||||
|
|
||||||
public AnimatorOverrideController OverrideController;
|
public AnimatorOverrideController OverrideController;
|
||||||
|
|
||||||
|
|
||||||
@@ -358,11 +357,49 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCriWare(bool value)
|
//Use CriWare Library
|
||||||
|
public void LoadLiveSoundCri(int songid, UmaDatabaseEntry SongAwb)
|
||||||
{
|
{
|
||||||
isCirware = value;
|
//清理
|
||||||
|
if (CurrentAudioSources.Count > 0)
|
||||||
|
{
|
||||||
|
var tmp = CurrentAudioSources[0];
|
||||||
|
CurrentAudioSources.Clear();
|
||||||
|
Destroy(tmp.gameObject);
|
||||||
|
UI.ResetAudioPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取Acb文件和Awb文件的路径
|
||||||
|
string nameVar = SongAwb.Name.Split('.')[0].Split('/').Last();
|
||||||
|
|
||||||
|
//使用Live的Bgm
|
||||||
|
nameVar = $"snd_bgm_live_{songid}_oke";
|
||||||
|
|
||||||
|
LoadSound Loader = (LoadSound)ScriptableObject.CreateInstance("LoadSound");
|
||||||
|
LoadSound.UmaSoundInfo soundInfo = Loader.getSoundPath(nameVar);
|
||||||
|
|
||||||
|
//音频组件添加路径,载入音频
|
||||||
|
CriAtom.AddCueSheet(nameVar, soundInfo.acbPath, soundInfo.awbPath);
|
||||||
|
|
||||||
|
//获得当前音频信息
|
||||||
|
CriAtomEx.CueInfo[] cueInfoList;
|
||||||
|
List<string> cueNameList = new List<string>();
|
||||||
|
cueInfoList = CriAtom.GetAcb(nameVar).GetCueInfoList();
|
||||||
|
foreach (CriAtomEx.CueInfo cueInfo in cueInfoList)
|
||||||
|
{
|
||||||
|
cueNameList.Add(cueInfo.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建播放器
|
||||||
|
CriAtomSource source = new GameObject("CuteAudioSource").AddComponent<CriAtomSource>();
|
||||||
|
source.transform.SetParent(GameObject.Find("AudioManager/AudioControllerBgm").transform);
|
||||||
|
source.cueSheet = nameVar;
|
||||||
|
|
||||||
|
//播放
|
||||||
|
source.Play(cueNameList[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Use decrypt function
|
||||||
public void LoadLiveSound(int songid, UmaDatabaseEntry SongAwb)
|
public void LoadLiveSound(int songid, UmaDatabaseEntry SongAwb)
|
||||||
{
|
{
|
||||||
if (CurrentAudioSources.Count > 0)
|
if (CurrentAudioSources.Count > 0)
|
||||||
@@ -822,7 +859,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
|||||||
UI.LoadedAssetsClear();
|
UI.LoadedAssetsClear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetABPath(UmaDatabaseEntry entry)
|
public static string GetABPath(UmaDatabaseEntry entry)
|
||||||
{
|
{
|
||||||
return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
return $"{Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "Low"}\\Cygames\\umamusume\\dat\\{entry.Url.Substring(0, 2)}\\{entry.Url}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public class UmaViewerGlobalShader : MonoBehaviour
|
|||||||
|
|
||||||
void setGlobal()
|
void setGlobal()
|
||||||
{
|
{
|
||||||
|
|
||||||
//Color
|
//Color
|
||||||
Shader.SetGlobalColor("_GlobalToonColor", _GlobalToonColor);
|
Shader.SetGlobalColor("_GlobalToonColor", _GlobalToonColor);
|
||||||
Shader.SetGlobalColor("_Global_FogColor", _Global_FogColor);
|
Shader.SetGlobalColor("_Global_FogColor", _Global_FogColor);
|
||||||
|
|||||||
@@ -55,6 +55,8 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
|
|||||||
|
|
||||||
public Color UIColor1, UIColor2;
|
public Color UIColor1, UIColor2;
|
||||||
|
|
||||||
|
public bool isCirware = false;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
@@ -268,6 +270,12 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void SetCriWare(bool value)
|
||||||
|
{
|
||||||
|
isCirware = value;
|
||||||
|
}
|
||||||
|
|
||||||
void ListLiveSounds(int songid)
|
void ListLiveSounds(int songid)
|
||||||
{
|
{
|
||||||
for (int i = LiveCharaSoundList.content.childCount - 1; i >= 0; i--)
|
for (int i = LiveCharaSoundList.content.childCount - 1; i >= 0; i--)
|
||||||
@@ -283,7 +291,14 @@ public class UmaViewerUI : MonoBehaviour,FaceLoadCallBack
|
|||||||
container.Name.text = name;
|
container.Name.text = name;
|
||||||
container.Button.onClick.AddListener(() => {
|
container.Button.onClick.AddListener(() => {
|
||||||
HighlightChildImage(LiveCharaSoundList.content, container.GetComponent<Image>());
|
HighlightChildImage(LiveCharaSoundList.content, container.GetComponent<Image>());
|
||||||
Builder.LoadLiveSound(songid, entry);
|
if (isCirware)
|
||||||
|
{
|
||||||
|
Builder.LoadLiveSoundCri(songid, entry);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Builder.LoadLiveSound(songid, entry);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
"name": "umamusume",
|
"name": "umamusume",
|
||||||
"rootNamespace": "",
|
"rootNamespace": "",
|
||||||
"references": [
|
"references": [
|
||||||
"GUID:6055be8ebefd69e48b49212b09b47b2f"
|
"GUID:6055be8ebefd69e48b49212b09b47b2f",
|
||||||
|
"GUID:800597811bcc5d848b15e12807d6de45"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|||||||
Reference in New Issue
Block a user