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 CriWareFormats;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Networking.Types;
using static CriWare.CriAtomExCategory.ReactDuckerParameter;
public class UmaViewerAudio
@@ -12,20 +14,21 @@ public class UmaViewerAudio
static UmaViewerMain Main => UmaViewerMain.Instance;
public struct UmaSoundInfo
{
public string acbPath;
public string awbPath;
public UmaDatabaseEntry acb;
public UmaDatabaseEntry awb;
}
static public UmaSoundInfo getSoundPath(string name)
{
Debug.Log(name);
UmaSoundInfo info;
info.acbPath = null;
info.awbPath = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb")).FilePath;
info.acb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("acb"));
info.awb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(name) && a.Name.EndsWith("awb"));
return info;
}
static public CriAtomSource ApplyCueSheet(string cueName)
/*
static public CriAtomSource Apply(string cueName)
{
UmaSoundInfo soundInfo = getSoundPath(cueName);
CriAtom.AddCueSheet(cueName, soundInfo.acbPath, soundInfo.awbPath);
@@ -39,6 +42,37 @@ public class UmaViewerAudio
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
{
+1 -1
View File
@@ -850,7 +850,7 @@ public class UmaViewerBuilder : MonoBehaviour
source.Play();
}
public List<AudioClip> LoadAudio(UmaDatabaseEntry awb)
public static List<AudioClip> LoadAudio(UmaDatabaseEntry awb)
{
List<AudioClip> clips = new List<AudioClip>();
string awbPath = awb.FilePath;
+1 -1
View File
@@ -862,7 +862,7 @@ public class UmaViewerUI : MonoBehaviour
Destroy(NormalSubSoundList.content.GetChild(i).gameObject);
}
var subSounds = Builder.LoadAudio(awb);
var subSounds = UmaViewerBuilder.LoadAudio(awb);
foreach (var sound in subSounds)
{
@@ -326,8 +326,8 @@ namespace Gallop.Live
public AudioSource[] liveSong;
public List<CriAtomSource> liveVocal;
public CriAtomSource liveMusic;
public List<List<AudioSource>> liveVocal = new List<List<AudioSource>>();
public List<AudioSource> liveMusic = new List<AudioSource>();
public PartEntry partInfo;
@@ -465,19 +465,19 @@ namespace Gallop.Live
if (entry != null)
{
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)
{
vocal.Play(0);
UmaViewerAudio.Play(vocal);
}
liveMusic.Play(0);
UmaViewerAudio.Play(liveMusic);
}
else
{
@@ -512,7 +512,7 @@ namespace Gallop.Live
_liveTimelineControl.AlterUpdate(_liveCurrentTime);
if (!_soloMode)
{
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal);
//UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal);
}
}
@@ -543,9 +543,9 @@ namespace Gallop.Live
{
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;
}
}
@@ -562,9 +562,10 @@ namespace Gallop.Live
{
if (sliderControl.is_Outed)
{
/*
_liveCurrentTime = UI.ProgressBar.value * totalTime;
if (liveMusic)
if (liveMusic.Count > 0)
{
int CriTime = Convert.ToInt32(_liveCurrentTime * 1000);
@@ -590,6 +591,7 @@ namespace Gallop.Live
song.Play();
}
}
*/
OnTimelineUpdate(_liveCurrentTime);
@@ -600,7 +602,7 @@ namespace Gallop.Live
else if (sliderControl.is_Touched)
{
_liveCurrentTime = UI.ProgressBar.value * totalTime;
/*
if (liveMusic)
{
liveMusic.Stop();
@@ -616,7 +618,7 @@ namespace Gallop.Live
song.Stop();
}
}
*/
OnTimelineUpdate(_liveCurrentTime);
}
else