Merge branch 'master' of https://github.com/croakfang/UmaViewer
This commit is contained in:
@@ -28,6 +28,12 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public UmaHeadData CurrentHead;
|
||||
|
||||
public Shader hairShader;
|
||||
public Shader faceShader;
|
||||
public Shader eyeShader;
|
||||
public Shader cheekShader;
|
||||
public Shader eyebrowShader;
|
||||
|
||||
public List<AudioSource> CurrentAudioSources = new List<AudioSource>();
|
||||
public List<UmaLyricsData> CurrentLyrics = new List<UmaLyricsData>();
|
||||
|
||||
@@ -606,8 +612,19 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
{
|
||||
if (bundle.name == "shader.a")
|
||||
{
|
||||
if (Main.ShadersLoaded) return;
|
||||
else Main.ShadersLoaded = true;
|
||||
if (Main.ShadersLoaded)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
hairShader = (Shader)bundle.LoadAsset("assets/_gallop/resources/shader/3d/character/charactertoonhairtser.shader");
|
||||
faceShader = (Shader)bundle.LoadAsset("assets/_gallop/resources/shader/3d/character/charactertoonfacetser.shader");
|
||||
eyeShader = (Shader)bundle.LoadAsset("assets/_gallop/resources/shader/3d/character/charactertooneyet.shader");
|
||||
cheekShader = (Shader)bundle.LoadAsset("assets/_gallop/resources/shader/3d/character/charactermultiplycheek.shader");
|
||||
eyebrowShader = (Shader)bundle.LoadAsset("assets/_gallop/resources/shader/3d/character/charactertoonmayu.shader");
|
||||
Main.ShadersLoaded = true;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (string name in bundle.GetAllAssetNames())
|
||||
@@ -817,19 +834,25 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
switch (m.shader.name)
|
||||
{
|
||||
case "Gallop/3D/Chara/MultiplyCheek":
|
||||
m.shader = cheekShader;
|
||||
m.CopyPropertiesFromMaterial(TransMaterialCharas);
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonFace/TSER":
|
||||
m.shader = faceShader;
|
||||
m.SetFloat("_CylinderBlend", 0.25f);
|
||||
m.SetColor("_RimColor", new Color(0, 0, 0, 0));
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonEye/T":
|
||||
m.shader = eyeShader;
|
||||
m.SetFloat("_CylinderBlend", 0.25f);
|
||||
break;
|
||||
case "Gallop/3D/Chara/ToonHair/TSER":
|
||||
m.shader = hairShader;
|
||||
m.SetFloat("_CylinderBlend", 0.25f);
|
||||
break;
|
||||
|
||||
case "Gallop/3D/Chara/ToonMayu":
|
||||
m.shader = eyebrowShader;
|
||||
break;
|
||||
default:
|
||||
Debug.Log(m.shader.name);
|
||||
// m.shader = Shader.Find("Nars/UmaMusume/Body");
|
||||
|
||||
@@ -580,10 +580,12 @@ public class UmaViewerUI : MonoBehaviour
|
||||
if (animator != null)
|
||||
{
|
||||
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
||||
|
||||
// Pause and Seek;
|
||||
Builder.CurrentUMAContainer.UmaAnimator.speed = 0;
|
||||
animator.Play(0, -1, val);
|
||||
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToTimeFormat(val * AnimeClip.length), ToTimeFormat(AnimeClip.length));
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(val * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -613,13 +615,16 @@ public class UmaViewerUI : MonoBehaviour
|
||||
{
|
||||
if(Builder.CurrentUMAContainer.OverrideController["clip_2"].name != "clip_2")
|
||||
{
|
||||
bool isLoop = Builder.CurrentUMAContainer.OverrideController["clip_2"].name.EndsWith("_loop");
|
||||
var AnimeState = Builder.CurrentUMAContainer.UmaAnimator.GetCurrentAnimatorStateInfo(0);
|
||||
var AnimeClip = Builder.CurrentUMAContainer.OverrideController["clip_2"];
|
||||
if (AnimeClip && Builder.CurrentUMAContainer.UmaAnimator.speed != 0)
|
||||
{
|
||||
var normalizedTime = (isLoop) ? Mathf.Repeat(AnimeState.normalizedTime, 1) : Mathf.Min(AnimeState.normalizedTime, 1);
|
||||
|
||||
AnimationTitleText.text = AnimeClip.name;
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToTimeFormat(Mathf.Repeat(AnimeState.normalizedTime, 1) * AnimeClip.length), ToTimeFormat(AnimeClip.length));
|
||||
AnimationSlider.SetValueWithoutNotify(Mathf.Repeat(AnimeState.normalizedTime, 1));
|
||||
AnimationProgressText.text = string.Format("{0} / {1}", ToFrameFormat(normalizedTime * AnimeClip.length, AnimeClip.frameRate), ToFrameFormat(AnimeClip.length, AnimeClip.frameRate));
|
||||
AnimationSlider.SetValueWithoutNotify(normalizedTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -643,6 +648,15 @@ public class UmaViewerUI : MonoBehaviour
|
||||
return string.Format("{0:D2}:{1:D2}:{2:D2}", hour, minute, seconds);
|
||||
}
|
||||
|
||||
public static string ToFrameFormat(float time, float frameRate)
|
||||
{
|
||||
int frames = Mathf.FloorToInt(time % 1 * frameRate);
|
||||
int seconds = (int)time;
|
||||
int minute = seconds % 3600 / 60;
|
||||
seconds = seconds % 3600 % 60;
|
||||
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--)
|
||||
|
||||
Reference in New Issue
Block a user