merge file

This commit is contained in:
CroakFang
2023-07-16 04:51:18 +08:00
4 changed files with 55 additions and 19 deletions
+39 -5
View File
@@ -1,9 +1,11 @@
using CriWare; using CriWare;
using CriWareFormats;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
using UnityEngine.Networking.Types;
using static CriWare.CriAtomExCategory.ReactDuckerParameter; using static CriWare.CriAtomExCategory.ReactDuckerParameter;
public class UmaViewerAudio public class UmaViewerAudio
@@ -12,20 +14,21 @@ public class UmaViewerAudio
static UmaViewerMain Main => UmaViewerMain.Instance; static UmaViewerMain Main => UmaViewerMain.Instance;
public struct UmaSoundInfo public struct UmaSoundInfo
{ {
public string acbPath; public UmaDatabaseEntry acb;
public string awbPath; public UmaDatabaseEntry awb;
} }
static public UmaSoundInfo getSoundPath(string name) static public UmaSoundInfo getSoundPath(string name)
{ {
Debug.Log(name); Debug.Log(name);
UmaSoundInfo info; UmaSoundInfo info;
info.acbPath = null; info.acb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb"));
info.awbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")).FilePath; info.awb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb"));
return info; return info;
} }
static public CriAtomSource ApplyCueSheet(string cueName) /*
static public CriAtomSource Apply(string cueName)
{ {
UmaSoundInfo soundInfo = getSoundPath(cueName); UmaSoundInfo soundInfo = getSoundPath(cueName);
CriAtom.AddCueSheet(cueName, soundInfo.acbPath, soundInfo.awbPath); CriAtom.AddCueSheet(cueName, soundInfo.acbPath, soundInfo.awbPath);
@@ -39,6 +42,37 @@ public class UmaViewerAudio
return source; return source;
} }
*/
static public List<AudioSource> ApplySound(string cueName)
{
UmaSoundInfo soundInfo = getSoundPath(cueName);
GameObject sourceRoot = new GameObject("CuteAudioSource");
sourceRoot.transform.SetParent(GameObject.Find("AudioManager/AudioControllerBgm").transform);
List<AudioSource> sourceList = new List<AudioSource>();
List<AudioClip> sounds = UmaViewerBuilder.LoadAudio(soundInfo.awb);
foreach(var clip in sounds)
{
AudioSource source = sourceRoot.AddComponent<AudioSource>();
source.clip = clip;
sourceList.Add(source);
}
Debug.Log(sourceList);
return sourceList;
}
public static void Play(List<AudioSource> sourceList)
{
foreach(var source in sourceList)
{
source.Play();
}
}
public enum PartForm public enum PartForm
{ {
+1 -1
View File
@@ -850,7 +850,7 @@ public class UmaViewerBuilder : MonoBehaviour
source.Play(); source.Play();
} }
public List<AudioClip> LoadAudio(UmaDatabaseEntry awb) public static List<AudioClip> LoadAudio(UmaDatabaseEntry awb)
{ {
List<AudioClip> clips = new List<AudioClip>(); List<AudioClip> clips = new List<AudioClip>();
string awbPath = awb.FilePath; string awbPath = awb.FilePath;
+1 -1
View File
@@ -862,7 +862,7 @@ public class UmaViewerUI : MonoBehaviour
Destroy(NormalSubSoundList.content.GetChild(i).gameObject); Destroy(NormalSubSoundList.content.GetChild(i).gameObject);
} }
var subSounds = Builder.LoadAudio(awb); var subSounds = UmaViewerBuilder.LoadAudio(awb);
foreach (var sound in subSounds) foreach (var sound in subSounds)
{ {
@@ -326,8 +326,8 @@ namespace Gallop.Live
public AudioSource[] liveSong; public AudioSource[] liveSong;
public List<CriAtomSource> liveVocal; public List<List<AudioSource>> liveVocal = new List<List<AudioSource>>();
public CriAtomSource liveMusic; public List<AudioSource> liveMusic = new List<AudioSource>();
public PartEntry partInfo; public PartEntry partInfo;
@@ -465,19 +465,19 @@ namespace Gallop.Live
if (entry != null) if (entry != null)
{ {
Debug.Log(entry.Name); Debug.Log(entry.Name);
liveVocal.Add(UmaViewerAudio.ApplyCueSheet(entry.Name.Split('.')[0])); liveVocal.Add(UmaViewerAudio.ApplySound(entry.Name.Split('.')[0]));
} }
} }
} }
liveMusic = UmaViewerAudio.ApplyCueSheet(string.Format(SONG_PATH, songid)); liveMusic = UmaViewerAudio.ApplySound(string.Format(SONG_PATH, songid));
foreach (var vocal in liveVocal) foreach (var vocal in liveVocal)
{ {
vocal.Play(0); UmaViewerAudio.Play(vocal);
} }
liveMusic.Play(0); UmaViewerAudio.Play(liveMusic);
} }
else else
{ {
@@ -512,7 +512,7 @@ namespace Gallop.Live
_liveTimelineControl.AlterUpdate(_liveCurrentTime); _liveTimelineControl.AlterUpdate(_liveCurrentTime);
if (!_soloMode) if (!_soloMode)
{ {
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal); //UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal);
} }
} }
@@ -543,9 +543,9 @@ namespace Gallop.Live
{ {
if (!_soloMode) if (!_soloMode)
{ {
if(liveMusic.time > 0.1) if (liveMusic[0].time > 0.1)
{ {
_liveCurrentTime = (float)liveMusic.time / 1000; _liveCurrentTime = (float)liveMusic[0].time / 1000;
_syncTime = true; _syncTime = true;
} }
} }
@@ -562,9 +562,10 @@ namespace Gallop.Live
{ {
if (sliderControl.is_Outed) if (sliderControl.is_Outed)
{ {
/*
_liveCurrentTime = UI.ProgressBar.value * totalTime; _liveCurrentTime = UI.ProgressBar.value * totalTime;
if (liveMusic) if (liveMusic.Count > 0)
{ {
int CriTime = Convert.ToInt32(_liveCurrentTime * 1000); int CriTime = Convert.ToInt32(_liveCurrentTime * 1000);
@@ -590,6 +591,7 @@ namespace Gallop.Live
song.Play(); song.Play();
} }
} }
*/
OnTimelineUpdate(_liveCurrentTime); OnTimelineUpdate(_liveCurrentTime);
@@ -600,7 +602,7 @@ namespace Gallop.Live
else if (sliderControl.is_Touched) else if (sliderControl.is_Touched)
{ {
_liveCurrentTime = UI.ProgressBar.value * totalTime; _liveCurrentTime = UI.ProgressBar.value * totalTime;
/*
if (liveMusic) if (liveMusic)
{ {
liveMusic.Stop(); liveMusic.Stop();
@@ -616,7 +618,7 @@ namespace Gallop.Live
song.Stop(); song.Stop();
} }
} }
*/
OnTimelineUpdate(_liveCurrentTime); OnTimelineUpdate(_liveCurrentTime);
} }
else else