live has music now
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class CallAfterDelay : MonoBehaviour
|
||||
{
|
||||
float delay;
|
||||
System.Action action;
|
||||
|
||||
// Will never call this frame, always the next frame at the earliest
|
||||
public static CallAfterDelay Create(float delay, System.Action action)
|
||||
{
|
||||
CallAfterDelay cad = new GameObject("CallAfterDelay").AddComponent<CallAfterDelay>();
|
||||
cad.delay = delay;
|
||||
cad.action = action;
|
||||
return cad;
|
||||
}
|
||||
|
||||
float age;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (age > delay)
|
||||
{
|
||||
action();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
void LateUpdate()
|
||||
{
|
||||
age += Time.deltaTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d30491b056a700f48b6af3b340ae0caf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,6 +11,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using UmaMusumeAudio;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
@@ -671,8 +672,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
});//fill empty
|
||||
|
||||
UI.SetEyeTrackingEnable(false);
|
||||
|
||||
GameObject MainLive = new GameObject("Live");
|
||||
GameObject Director = new GameObject("Director");
|
||||
|
||||
@@ -686,7 +685,47 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
Gallop.Live.Director.instance.InitializeTimeline();
|
||||
|
||||
Gallop.Live.Director.instance.Play();
|
||||
//Gallop.Live.Director.instance.Play();
|
||||
List<GameObject> transferObjs = new List<GameObject>();
|
||||
transferObjs.Add(MainLive);
|
||||
transferObjs.Add(GameObject.Find("ViewerMain"));
|
||||
transferObjs.Add(GameObject.Find("GlobalShaderController"));
|
||||
transferObjs.Add(GameObject.Find("Camera"));
|
||||
transferObjs.Add(GameObject.Find("Directional Light"));
|
||||
transferObjs.Add(GameObject.Find("AnimationCameraRoot"));
|
||||
StartCoroutine(LoadLiveSceneAsync("LiveScene", transferObjs, live.MusicId, characters[0].CharaEntry.Id));
|
||||
|
||||
}
|
||||
|
||||
IEnumerator LoadLiveSceneAsync(string sceneName, List<GameObject> go, int songid, int charaid)
|
||||
{
|
||||
// Set the current Scene to be able to unload it later
|
||||
Scene currentScene = SceneManager.GetActiveScene();
|
||||
|
||||
// The Application loads the Scene in the background at the same time as the current Scene.
|
||||
AsyncOperation asyncLoad = SceneManager.LoadSceneAsync(sceneName, LoadSceneMode.Additive);
|
||||
|
||||
// Wait until the last operation fully loads to return anything
|
||||
while (!asyncLoad.isDone)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
|
||||
foreach(var obj in go)
|
||||
{
|
||||
SceneManager.MoveGameObjectToScene(obj, SceneManager.GetSceneByName(sceneName));
|
||||
}
|
||||
|
||||
|
||||
// Unload the previous Scene
|
||||
//Scene scene = SceneManager.GetSceneByName(sceneName);
|
||||
|
||||
//SceneManager.SetActiveScene(scene);
|
||||
|
||||
SceneManager.UnloadSceneAsync(currentScene);
|
||||
|
||||
Gallop.Live.Director.instance.Play(songid, charaid);
|
||||
}
|
||||
|
||||
//Use CriWare Library
|
||||
@@ -732,7 +771,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
|
||||
//Use decrypt function
|
||||
public void LoadLiveSound(int songid, UmaDatabaseEntry SongAwb)
|
||||
public void LoadLiveSound(int songid, UmaDatabaseEntry SongAwb, bool needLyrics = true)
|
||||
{
|
||||
//load character voice
|
||||
PlaySound(SongAwb);
|
||||
@@ -749,7 +788,10 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
LoadLiveLyrics(songid);
|
||||
if (needLyrics)
|
||||
{
|
||||
LoadLiveLyrics(songid);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(UmaDatabaseEntry SongAwb, int subindex = -1)
|
||||
|
||||
@@ -127,6 +127,7 @@ public class UmaViewerGlobalShader : MonoBehaviour
|
||||
private void FixedUpdate()
|
||||
{
|
||||
//Used to calculate the correct outline
|
||||
//Outline need more adjust in live
|
||||
if (UmaViewerBuilder.Instance.CurrentUMAContainer)
|
||||
{
|
||||
if (UmaViewerBuilder.Instance.CurrentUMAContainer.UpBodyBone)
|
||||
|
||||
@@ -588,7 +588,11 @@ public class UmaViewerUI : MonoBehaviour
|
||||
if (selectlist != null)
|
||||
{
|
||||
LiveTime = true;
|
||||
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
|
||||
SetEyeTrackingEnable(false);
|
||||
GameObject.Find("LoadingCanvas").GetComponent<Canvas>().enabled = true;
|
||||
CallAfterDelay.Create(0, () => {
|
||||
Builder.LoadLive(currentLive, new List<LiveCharacterSelect>(selectlist));
|
||||
});
|
||||
LiveSelectPannel.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
using System.Linq;
|
||||
using Gallop.Live.Cutt;
|
||||
using static Director;
|
||||
using UnityEditor.SceneManagement;
|
||||
using static UnityEditor.Experimental.AssetDatabaseExperimental.AssetDatabaseCounters;
|
||||
using System.Data;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
|
||||
namespace Gallop.Live
|
||||
{
|
||||
@@ -310,6 +312,9 @@ namespace Gallop.Live
|
||||
public LiveEntry live;
|
||||
private const string CUTT_PATH = "cutt/cutt_son{0}/cutt_son{0}";
|
||||
private const string STAGE_PATH = "3d/env/live/live{0}/pfb_env_live{0}_controller000";
|
||||
private const string SONG_PATH = "sound/l/{0}/snd_bgm_live_{0}_oke_01.awb";
|
||||
private const string VOCAL_PATH = "sound/l/{0}/snd_bgm_live_{0}_chara_{1}_01.awb";
|
||||
private const string RANDOM_VOCAL_PATH = "sound/l/{0}/snd_bgm_live_{0}_chara";
|
||||
|
||||
private UmaViewerBuilder Builder => UmaViewerBuilder.Instance;
|
||||
|
||||
@@ -319,6 +324,10 @@ namespace Gallop.Live
|
||||
|
||||
public List<LiveTimelineCharaMotSeqData> seqData;
|
||||
|
||||
public bool _isLiveScene;
|
||||
|
||||
public AudioSource liveSong;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (live != null)
|
||||
@@ -355,11 +364,10 @@ namespace Gallop.Live
|
||||
|
||||
public void InitializeTimeline()
|
||||
{
|
||||
//Move?
|
||||
_liveTimelineControl.InitCharaMotionSequence();
|
||||
}
|
||||
|
||||
public void Play()
|
||||
public void Play(int songid, int charaid)
|
||||
{
|
||||
/*
|
||||
int counter = 0;
|
||||
@@ -380,7 +388,30 @@ namespace Gallop.Live
|
||||
}
|
||||
}
|
||||
*/
|
||||
seqData = this._liveTimelineControl.data.worksheetList[0].charaMotSeqList;
|
||||
Debug.Log(songid);
|
||||
Debug.Log(charaid);
|
||||
Debug.Log(string.Format(VOCAL_PATH, songid, charaid));
|
||||
|
||||
var entry = UmaViewerMain.Instance.AbSounds.FirstOrDefault(a => a.Name.Contains(string.Format(VOCAL_PATH, songid, charaid)));
|
||||
if (entry == null)
|
||||
{
|
||||
List<UmaDatabaseEntry> entries = new List<UmaDatabaseEntry>();
|
||||
foreach (var random in UmaViewerMain.Instance.AbSounds.Where(a => (a.Name.Contains(string.Format(RANDOM_VOCAL_PATH, songid)) && a.Name.EndsWith("awb"))))
|
||||
{
|
||||
entries.Add(random);
|
||||
}
|
||||
if (entries.Count > 0)
|
||||
{
|
||||
entry = entries[UnityEngine.Random.Range(0, entries.Count - 1)];
|
||||
}
|
||||
}
|
||||
if(entry != null)
|
||||
{
|
||||
Debug.Log(entry.Name);
|
||||
UmaViewerBuilder.Instance.LoadLiveSound(songid, entry, false);
|
||||
liveSong = GameObject.Find("SoundController").GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
_isLiveSetup = true;
|
||||
_liveCurrentTime = 0;
|
||||
}
|
||||
@@ -417,8 +448,16 @@ namespace Gallop.Live
|
||||
{
|
||||
if (_isLiveSetup)
|
||||
{
|
||||
_liveCurrentTime += Time.deltaTime;
|
||||
OnTimelineUpdate(_liveCurrentTime);
|
||||
if(false)
|
||||
{
|
||||
_liveCurrentTime = liveSong.time;
|
||||
OnTimelineUpdate(_liveCurrentTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
_liveCurrentTime += Time.deltaTime;
|
||||
OnTimelineUpdate(_liveCurrentTime);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user