Merge branch 'master' of https://github.com/croakfang/UmaViewer
This commit is contained in:
+1087
-7
File diff suppressed because it is too large
Load Diff
@@ -13,7 +13,7 @@ public class UmaSceneController:MonoBehaviour
|
||||
{
|
||||
if (instance)
|
||||
{
|
||||
Destroy(this.gameObject);
|
||||
Destroy(instance.gameObject);
|
||||
}
|
||||
instance = this;
|
||||
DontDestroyOnLoad(this);
|
||||
@@ -26,9 +26,10 @@ public class UmaSceneController:MonoBehaviour
|
||||
|
||||
IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnLastSceneUnloaded)
|
||||
{
|
||||
|
||||
if (CavansInstance)
|
||||
{
|
||||
Destroy(CavansInstance);
|
||||
//Destroy(CavansInstance);
|
||||
}
|
||||
CavansInstance = Instantiate(CavansPrefab, transform);
|
||||
var animation = CavansInstance.GetComponent<Animation>();
|
||||
|
||||
@@ -66,6 +66,8 @@ public class UmaViewerAudio
|
||||
|
||||
float _999_count = 0;
|
||||
|
||||
bool _no999 = false;
|
||||
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
string partName = ((PartForm)i).ToString();
|
||||
@@ -97,11 +99,15 @@ public class UmaViewerAudio
|
||||
{
|
||||
_999_count += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_no999 = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_999_count == liveVocal.Count)
|
||||
if ((_999_count == liveVocal.Count && liveVocal.Count != 0) || _no999)
|
||||
{
|
||||
useMixer = true;
|
||||
}
|
||||
|
||||
@@ -90,10 +90,21 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
if (characters[i].CharaEntry.Name != "")
|
||||
{
|
||||
CurrentUMAContainer = new GameObject($"Chara_{characters[i].CharaEntry.Id}_{characters[i].CostumeId}").AddComponent<UmaContainer>();
|
||||
CurrentUMAContainer.IsLive = true;
|
||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(characters[i].CharaEntry);
|
||||
CurrentUMAContainer.transform.parent = Gallop.Live.Director.instance.charaObjs[i];
|
||||
LoadNormalUma(characters[i].CharaEntry, characters[i].CostumeId);
|
||||
|
||||
if (characters[i].CharaEntry.IsMob)
|
||||
{
|
||||
CurrentUMAContainer.IsLive = true;
|
||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(characters[i].CharaEntry);
|
||||
CurrentUMAContainer.transform.parent = Gallop.Live.Director.instance.charaObjs[i];
|
||||
LoadMobUma(characters[i].CharaEntry, characters[i].CostumeId);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentUMAContainer.IsLive = true;
|
||||
CurrentUMAContainer.CharaData = UmaDatabaseController.ReadCharaData(characters[i].CharaEntry);
|
||||
CurrentUMAContainer.transform.parent = Gallop.Live.Director.instance.charaObjs[i];
|
||||
LoadNormalUma(characters[i].CharaEntry, characters[i].CostumeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,7 +708,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
},
|
||||
delegate ()
|
||||
{
|
||||
Gallop.Live.Director.instance.InitializeTimeline(characters.Count);
|
||||
Gallop.Live.Director.instance.InitializeTimeline(characters, UI.LiveMode);
|
||||
Gallop.Live.Director.instance.Play(live.MusicId, characters);
|
||||
}
|
||||
);
|
||||
|
||||
@@ -149,7 +149,7 @@ public class UmaViewerMain : MonoBehaviour
|
||||
string filePath = asset.FilePath;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
AssetBundle bundle = AssetBundle.LoadFromFile(filePath);
|
||||
AssetBundle bundle = UmaViewerBuilder.LoadOrGet(asset);
|
||||
foreach (var item in UmaDatabaseController.Instance.LiveData)
|
||||
{
|
||||
var musicId = Convert.ToInt32(item["music_id"]);
|
||||
|
||||
+106
-12
@@ -10,6 +10,7 @@ using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using static UnityEditor.SceneView;
|
||||
using Debug = UnityEngine.Debug;
|
||||
|
||||
public class UmaViewerUI : MonoBehaviour
|
||||
@@ -134,7 +135,10 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public bool EnableEyeTracking = true;
|
||||
public bool EnableFaceOverride = true;
|
||||
|
||||
[Header("Live")]
|
||||
public bool LiveTime = false;
|
||||
public Dropdown LiveDropdown;
|
||||
public int LiveMode = 0;
|
||||
|
||||
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
|
||||
|
||||
@@ -158,6 +162,66 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (LiveMode != LiveDropdown.value)
|
||||
{
|
||||
LiveMode = LiveDropdown.value;
|
||||
if (LiveSelectPannel.activeSelf && currentLive != null)
|
||||
{
|
||||
foreach (var select in LiveSelectList.content.GetComponentsInChildren<Transform>())
|
||||
{
|
||||
if(select != LiveSelectList.content.transform)
|
||||
{
|
||||
Destroy(select.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
switch (LiveMode)
|
||||
{
|
||||
case 0:
|
||||
LiveSelectImage.sprite = currentLive.Icon;
|
||||
|
||||
int mainCount = 0;
|
||||
foreach (var motion in Main.AbMotions.Where(a => a.Name.StartsWith($"3d/motion/live/body/son{currentLive.MusicId}") && Path.GetFileName(a.Name).Split('_').Length == 4))
|
||||
{
|
||||
mainCount += 1;
|
||||
}
|
||||
|
||||
LiveSelectInfoText.text = $"{currentLive.SongName}\nMain Members Count: {mainCount}";
|
||||
for (int i = 0; i < mainCount; i++)
|
||||
{
|
||||
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
|
||||
chara.IndexText.text = (i + 1).ToString();
|
||||
chara.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
LiveSelectImage.sprite = currentLive.Icon;
|
||||
LiveSelectInfoText.text = $"{currentLive.SongName}\nMembers Count: {currentLive.MemberCount}";
|
||||
for (int i = 0; i < currentLive.MemberCount; i++)
|
||||
{
|
||||
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
|
||||
chara.IndexText.text = (i + 1).ToString();
|
||||
chara.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
}
|
||||
});
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Builder.CurrentAudioSources.Count > 0)
|
||||
{
|
||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||
@@ -597,22 +661,52 @@ public class UmaViewerUI : MonoBehaviour
|
||||
Destroy(LiveSelectList.content.GetChild(i).gameObject);
|
||||
}
|
||||
|
||||
currentLive = entry;
|
||||
LiveSelectImage.sprite = entry.Icon;
|
||||
LiveSelectInfoText.text = $"{entry.SongName}\nMembers Count: {entry.MemberCount}";
|
||||
for (int i = 0; i < entry.MemberCount; i++)
|
||||
if(LiveMode == 1)
|
||||
{
|
||||
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
|
||||
chara.IndexText.text = (i + 1).ToString();
|
||||
chara.GetComponent<Button>().onClick.AddListener(() =>
|
||||
currentLive = entry;
|
||||
LiveSelectImage.sprite = entry.Icon;
|
||||
LiveSelectInfoText.text = $"{entry.SongName}\nMembers Count: {entry.MemberCount}";
|
||||
for (int i = 0; i < entry.MemberCount; i++)
|
||||
{
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
|
||||
chara.IndexText.text = (i + 1).ToString();
|
||||
chara.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
}
|
||||
});
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
else if(LiveMode == 0)
|
||||
{
|
||||
currentLive = entry;
|
||||
LiveSelectImage.sprite = entry.Icon;
|
||||
|
||||
int mainCount = 0;
|
||||
foreach (var motion in Main.AbMotions.Where(a => a.Name.StartsWith($"3d/motion/live/body/son{entry.MusicId}") && Path.GetFileName(a.Name).Split('_').Length == 4))
|
||||
{
|
||||
mainCount += 1;
|
||||
}
|
||||
|
||||
LiveSelectInfoText.text = $"{entry.SongName}\nMain Members Count: {mainCount}";
|
||||
for (int i = 0; i < mainCount; i++)
|
||||
{
|
||||
var chara = Instantiate(LiveSelectPrefab, LiveSelectList.content).GetComponent<LiveCharacterSelect>();
|
||||
chara.IndexText.text = (i + 1).ToString();
|
||||
chara.GetComponent<Button>().onClick.AddListener(() =>
|
||||
{
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ListCostumes(CharaEntry chara, bool mini)
|
||||
|
||||
@@ -1065,7 +1065,7 @@ namespace Gallop
|
||||
|
||||
if (partR != 0)
|
||||
{
|
||||
leftEarMorph[partR - 1].weight = (((1 - weightRatio)) * ((float)_prevEarsKeyData.weight / 100));
|
||||
rightEarMorph[partR - 1].weight = (((1 - weightRatio)) * ((float)_prevEarsKeyData.weight / 100));
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1081,7 +1081,7 @@ namespace Gallop
|
||||
|
||||
if (partR != 0)
|
||||
{
|
||||
leftEarMorph[partR - 1].weight = 0;
|
||||
rightEarMorph[partR - 1].weight = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1097,7 +1097,7 @@ namespace Gallop
|
||||
|
||||
if (curPartR != 0)
|
||||
{
|
||||
leftEarMorph[curPartR - 1].weight += weightRatio * ((float)updateInfo_.earCur.weight / 100);
|
||||
rightEarMorph[curPartR - 1].weight += weightRatio * ((float)updateInfo_.earCur.weight / 100);
|
||||
}
|
||||
|
||||
ChangeMorphEar();
|
||||
|
||||
@@ -3,6 +3,9 @@ using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static RootMotion.FinalIK.IKSolverVR;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using static UnityEngine.Rendering.VirtualTexturing.Debugging;
|
||||
|
||||
namespace Gallop.Live.Cutt
|
||||
{
|
||||
@@ -78,18 +81,45 @@ namespace Gallop.Live.Cutt
|
||||
_keyArray[i] = data.worksheetList[0].charaMotSeqList[i].keys;
|
||||
}
|
||||
|
||||
//Set Motion
|
||||
int CharaPositionMax = Director.instance.allowCount;
|
||||
|
||||
_motionSequenceArray = new LiveTimelineMotionSequence[CharaPositionMax];
|
||||
|
||||
|
||||
for (int i = 0; i < CharaPositionMax; i++)
|
||||
if (Director.instance.liveMode == 1)
|
||||
{
|
||||
_motionSequenceArray[i] = new LiveTimelineMotionSequence();
|
||||
_motionSequenceArray[i].Initialize(Director.instance.charaObjs[i], i, motionSequence[i], this);
|
||||
//Set Motion
|
||||
int CharaPositionMax = Director.instance.allowCount;
|
||||
|
||||
_motionSequenceArray = new LiveTimelineMotionSequence[CharaPositionMax];
|
||||
|
||||
|
||||
for (int i = 0; i < CharaPositionMax; i++)
|
||||
{
|
||||
Debug.Log(i);
|
||||
_motionSequenceArray[i] = new LiveTimelineMotionSequence();
|
||||
_motionSequenceArray[i].Initialize(Director.instance.charaObjs[i], i, motionSequence[i], this);
|
||||
}
|
||||
}
|
||||
|
||||
else if(Director.instance.liveMode == 0)
|
||||
{
|
||||
List<AnimationClip> Anims = new List<AnimationClip>();
|
||||
//Get MotionList
|
||||
foreach (var motion in UmaViewerMain.Instance.AbMotions.Where(a => a.Name.StartsWith($"3d/motion/live/body/son{Director.instance.live.MusicId}") && Path.GetFileName(a.Name).Split('_').Length == 4))
|
||||
{
|
||||
AssetBundle motionAB = UmaViewerBuilder.LoadOrGet(motion);
|
||||
AnimationClip motionAnim = motionAB.LoadAsset<AnimationClip>(Path.GetFileName(motion.Name).Split('.')[0]);
|
||||
Anims.Add(motionAnim);
|
||||
}
|
||||
|
||||
//Set Motion
|
||||
int CharaPositionMax = Director.instance.allowCount;
|
||||
|
||||
_motionSequenceArray = new LiveTimelineMotionSequence[CharaPositionMax];
|
||||
|
||||
|
||||
for (int i = 0; i < CharaPositionMax; i++)
|
||||
{
|
||||
_motionSequenceArray[i] = new LiveTimelineMotionSequence();
|
||||
_motionSequenceArray[i].Initialize(Director.instance.charaObjs[i], i, motionSequence[i], this, Anims);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void AlterUpdate(float liveTime)
|
||||
@@ -97,6 +127,7 @@ namespace Gallop.Live.Cutt
|
||||
AlterUpdate_CharaMotionSequence(liveTime);
|
||||
AlterUpdate_FacialData(liveTime);
|
||||
AlterUpdate_LipSync(liveTime);
|
||||
//AlterLateUpdate_FormationOffset(liveTime);
|
||||
}
|
||||
|
||||
public void AlterUpdate_CharaMotionSequence(float liveTime)
|
||||
@@ -208,6 +239,32 @@ namespace Gallop.Live.Cutt
|
||||
}
|
||||
}
|
||||
|
||||
private void AlterLateUpdate_FormationOffset(float liveTime)
|
||||
{
|
||||
|
||||
var formationList = data.worksheetList[0].formationOffsetSet.Init();
|
||||
|
||||
for (int i = 0; i < Director.instance.characterCount; i++)
|
||||
{
|
||||
LiveTimelineKeyIndex curKey = AlterUpdate_Key(formationList[i], liveTime);
|
||||
|
||||
if (curKey != null && curKey.index != -1)
|
||||
{
|
||||
LateUpdateFormationOffset_Transform(i, curKey, liveTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LateUpdateFormationOffset_Transform(int targetIndex, LiveTimelineKeyIndex curKeyIndex, float time)
|
||||
{
|
||||
LiveTimelineKeyFormationOffsetData curKey = curKeyIndex.key as LiveTimelineKeyFormationOffsetData;
|
||||
LiveTimelineKeyFormationOffsetData nextKey = curKeyIndex.nextKey as LiveTimelineKeyFormationOffsetData;
|
||||
|
||||
Director.instance.charaObjs[targetIndex].position = curKey.Position;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void FindTimelineKeyCurrent(out LiveTimelineKeyIndex curKey, ILiveTimelineKeyDataList keys, float curTime)
|
||||
{
|
||||
curKey = keys.FindCurrentKey(curTime);
|
||||
|
||||
+6
@@ -111,6 +111,7 @@ namespace Gallop.Live.Cutt
|
||||
[System.Serializable]
|
||||
public class LiveTimelineFormationOffsetData
|
||||
{
|
||||
|
||||
private const int DATA_LIST_SIZE = 20;
|
||||
public LiveTimelineKeyFormationOffsetDataList centerKeys; // 0x10
|
||||
public LiveTimelineKeyFormationOffsetDataList left1Keys; // 0x18
|
||||
@@ -133,5 +134,10 @@ namespace Gallop.Live.Cutt
|
||||
public LiveTimelineKeyFormationOffsetDataList place19Keys; // 0xA0
|
||||
public LiveTimelineKeyFormationOffsetDataList place20Keys; // 0xA8
|
||||
private readonly ILiveTimelineKeyDataList[] _cacheDataList; // 0xB0
|
||||
|
||||
public List<LiveTimelineKeyFormationOffsetDataList> Init()
|
||||
{
|
||||
return new List<LiveTimelineKeyFormationOffsetDataList> { centerKeys, left1Keys , right1Keys, left2Keys, right2Keys, place06Keys, place07Keys, place08Keys, place09Keys, place10Keys, place11Keys, place12Keys, place13Keys, place14Keys, place15Keys, place16Keys, place17Keys, place18Keys, place19Keys, place20Keys };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using static RootMotion.Demos.CharacterMeleeDemo.Action;
|
||||
|
||||
namespace Gallop.Live.Cutt
|
||||
{
|
||||
@@ -28,8 +29,22 @@ namespace Gallop.Live.Cutt
|
||||
private bool _needChange;
|
||||
private LiveTimelineKeyCharaMotionData _prevKey;
|
||||
|
||||
public void Initialize(Transform target, int targetIndex, int seqDataIndex, LiveTimelineControl timelineControl)
|
||||
private AnimationClip _targetAnim = null;
|
||||
|
||||
public void Initialize(Transform target, int targetIndex, int seqDataIndex, LiveTimelineControl timelineControl, List<AnimationClip> animclips = null)
|
||||
{
|
||||
if(animclips != null)
|
||||
{
|
||||
if (targetIndex < Director.instance.charaAnims.Count)
|
||||
{
|
||||
_targetAnim = animclips[targetIndex];
|
||||
|
||||
_tempAnim = Director.instance.charaAnims[targetIndex];
|
||||
_tempAnim.AddClip(_targetAnim, _targetAnim.name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
_tempTarget = target;
|
||||
_targetIndex = targetIndex;
|
||||
|
||||
@@ -56,6 +71,16 @@ namespace Gallop.Live.Cutt
|
||||
|
||||
public void AlterUpdate(float currentTime)
|
||||
{
|
||||
if(Director.instance.liveMode == 0)
|
||||
{
|
||||
if(_targetAnim != null)
|
||||
{
|
||||
_tempAnim[_targetAnim.name].time = currentTime;
|
||||
_tempAnim.Play(_targetAnim.name);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentKey != null && _tempAnim != null)
|
||||
{
|
||||
LiveTimelineKeyIndex curKey = LiveTimelineControl.AlterUpdate_Key(_currentKey, currentTime);
|
||||
|
||||
@@ -13,6 +13,7 @@ using System.Data;
|
||||
using System.Runtime.Remoting.Metadata.W3cXsd2001;
|
||||
using CriWare;
|
||||
using static UmaViewerAudio;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace Gallop.Live
|
||||
{
|
||||
@@ -342,6 +343,8 @@ namespace Gallop.Live
|
||||
public int characterCount = 0;
|
||||
public int allowCount = 0;
|
||||
|
||||
public int liveMode = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (live != null)
|
||||
@@ -379,9 +382,23 @@ namespace Gallop.Live
|
||||
}
|
||||
}
|
||||
|
||||
public void InitializeTimeline(int count)
|
||||
public void InitializeTimeline(List<LiveCharacterSelect> characters, int mode)
|
||||
{
|
||||
allowCount = count;
|
||||
liveMode = mode;
|
||||
|
||||
allowCount = characters.Count;
|
||||
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
{
|
||||
if (characters[i].CharaEntry.Name != "")
|
||||
{
|
||||
characterCount += 1;
|
||||
}
|
||||
}
|
||||
if (characterCount == 1)
|
||||
{
|
||||
_soloMode = true;
|
||||
}
|
||||
|
||||
_liveTimelineControl.InitCharaMotionSequence(_liveTimelineControl.data.characterSettings.motionSequenceIndices);
|
||||
|
||||
@@ -410,19 +427,6 @@ namespace Gallop.Live
|
||||
{
|
||||
Debug.Log(songid);
|
||||
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
{
|
||||
if (characters[i].CharaEntry.Name != "")
|
||||
{
|
||||
characterCount += 1;
|
||||
}
|
||||
}
|
||||
if(characterCount == 1)
|
||||
{
|
||||
_soloMode = true;
|
||||
}
|
||||
|
||||
|
||||
if (!_soloMode)
|
||||
{
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
@@ -501,6 +505,12 @@ namespace Gallop.Live
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.Escape))
|
||||
{
|
||||
SceneManager.LoadScene("Version2");
|
||||
AssetBundle.UnloadAllAssetBundles(true);
|
||||
}
|
||||
|
||||
if (_isLiveSetup)
|
||||
{
|
||||
if(_syncTime == false)
|
||||
|
||||
Reference in New Issue
Block a user