fix new live error, add live Lyrics ui
This commit is contained in:
@@ -22,10 +22,12 @@ namespace CriWareFormats
|
||||
public sealed class AwbReader : IDisposable
|
||||
{
|
||||
private readonly BinaryReader binaryReader;
|
||||
private readonly long offset;
|
||||
|
||||
private readonly byte offsetSize;
|
||||
private readonly ushort waveIdAlignment;
|
||||
private readonly int totalSubsongs;
|
||||
private readonly ushort alignment;
|
||||
private readonly ushort offsetAlignment;
|
||||
private readonly ushort subkey;
|
||||
|
||||
private readonly List<Row> cueNames;
|
||||
@@ -41,40 +43,41 @@ namespace CriWareFormats
|
||||
public AwbReader(Stream awbStream, long positionOffset)
|
||||
{
|
||||
binaryReader = new BinaryReader(awbStream);
|
||||
offset = positionOffset;
|
||||
|
||||
binaryReader.BaseStream.Position = positionOffset;
|
||||
binaryReader.BaseStream.Position = offset;
|
||||
|
||||
if (!binaryReader.ReadChars(4).SequenceEqual("AFS2".ToCharArray()))
|
||||
if (!binaryReader.ReadChars(4).SequenceEqual("AFS2"))
|
||||
throw new InvalidDataException("Incorrect magic.");
|
||||
|
||||
binaryReader.BaseStream.Position += 0x1;
|
||||
offsetSize = binaryReader.ReadByte();
|
||||
binaryReader.BaseStream.Position += 0x2;
|
||||
waveIdAlignment = binaryReader.ReadUInt16();
|
||||
totalSubsongs = binaryReader.ReadInt32();
|
||||
alignment = binaryReader.ReadUInt16();
|
||||
offsetAlignment = binaryReader.ReadUInt16();
|
||||
subkey = binaryReader.ReadUInt16();
|
||||
|
||||
waves = new List<Wave>(totalSubsongs);
|
||||
|
||||
for (int subsong = 1; subsong <= totalSubsongs; subsong++)
|
||||
{
|
||||
long offset = 0x10;
|
||||
long currentOffset = 0x10;
|
||||
|
||||
long waveIdOffset = offset + (subsong - 1) * 0x2;
|
||||
long waveIdOffset = currentOffset + (subsong - 1) * waveIdAlignment;
|
||||
|
||||
binaryReader.BaseStream.Position = waveIdOffset;
|
||||
binaryReader.BaseStream.Position = offset + waveIdOffset;
|
||||
|
||||
int waveId = binaryReader.ReadUInt16();
|
||||
|
||||
offset += totalSubsongs * 0x2;
|
||||
currentOffset += totalSubsongs * waveIdAlignment;
|
||||
|
||||
long subfileOffset = 0;
|
||||
long subfileNext = 0;
|
||||
long fileSize = binaryReader.BaseStream.Length;
|
||||
|
||||
offset += (subsong - 1) * offsetSize;
|
||||
currentOffset += (subsong - 1) * offsetSize;
|
||||
|
||||
binaryReader.BaseStream.Position = offset;
|
||||
binaryReader.BaseStream.Position = offset + currentOffset;
|
||||
|
||||
switch (offsetSize)
|
||||
{
|
||||
@@ -93,10 +96,10 @@ namespace CriWareFormats
|
||||
break;
|
||||
}
|
||||
|
||||
subfileOffset += subfileOffset % alignment > 0 ?
|
||||
alignment - subfileOffset % alignment : 0;
|
||||
subfileNext += subfileNext % alignment > 0 && subfileNext < fileSize ?
|
||||
alignment - subfileNext % alignment : 0;
|
||||
subfileOffset += subfileOffset % offsetAlignment > 0 ?
|
||||
offsetAlignment - subfileOffset % offsetAlignment : 0;
|
||||
subfileNext += subfileNext % offsetAlignment > 0 && subfileNext < fileSize ?
|
||||
offsetAlignment - subfileNext % offsetAlignment : 0;
|
||||
long subfileSize = subfileNext - subfileOffset;
|
||||
|
||||
waves.Add(new Wave()
|
||||
@@ -123,7 +126,7 @@ namespace CriWareFormats
|
||||
|
||||
public Stream GetWaveSubfileStream(Wave wave)
|
||||
{
|
||||
return new SpliceStream(binaryReader.BaseStream, wave.Offset, wave.Length);
|
||||
return new SpliceStream(binaryReader.BaseStream, offset + wave.Offset, wave.Length);
|
||||
}
|
||||
|
||||
private static void Fail()
|
||||
|
||||
@@ -15,6 +15,11 @@ public class LiveViewerUI : MonoBehaviour
|
||||
public Dropdown FrameRateDropDown;
|
||||
|
||||
public GameObject RecordingUI;
|
||||
|
||||
public Text LyricsText;
|
||||
|
||||
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
||||
|
||||
float targetHeight = 0;
|
||||
float height;
|
||||
private void Awake()
|
||||
@@ -53,4 +58,10 @@ public class LiveViewerUI : MonoBehaviour
|
||||
{
|
||||
Application.targetFrameRate = int.Parse(FrameRateDropDown.options[fps].text);
|
||||
}
|
||||
|
||||
public void UpdateLyrics(float time)
|
||||
{
|
||||
var text = UmaUtility.GetCurrentLyrics(time, CurrentLyrics);
|
||||
LyricsText.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
//MergeHead
|
||||
if (Head)
|
||||
{
|
||||
var headskins = Head.GetComponentsInChildren<SkinnedMeshRenderer>();
|
||||
var headskins = Head.GetComponentsInChildren<SkinnedMeshRenderer>(true);
|
||||
foreach (SkinnedMeshRenderer headskin in headskins)
|
||||
{
|
||||
MergeBone(headskin, bodyBones, ref emptyBones);
|
||||
@@ -231,28 +231,29 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
public void MergeBone(SkinnedMeshRenderer from, Dictionary<string, Transform> targetBones, ref List<Transform> emptyBones)
|
||||
{
|
||||
var rootbone = targetBones[from.rootBone.name];
|
||||
if (rootbone) from.rootBone = rootbone;
|
||||
|
||||
Transform[] tmpBone = new Transform[from.bones.Length];
|
||||
for (int i = 0; i < tmpBone.Length; i++)
|
||||
if(targetBones.TryGetValue(from.rootBone.name, out Transform rootbone))
|
||||
{
|
||||
if (targetBones.TryGetValue(from.bones[i].name, out Transform targetbone))
|
||||
from.rootBone = rootbone;
|
||||
Transform[] tmpBone = new Transform[from.bones.Length];
|
||||
for (int i = 0; i < tmpBone.Length; i++)
|
||||
{
|
||||
tmpBone[i] = targetbone;
|
||||
from.bones[i].position = targetbone.position;
|
||||
while (from.bones[i].transform.childCount > 0)
|
||||
if (targetBones.TryGetValue(from.bones[i].name, out Transform targetbone))
|
||||
{
|
||||
from.bones[i].transform.GetChild(0).SetParent(targetbone);
|
||||
tmpBone[i] = targetbone;
|
||||
from.bones[i].position = targetbone.position;
|
||||
while (from.bones[i].transform.childCount > 0)
|
||||
{
|
||||
from.bones[i].transform.GetChild(0).SetParent(targetbone);
|
||||
}
|
||||
emptyBones.Add(from.bones[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpBone[i] = from.bones[i];
|
||||
}
|
||||
emptyBones.Add(from.bones[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpBone[i] = from.bones[i];
|
||||
}
|
||||
}
|
||||
from.bones = tmpBone;
|
||||
from.bones = tmpBone;
|
||||
};
|
||||
}
|
||||
|
||||
public void LoadPhysics()
|
||||
|
||||
@@ -80,16 +80,21 @@ public class LiveEntry
|
||||
public class PartEntry
|
||||
{
|
||||
public Dictionary<string, List<float>> PartSettings = new Dictionary<string, List<float>>();
|
||||
|
||||
public int SingerCount = 0;
|
||||
public PartEntry(string data)
|
||||
{
|
||||
string[] lines = data.Split("\n"[0]);
|
||||
string[] lines = data.Split('\n');
|
||||
|
||||
string[] names = lines[0].Split(',');
|
||||
|
||||
foreach (var name in names)
|
||||
{
|
||||
PartSettings[name] = new List<float>();
|
||||
var temp = name;
|
||||
temp.Replace("lleft", "left2");
|
||||
temp.Replace("rright", "right2");
|
||||
temp.Replace("llleft", "left3");
|
||||
temp.Replace("rrright", "right3");
|
||||
PartSettings[temp] = new List<float>();
|
||||
}
|
||||
|
||||
for (int i = 1; i < lines.Length - 1; i++)
|
||||
@@ -100,6 +105,17 @@ public class PartEntry
|
||||
PartSettings[names[j]].Add((float)Convert.ToDouble(values[j]));
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var part in PartSettings)
|
||||
{
|
||||
if (part.Key != "time" && !part.Key.Contains("_"))
|
||||
{
|
||||
if (part.Value.FindAll(v => v > 0).Count > 0)
|
||||
{
|
||||
SingerCount += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
@@ -32,12 +31,12 @@ public class UmaSceneController:MonoBehaviour
|
||||
UmaAssetManager.OnLoadProgressChange += LoadingProgressChange;
|
||||
}
|
||||
|
||||
public static void LoadScene(string name, Action OnSceneloaded = null, Action OnLastSceneUnloaded = null)
|
||||
public static void LoadScene(string name, Action OnSceneloaded = null, Action OnPrevSceneUnloaded = null)
|
||||
{
|
||||
instance.StartCoroutine(instance.LoadLiveSceneAsync(name, OnSceneloaded, OnLastSceneUnloaded));
|
||||
instance.StartCoroutine(instance.LoadLiveSceneAsync(name, OnSceneloaded, OnPrevSceneUnloaded));
|
||||
}
|
||||
|
||||
IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnLastSceneUnloaded)
|
||||
IEnumerator LoadLiveSceneAsync(string sceneName, Action OnSceneloaded, Action OnPrevSceneUnloaded)
|
||||
{
|
||||
|
||||
if (CavansInstance)
|
||||
@@ -64,7 +63,7 @@ public class UmaSceneController:MonoBehaviour
|
||||
AsyncOperation asyncUnLoad = SceneManager.UnloadSceneAsync(currentScene);
|
||||
yield return new WaitUntil(() => asyncUnLoad.isDone);
|
||||
|
||||
OnLastSceneUnloaded?.Invoke();
|
||||
OnPrevSceneUnloaded?.Invoke();
|
||||
|
||||
animation.Play("SceneTransition_e");
|
||||
yield return new WaitUntil(() => !animation.isPlaying);
|
||||
|
||||
@@ -16,7 +16,10 @@ public class UmaViewerAudio
|
||||
|
||||
public class CuteAudioSource
|
||||
{
|
||||
public string tag;
|
||||
public bool enable;
|
||||
public float volume;
|
||||
public float pan;
|
||||
public List<AudioSource> sourceList;
|
||||
}
|
||||
|
||||
@@ -27,7 +30,7 @@ public class UmaViewerAudio
|
||||
return info;
|
||||
}
|
||||
|
||||
static public CuteAudioSource ApplySound(string cueName)
|
||||
static public CuteAudioSource ApplySound(string cueName, int part)
|
||||
{
|
||||
UmaSoundInfo soundInfo = getSoundPath(cueName);
|
||||
|
||||
@@ -48,7 +51,10 @@ public class UmaViewerAudio
|
||||
|
||||
CuteAudioSource cute = new CuteAudioSource
|
||||
{
|
||||
tag = ((PartForm)part).ToString(),
|
||||
enable = false,
|
||||
volume = 1,
|
||||
pan = 0,
|
||||
sourceList = sourceList
|
||||
};
|
||||
|
||||
@@ -83,29 +89,19 @@ public class UmaViewerAudio
|
||||
{
|
||||
center = 0,
|
||||
left = 1,
|
||||
right = 2
|
||||
}
|
||||
|
||||
public static void SetSelectorLabel(CuteAudioSource sourceList, int index)
|
||||
{
|
||||
for(int i = 0; i < sourceList.sourceList.Count; i++)
|
||||
{
|
||||
if(i != index)
|
||||
{
|
||||
sourceList.sourceList[i].volume = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceList.sourceList[i].volume = 1;
|
||||
}
|
||||
}
|
||||
right = 2,
|
||||
left2 = 3,
|
||||
right2 = 4,
|
||||
left3 = 5,
|
||||
right3 = 6,
|
||||
}
|
||||
|
||||
public static void ApplyMainVolume(CuteAudioSource sourceList)
|
||||
{
|
||||
foreach (var source in sourceList.sourceList)
|
||||
{
|
||||
source.volume *= sourceList.volume;
|
||||
source.volume = (sourceList.enable ? sourceList.volume : 0);
|
||||
source.panStereo = sourceList.pan;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,98 +121,28 @@ public class UmaViewerAudio
|
||||
}
|
||||
}
|
||||
|
||||
var volumeMixer = 0;
|
||||
var useMixer = false;
|
||||
|
||||
float _999_count = 0;
|
||||
bool _no999 = false;
|
||||
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
string partName = ((PartForm)i).ToString();
|
||||
string partName = liveVocal[i].tag;
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName)){
|
||||
var value = partInfo.PartSettings[partName][targetIndex];
|
||||
|
||||
if (value == 0)
|
||||
{
|
||||
liveVocal[i].volume = 0;
|
||||
volumeMixer += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
liveVocal[i].volume = 1;
|
||||
SetSelectorLabel(liveVocal[i], Convert.ToInt32(value - 1));
|
||||
}
|
||||
|
||||
liveVocal[i].enable = partInfo.PartSettings[partName][targetIndex] > 0;
|
||||
|
||||
float volume;
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_vol"))
|
||||
{
|
||||
volume = partInfo.PartSettings[partName + "_vol"][targetIndex];
|
||||
if(volume != 999)
|
||||
{
|
||||
liveVocal[i].volume *= volume;
|
||||
}
|
||||
else
|
||||
{
|
||||
_999_count += 1;
|
||||
}
|
||||
var volume = partInfo.PartSettings[partName + "_vol"][targetIndex];
|
||||
liveVocal[i].volume = (volume == 999 ? 1 : volume);
|
||||
}
|
||||
else
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_pan"))
|
||||
{
|
||||
_no999 = true;
|
||||
var pan = partInfo.PartSettings[partName + "_pan"][targetIndex];
|
||||
liveVocal[i].pan = (pan == 999 ? 0 : pan);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if ((_999_count == liveVocal.Count && liveVocal.Count != 0) || _no999)
|
||||
{
|
||||
useMixer = true;
|
||||
}
|
||||
|
||||
if (useMixer)
|
||||
{
|
||||
switch (volumeMixer)
|
||||
{
|
||||
case 0:
|
||||
liveVocal[0].volume = 0.7056f;
|
||||
if(liveVocal.Count > 2)
|
||||
{
|
||||
liveVocal[2].volume = 0.56f;
|
||||
}
|
||||
if (liveVocal.Count > 1)
|
||||
{
|
||||
liveVocal[1].volume = 0.56f;
|
||||
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
if (liveVocal[i].volume != 0)
|
||||
{
|
||||
liveVocal[i].volume = 0.7031f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
if (liveVocal[i].volume != 0)
|
||||
{
|
||||
liveVocal[i].volume = 0.9954f;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
liveVocal[i].volume = 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
foreach(var cute in liveVocal)
|
||||
{
|
||||
|
||||
@@ -664,7 +664,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
mController.live = live;
|
||||
mController.IsRecordVMD = UI.isRecordVMD;
|
||||
|
||||
|
||||
List<GameObject> transferObjs = new List<GameObject>() {
|
||||
MainLive,
|
||||
GameObject.Find("ViewerMain"),
|
||||
@@ -689,6 +688,11 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
LoadLiveUma(characters);
|
||||
|
||||
var Lyrics = LoadLiveLyrics(live.MusicId);
|
||||
if (Lyrics != null)
|
||||
{
|
||||
LiveViewerUI.Instance.CurrentLyrics = Lyrics;
|
||||
}
|
||||
},
|
||||
delegate ()
|
||||
{
|
||||
@@ -800,7 +804,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
return clips;
|
||||
}
|
||||
|
||||
public void LoadLiveLyrics(int songid)
|
||||
public List<UmaLyricsData> LoadLiveLyrics(int songid)
|
||||
{
|
||||
if (CurrentLyrics.Count > 0) CurrentLyrics.Clear();
|
||||
|
||||
@@ -820,13 +824,14 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
UmaLyricsData lyricsData = new UmaLyricsData()
|
||||
{
|
||||
time = float.Parse(words[0]) / 1000,
|
||||
text = (words.Length > 1) ? words[1].Replace("[COMMA]", ",") : ""
|
||||
text = (words.Length > 1) ? words[1] : ""
|
||||
};
|
||||
CurrentLyrics.Add(lyricsData);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
return CurrentLyrics;
|
||||
}
|
||||
|
||||
public void LoadAssetPath(string path, Transform SetParent)
|
||||
|
||||
@@ -169,7 +169,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
private void Update()
|
||||
{
|
||||
|
||||
if (Builder.CurrentAudioSources.Count > 0)
|
||||
if (Builder.CurrentAudioSources.Count > 0 && Builder.CurrentAudioSources[0])
|
||||
{
|
||||
AudioSource MianSource = Builder.CurrentAudioSources[0];
|
||||
if (MianSource.clip)
|
||||
@@ -177,7 +177,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
TitleText.text = MianSource.clip.name;
|
||||
ProgressText.text = string.Format("{0} / {1}", ToTimeFormat(MianSource.time), ToTimeFormat(MianSource.clip.length));
|
||||
AudioSlider.SetValueWithoutNotify(MianSource.time / MianSource.clip.length);
|
||||
LyricsText.text = GetCurrentLyrics(MianSource.time);
|
||||
LyricsText.text = UmaUtility.GetCurrentLyrics(MianSource.time, Builder.CurrentLyrics);
|
||||
LyricsText.text = LyricsText.text;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1216,18 +1217,6 @@ public class UmaViewerUI : MonoBehaviour
|
||||
return string.Format("{0:D2}m:{1:D2}s:{2:D2}f", minute, seconds, frames);
|
||||
}
|
||||
|
||||
public string GetCurrentLyrics(float time)
|
||||
{
|
||||
for (int i = Builder.CurrentLyrics.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (Builder.CurrentLyrics[i].time < time)
|
||||
{
|
||||
return Builder.CurrentLyrics[i].text;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void RecordVMD()
|
||||
{
|
||||
var container = Builder.CurrentUMAContainer;
|
||||
|
||||
@@ -5,7 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
public class UmaUtility
|
||||
public static class UmaUtility
|
||||
{
|
||||
public static Dictionary<string, Transform> ConvertListToDictionary(List<Transform> transformList)
|
||||
{
|
||||
@@ -55,5 +55,19 @@ public class UmaUtility
|
||||
JsonUtility.FromJsonOverwrite(json, to);
|
||||
}
|
||||
|
||||
public static string GetCurrentLyrics(float time, List<UmaLyricsData> lyricsDatas)
|
||||
{
|
||||
for (int i = lyricsDatas.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (lyricsDatas[i].time < time)
|
||||
{
|
||||
var lyric = lyricsDatas[i].text;
|
||||
lyric = lyric.Replace("[COMMA]", ",");
|
||||
lyric = lyric.Replace("\\n", "\n");
|
||||
return lyric;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,12 @@ namespace Gallop
|
||||
|
||||
List<FacialMorph> leftEarMorph = new List<FacialMorph>();
|
||||
List<FacialMorph> rightEarMorph = new List<FacialMorph>();
|
||||
|
||||
FacialOtherMorph CheekMorph;
|
||||
FacialOtherMorph ShadeMorph;
|
||||
FacialOtherMorph MangaMorph;
|
||||
List<FacialOtherMorph> TearMorphs = new List<FacialOtherMorph>();
|
||||
|
||||
public void Initialize(Dictionary<string, Transform> objs)
|
||||
{
|
||||
Objs = objs;
|
||||
@@ -247,6 +253,7 @@ namespace Gallop
|
||||
CheekMorph.BindProperties.Add(cheekProperty2);
|
||||
}
|
||||
OtherMorphs.Add(CheekMorph);
|
||||
this.CheekMorph = CheekMorph;
|
||||
}
|
||||
|
||||
Container.FaceMaterial = Container.Head.transform.Find("M_Face").GetComponent<SkinnedMeshRenderer>().material;
|
||||
@@ -266,6 +273,7 @@ namespace Gallop
|
||||
PropertyName = "_faceShadowAlpha"
|
||||
});
|
||||
OtherMorphs.Add(FaceShadowMorph);
|
||||
ShadeMorph = FaceShadowMorph;
|
||||
}
|
||||
|
||||
FacialOtherMorph FaceMangaMorph = new FacialOtherMorph()
|
||||
@@ -290,6 +298,7 @@ namespace Gallop
|
||||
BindPrefab = mangaObjects
|
||||
});
|
||||
OtherMorphs.Add(FaceMangaMorph);
|
||||
MangaMorph = FaceMangaMorph;
|
||||
|
||||
foreach (var tear in Container.TearControllers)
|
||||
{
|
||||
@@ -304,30 +313,35 @@ namespace Gallop
|
||||
Part = BindProperty.LocatorPart.ScaX,
|
||||
Type = BindProperty.BindType.TearWeight,
|
||||
BindTearController = tear,
|
||||
Value = tear.Weight
|
||||
Value = tear.Weight,
|
||||
DefaultValue = tear.Weight
|
||||
});
|
||||
FaceTearMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.PosY,
|
||||
Type = BindProperty.BindType.TearSide,
|
||||
BindTearController = tear,
|
||||
Value = tear.CurrentDir
|
||||
Value = tear.CurrentDir,
|
||||
DefaultValue = tear.CurrentDir
|
||||
});
|
||||
FaceTearMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.ScaY,
|
||||
Type = BindProperty.BindType.TearSelect,
|
||||
BindTearController = tear,
|
||||
Value = tear.CurrenObject
|
||||
Value = tear.CurrenObject,
|
||||
DefaultValue = tear.CurrenObject
|
||||
});
|
||||
FaceTearMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.ScaZ,
|
||||
Type = BindProperty.BindType.TearSpeed,
|
||||
BindTearController = tear,
|
||||
Value = tear.Speed
|
||||
Value = tear.Speed,
|
||||
DefaultValue = tear.Speed
|
||||
});
|
||||
OtherMorphs.Add(FaceTearMorph);
|
||||
TearMorphs.Add(FaceTearMorph);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,6 +429,11 @@ namespace Gallop
|
||||
ApplyRotationEar();
|
||||
}
|
||||
|
||||
public void ChangeMorphEffect()
|
||||
{
|
||||
OtherMorphs.ForEach(morph => ProcessExtraMorph(morph));
|
||||
}
|
||||
|
||||
public void ClearAllWeights()
|
||||
{
|
||||
EarMorphs.ForEach(morph => morph.weight = 0);
|
||||
@@ -426,7 +445,7 @@ namespace Gallop
|
||||
{
|
||||
morph.BindProperties.ForEach(property =>
|
||||
{
|
||||
property.Value = morph.GetLocatorValue(property.Part);
|
||||
property.Value = property.DefaultValue;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -467,11 +486,10 @@ namespace Gallop
|
||||
morph.BindGameObject.SetActive(true);
|
||||
property.BindMaterial.mainTexture = property.BindTexture;
|
||||
property.BindMaterial.SetFloat(property.PropertyName, property.Value);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (morph.BindProperties.IndexOf(property) == morph.BindProperties.Count - 1)
|
||||
if (morph.BindProperties.Find(p =>p.Value >0) == null)
|
||||
{
|
||||
morph.BindGameObject.SetActive(false);
|
||||
}
|
||||
@@ -546,6 +564,17 @@ namespace Gallop
|
||||
FacialReset(BaseREarMorph.trsArray);
|
||||
}
|
||||
|
||||
public void FacialResetEffect()
|
||||
{
|
||||
foreach(var morphs in OtherMorphs)
|
||||
{
|
||||
foreach(var property in morphs.BindProperties)
|
||||
{
|
||||
property.Value = property.DefaultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FacialReset(List<TrsArray> trsArrays)
|
||||
{
|
||||
foreach (TrsArray trs in trsArrays)
|
||||
@@ -655,16 +684,17 @@ namespace Gallop
|
||||
ChangeMorph();
|
||||
}
|
||||
|
||||
public void ChangeMorphWeight(BindProperty property, float val, FacialMorph morph)
|
||||
public void ChangeMorphWeight(BindProperty property, float val, FacialMorph morph, bool autoHideEye = true)
|
||||
{
|
||||
Container.isAnimatorControl = false;
|
||||
property.Value = val < 0 ? 0 : val;
|
||||
ChangeMorph();
|
||||
ChangeMorphEffect();
|
||||
|
||||
if (property.Type == BindProperty.BindType.Enable && morph.name.Contains("Manga"))
|
||||
if (autoHideEye && property.Type == BindProperty.BindType.Enable && morph.name.Contains("Manga"))
|
||||
{
|
||||
ChangeMorphWeight(EyeMorphs[42], val > 0 ? 1 : 0);
|
||||
ChangeMorphWeight(EyeMorphs[43], val > 0 ? 1 : 0);
|
||||
EyeMorphs[42].weight = (val > 0 ? 1 : 0);
|
||||
EyeMorphs[43].weight = (val > 0 ? 1 : 0);
|
||||
ChangeMorphEye();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -888,6 +918,35 @@ namespace Gallop
|
||||
ChangeMorphMouth();
|
||||
|
||||
}
|
||||
|
||||
var HasManga = false;
|
||||
if (updateInfo_.effect != null)
|
||||
{
|
||||
var info = updateInfo_.effect;
|
||||
var cheektype = info.cheekType;
|
||||
for (int i = 0; i < CheekMorph.BindProperties.Count; i++)
|
||||
{
|
||||
CheekMorph.BindProperties[i].Value = (cheektype - 1 == i ? 1 : 0);
|
||||
}
|
||||
|
||||
var mangatype = info.mangameIndex;
|
||||
if (mangatype == 0)
|
||||
{
|
||||
HasManga = false;
|
||||
MangaMorph.BindProperties[1].Value = mangatype;
|
||||
}
|
||||
else
|
||||
{
|
||||
HasManga = true;
|
||||
MangaMorph.BindProperties[0].Value = mangatype - 1;
|
||||
MangaMorph.BindProperties[1].Value = 1;
|
||||
}
|
||||
|
||||
//TODO Support Tear effect
|
||||
|
||||
ChangeMorphEffect();
|
||||
}
|
||||
|
||||
if (updateInfo_.eyeCur != null)
|
||||
{
|
||||
|
||||
@@ -936,8 +995,9 @@ namespace Gallop
|
||||
rightEyeMorph[part.FacialPartsId - 1].weight += ((float)part.WeightPer / 100 * weightRatio) * ((float)updateInfo_.eyeCur.weight / 100);
|
||||
}
|
||||
|
||||
EyeMorphs[42].weight = (HasManga ? 1 : 0); //Hide eye when has Manga eye
|
||||
EyeMorphs[43].weight = (HasManga ? 1 : 0);
|
||||
ChangeMorphEye();
|
||||
|
||||
}
|
||||
|
||||
if (updateInfo_.eyebrowCur != null)
|
||||
@@ -1070,8 +1130,6 @@ namespace Gallop
|
||||
|
||||
SetEyeTrack(finalRotation);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public Vector2 GetTimelineEyeTrackRotation(LiveTimelineKeyFacialEyeTrackData key)
|
||||
|
||||
@@ -81,5 +81,6 @@ namespace Gallop
|
||||
public LocatorPart Part;
|
||||
public BindType Type;
|
||||
public float Value;
|
||||
public float DefaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,6 +380,7 @@ namespace Gallop.Live.Cutt
|
||||
SetupFacialUpdateInfo_Eyebrow(ref updateInfo, facialDataList.eyebrowKeys, liveTime);
|
||||
SetupFacialUpdateInfo_Ear(ref updateInfo, facialDataList.earKeys, liveTime);
|
||||
SetupFacialUpdateInfo_EyeTrack(ref updateInfo, facialDataList.eyeTrackKeys, liveTime);
|
||||
SetupFacialUpdateInfo_Effect(ref updateInfo, facialDataList.effectKeys, liveTime);
|
||||
this.OnUpdateFacial(updateInfo, liveTime, 0);
|
||||
}
|
||||
|
||||
@@ -391,6 +392,7 @@ namespace Gallop.Live.Cutt
|
||||
SetupFacialUpdateInfo_Eyebrow(ref updateInfo, otherFacialDataList[i].eyebrowKeys, liveTime);
|
||||
SetupFacialUpdateInfo_Ear(ref updateInfo, otherFacialDataList[i].earKeys, liveTime);
|
||||
SetupFacialUpdateInfo_EyeTrack(ref updateInfo, otherFacialDataList[i].eyeTrackKeys, liveTime);
|
||||
SetupFacialUpdateInfo_Effect(ref updateInfo, otherFacialDataList[i].effectKeys, liveTime);
|
||||
this.OnUpdateFacial(updateInfo, liveTime, i+1);
|
||||
}
|
||||
}
|
||||
@@ -435,6 +437,20 @@ namespace Gallop.Live.Cutt
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupFacialUpdateInfo_Effect(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialEffectDataList keys, float time)
|
||||
{
|
||||
LiveTimelineKey liveTimelineKey = null;
|
||||
|
||||
LiveTimelineKeyIndex curKey = AlterUpdate_Key(keys, time);
|
||||
if (curKey != null)
|
||||
{
|
||||
liveTimelineKey = curKey.key;
|
||||
|
||||
updateInfo.effect = liveTimelineKey as LiveTimelineKeyFacialEffectData;
|
||||
updateInfo.effectKeyIndex = curKey.index;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetupFacialUpdateInfo_Eyebrow(ref FacialDataUpdateInfo updateInfo, LiveTimelineKeyFacialEyebrowDataList keys, float time)
|
||||
{
|
||||
LiveTimelineKey liveTimelineKey = null;
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ namespace Gallop.Live.Cutt
|
||||
public int cheekType;
|
||||
public int tearyType;
|
||||
public int tearfulType;
|
||||
public LiveTimelineKeyFacialEffectData.TeardropConfig[] teardropConfigs;
|
||||
public TeardropConfig[] teardropConfigs;
|
||||
public int mangameIndex;
|
||||
}
|
||||
|
||||
|
||||
@@ -559,18 +559,10 @@ namespace Gallop.Live
|
||||
|
||||
public void InitializeMusic(int songid, List<LiveCharacterSelect> characters)
|
||||
{
|
||||
Debug.Log(songid);
|
||||
|
||||
int singer = 3;
|
||||
|
||||
if (_soloMode)
|
||||
{
|
||||
singer = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
{
|
||||
if (characters[i].CharaEntry.Name != "" && i < 3)
|
||||
if (characters[i].CharaEntry.Name != "" && i < partInfo.SingerCount)
|
||||
{
|
||||
var charaid = characters[i].CharaEntry.Id;
|
||||
|
||||
@@ -591,13 +583,13 @@ namespace Gallop.Live
|
||||
if (entry != null)
|
||||
{
|
||||
Debug.Log(entry.Name);
|
||||
liveVocal.Add(UmaViewerAudio.ApplySound(entry.Name.Split('.')[0]));
|
||||
liveVocal.Add(UmaViewerAudio.ApplySound(entry.Name.Split('.')[0], i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
liveMusic = UmaViewerAudio.ApplySound(string.Format(SONG_PATH, songid));
|
||||
liveMusic = UmaViewerAudio.ApplySound(string.Format(SONG_PATH, songid), -1);
|
||||
}
|
||||
|
||||
public void Play()
|
||||
@@ -725,6 +717,7 @@ namespace Gallop.Live
|
||||
OnTimelineUpdate(_liveCurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateMainCamera();
|
||||
}
|
||||
}
|
||||
@@ -737,6 +730,11 @@ namespace Gallop.Live
|
||||
}
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
LiveViewerUI.Instance.UpdateLyrics(_liveCurrentTime);
|
||||
}
|
||||
|
||||
DateTime ExitTime;
|
||||
private void ExitLive()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user