Merged changed from Croakfang's branch. (#72)

* merge (#71)

* Bug fix, improved UI layout and live vocals

* Bug Fixes, New Live Compatibility

---------

Co-authored-by: CroakFang <1605296300@qq.com>

* recovered shader functions

* Fixed texture loading for costume 0015

---------

Co-authored-by: CroakFang <1605296300@qq.com>
This commit is contained in:
katboi01
2024-09-09 10:27:37 +02:00
committed by GitHub
parent 4292484f25
commit 3b2bae40cd
23 changed files with 916 additions and 617 deletions
+30 -7
View File
@@ -76,7 +76,6 @@ public class UmaViewerBuilder : MonoBehaviour
public void LoadLiveUma(List<LiveCharacterSelect> characters)
{
UmaAssetManager.UnloadAllBundle();
for (int i = 0; i < characters.Count; i++)
{
if (characters[i].CharaEntry.Name != "")
@@ -666,6 +665,7 @@ public class UmaViewerBuilder : MonoBehaviour
Gallop.Live.Director mController = MainLive.GetComponentInChildren<Gallop.Live.Director>();
mController.live = live;
mController.IsRecordVMD = UI.isRecordVMD;
mController.RequireStage = UI.isRequireStage;
List<GameObject> transferObjs = new List<GameObject>() {
MainLive,
@@ -678,7 +678,7 @@ public class UmaViewerBuilder : MonoBehaviour
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
transferObjs.ForEach(o => SceneManager.MoveGameObjectToScene(o, SceneManager.GetSceneByName("LiveScene")));
mController.Initialize();
characters.ForEach(a =>
{
if (a.CharaEntry == null || a.CostumeId == "")
@@ -687,8 +687,18 @@ public class UmaViewerBuilder : MonoBehaviour
a.CostumeId = "0002_00_00";
}
});//fill empty
var actual_member_count = mController._liveTimelineControl.data.worksheetList[0].charaMotSeqList.Count;
if (actual_member_count > characters.Count)
{
Debug.LogWarning($"actual member count is {actual_member_count} current {characters.Count}");
var actual_characters = new List<LiveCharacterSelect>();
for (int i = 0; i < actual_member_count; i++)
{
actual_characters.Add(characters[i % characters.Count]);
}
characters = actual_characters;
}
LoadLiveUma(characters);
var Lyrics = LoadLiveLyrics(live.MusicId);
@@ -735,8 +745,19 @@ public class UmaViewerBuilder : MonoBehaviour
}
}
public void PlaySound(UmaDatabaseEntry SongAwb, int subindex = -1)
public void loadLivePreviewSound(int songid)
{
string nameVar = $"snd_bgm_live_{songid}_preview_02";
UmaDatabaseEntry previewAwb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(nameVar) && a.Name.EndsWith("awb"));
if (previewAwb != null)
{
PlaySound(previewAwb, volume : 0.4f, loop : true);
}
}
public void PlaySound(UmaDatabaseEntry SongAwb, int subindex = -1, float volume = 1, bool loop = false)
{
CurrentLyrics.Clear();
if (CurrentAudioSources.Count > 0)
{
var tmp = CurrentAudioSources[0];
@@ -748,17 +769,17 @@ public class UmaViewerBuilder : MonoBehaviour
{
foreach (AudioClip clip in LoadAudio(SongAwb))
{
AddAudioSource(clip);
AddAudioSource(clip, volume, loop);
}
}
else
{
AddAudioSource(LoadAudio(SongAwb)[subindex]);
AddAudioSource(LoadAudio(SongAwb)[subindex], volume, loop);
}
}
private void AddAudioSource(AudioClip clip)
private void AddAudioSource(AudioClip clip, float volume = 1, bool loop = false)
{
AudioSource source;
if (CurrentAudioSources.Count > 0)
@@ -771,6 +792,8 @@ public class UmaViewerBuilder : MonoBehaviour
}
CurrentAudioSources.Add(source);
source.clip = clip;
source.volume = volume;
source.loop = loop;
source.Play();
}