diff --git a/Assets/Scripts/Manifest/ManifestDB.cs b/Assets/Scripts/Manifest/ManifestDB.cs index d642764..f33dafd 100644 --- a/Assets/Scripts/Manifest/ManifestDB.cs +++ b/Assets/Scripts/Manifest/ManifestDB.cs @@ -248,7 +248,6 @@ public class ManifestDB Debug.LogError("ReadLineError"); return null; } - } else { @@ -290,6 +289,8 @@ public class ManifestDB else { Debug.LogError("Download Manifest Failed :" + www.error); + callback?.Invoke($"Download Manifest Failed :{www.error},Update aborted"); + yield break; } } diff --git a/Assets/Scripts/UmaContainer.cs b/Assets/Scripts/UmaContainer.cs index f5ee50c..2563acf 100644 --- a/Assets/Scripts/UmaContainer.cs +++ b/Assets/Scripts/UmaContainer.cs @@ -31,6 +31,7 @@ public class UmaContainer : MonoBehaviour [Header("Face")] public FaceDrivenKeyTarget FaceDrivenKeyTarget; public FaceEmotionKeyTarget FaceEmotionKeyTarget; + public FaceOverrideData FaceOverrideData; public GameObject HeadBone; public GameObject TrackTarget; public float EyeHeight; @@ -71,6 +72,10 @@ public class UmaContainer : MonoBehaviour public List cySpringDataContainers; public GameObject PhysicsContainer; public float BodyScale = 1; + + [Header("Other")] + public CharaShaderEffectData ShaderEffectData; + public void Initialize() { TrackTarget = Camera.main.gameObject; diff --git a/Assets/Scripts/UmaViewerBuilder.cs b/Assets/Scripts/UmaViewerBuilder.cs index f86d4a7..80b25f6 100644 --- a/Assets/Scripts/UmaViewerBuilder.cs +++ b/Assets/Scripts/UmaViewerBuilder.cs @@ -347,9 +347,11 @@ public class UmaViewerBuilder : MonoBehaviour var firsehead = CurrentUMAContainer.Head; var faceDriven = firsehead.GetComponent()._assetTable["facial_target"] as FaceDrivenKeyTarget; var earDriven = firsehead.GetComponent()._assetTable["ear_target"] as DrivenKeyTarget; + var faceOverride = firsehead.GetComponent()._assetTable["face_override"] as FaceOverrideData; faceDriven._earTarget = earDriven._targetFaces; CurrentUMAContainer.FaceDrivenKeyTarget = faceDriven; CurrentUMAContainer.FaceDrivenKeyTarget.Container = CurrentUMAContainer; + CurrentUMAContainer.FaceOverrideData = faceOverride; faceDriven.DrivenKeyLocator = locator.transform; faceDriven.Initialize(firsehead.GetComponentsInChildren().ToList()); @@ -633,9 +635,11 @@ public class UmaViewerBuilder : MonoBehaviour var firsehead = CurrentUMAContainer.Head; var faceDriven = firsehead.GetComponent()._assetTable["facial_target"] as FaceDrivenKeyTarget; var earDriven = firsehead.GetComponent()._assetTable["ear_target"] as DrivenKeyTarget; + var faceOverride = firsehead.GetComponent()._assetTable["face_override"] as FaceOverrideData; faceDriven._earTarget = earDriven._targetFaces; CurrentUMAContainer.FaceDrivenKeyTarget = faceDriven; CurrentUMAContainer.FaceDrivenKeyTarget.Container = CurrentUMAContainer; + CurrentUMAContainer.FaceOverrideData = faceOverride; faceDriven.DrivenKeyLocator = locator.transform; faceDriven.Initialize(firsehead.GetComponentsInChildren().ToList()); @@ -777,8 +781,6 @@ public class UmaViewerBuilder : MonoBehaviour a.CostumeId = "00"; } });//fill empty - - } //Use CriWare Library @@ -1394,6 +1396,13 @@ public class UmaViewerBuilder : MonoBehaviour } } } + + //shader effect + CurrentUMAContainer.ShaderEffectData = head.GetComponent()._assetTable["chara_shader_effect"] as CharaShaderEffectData; + if (CurrentUMAContainer.ShaderEffectData) + { + CurrentUMAContainer.ShaderEffectData.Initialize(); + } } private void LoadHair(GameObject go) diff --git a/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs b/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs new file mode 100644 index 0000000..88d321e --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs @@ -0,0 +1,44 @@ +using System; +using UnityEngine; + +namespace Gallop +{ + [Serializable] + public class CharaShaderEffectData : ScriptableObject + { + [SerializeField] + private SettingData[] _settingDataArray; + + [Serializable] + public class SettingData + { + public EffectType Type; + public Material TargetMaterial; + public int[] ParamArray; + public AnimationCurve[] ParamCurveArray; + } + + public enum EffectType + { + UVScrollEmissive = 0, + ReflectionMap = 1 + } + + public void Initialize() + { + foreach(var settingData in _settingDataArray) + { + if (settingData.TargetMaterial) + { + var mat = settingData.TargetMaterial; + if (settingData.Type == EffectType.UVScrollEmissive) + { + var p = settingData.ParamArray; + mat.SetVector("_UVEmissiveScroll", new Vector4(p[0], p[1], p[2],p[3])); + mat.SetVector("_UVEmissiveRange", new Vector4(p[4], p[5], p[6], p[7])); + } + } + } + } + } +} diff --git a/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs.meta b/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs.meta new file mode 100644 index 0000000..d580f00 --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/CharaShaderEffectData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c646073cb80c388489345c22e65f9425 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs b/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs new file mode 100644 index 0000000..eb30285 --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace Gallop +{ + public class CharaTransformProcessData : ScriptableObject + { + + } +} diff --git a/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs.meta b/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs.meta new file mode 100644 index 0000000..0b9663b --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/CharaTransformProcessData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ad24e221a99993948ae4740c38a0a377 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs index 035e01b..4bac739 100644 --- a/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs +++ b/Assets/Scripts/umamusume/Gallop/FaceDrivenKeyTarget.cs @@ -35,6 +35,8 @@ namespace Gallop Dictionary RotationRecorder = new Dictionary(); Dictionary ParticleRecorder = new Dictionary(); + List leftEyeMorph = new List(); + List rightEyeMorph = new List(); public void Initialize(List objs) { Objs = objs; @@ -53,6 +55,7 @@ namespace Gallop for (int j = 0; j < _earTarget[i]._faceGroupInfo.Count; j++) { FacialMorph morph = new FacialMorph(); + morph.index = i; morph.direction = j > 0; morph.name = "Ear_" + i + "_" + (morph.direction ? "L" : "R"); morph.tag = Enum.GetName(typeof(EarType), i); @@ -84,6 +87,7 @@ namespace Gallop for (int j = 0; j < _eyebrowTarget[i]._faceGroupInfo.Count; j++) { FacialMorph morph = new FacialMorph(); + morph.index = i; morph.direction = j > 0; morph.name = "EyeBrow_" + i + "_" + (morph.direction ? "L" : "R"); morph.tag = Enum.GetName(typeof(LiveTimelineDefine.FacialEyebrowId), i); @@ -109,6 +113,7 @@ namespace Gallop for (int j = 0; j < _eyeTarget[i]._faceGroupInfo.Count; j++) { FacialMorph morph = new FacialMorph(); + morph.index = i; morph.direction = j > 0; morph.name = "Eye_" + i + "_" + (morph.direction ? "L" : "R"); morph.tag = Enum.GetName(typeof(LiveTimelineDefine.FacialEyeId), i); @@ -134,7 +139,11 @@ namespace Gallop if (morph.direction) LeftEyeYrange = morph; else RightEyeYrange = morph; } - + else + { + if (morph.direction) leftEyeMorph.Add(morph); + else rightEyeMorph.Add(morph); + } EyeMorphs.Add(morph); } } @@ -145,6 +154,7 @@ namespace Gallop for (int j = 0; j < _mouthTarget[i]._faceGroupInfo.Count; j++) { FacialMorph morph = new FacialMorph(); + morph.index = i; morph.direction = j > 0; morph.name = "Mouth_" + i + "_" + j; morph.tag = Enum.GetName(typeof(LiveTimelineDefine.FacialMouthId), i); @@ -443,6 +453,7 @@ namespace Gallop public void FacialResetAll() { + FacialReset(BaseLEarMorph.trsArray); FacialReset(BaseREarMorph.trsArray); FacialReset(BaseLEyeBrowMorph.trsArray); @@ -451,6 +462,10 @@ namespace Gallop FacialReset(BaseREyeMorph.trsArray); FacialReset(BaseMouthMorph.trsArray); ApplyRotation(); + if (Container.FaceOverrideData) + { + OverrideFace(Container.FaceOverrideData); + } } public void FacialReset(List trsArrays) @@ -565,6 +580,59 @@ namespace Gallop ProcessLocator(); ChangeMorph(); } + + public void OverrideFace(FaceOverrideData overrideData) + { + Action, FaceOverrideReplaceDataSet[]> action = delegate (List morphs, FaceOverrideReplaceDataSet[] datalist) + { + foreach (var data in datalist) + { + if (data.IsOnlyBaseReplace) + { + if (morphs.Find(m => m.weight > 0) == null) + { + GetMorphByType(morphs, data.BaseReplaceFaceType).weight = 1; + } + else + { + GetMorphByType(morphs, data.BaseReplaceFaceType).weight = 0; + } + } + + foreach (var arr in data.DataArray) + { + bool changed = false; + foreach(var src in arr.SrcArray) + { + if (src == LiveTimelineDefine.FacialEyeId.Base) continue; + var srcmorph = GetMorphByType(morphs, src); + if (srcmorph.weight > 0 && !changed) + { + changed = true; + foreach (var dst in arr.DstArray) + { + GetMorphByType(morphs, dst.Index).weight = Mathf.Lerp(0, dst.Weight, srcmorph.weight); + } + } + srcmorph.weight = 0; + } + } + } + }; + + if (overrideData.IsBothEyesSetting) + { + action.Invoke(leftEyeMorph, overrideData.FaceOverrideArray); + action.Invoke(rightEyeMorph, overrideData.FaceOverrideArray); + } + + + } + + public FacialMorph GetMorphByType(List morphs, LiveTimelineDefine.FacialEyeId Type) + { + return morphs.Find(m => m.index == (int)Type); + } } } diff --git a/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs b/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs new file mode 100644 index 0000000..0ce62f2 --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs @@ -0,0 +1,23 @@ +using System; +using UnityEngine; + +namespace Gallop +{ + [Serializable] + public class FaceOverrideData : ScriptableObject + { + private readonly string[] OverrideTypeText; + public bool IsBothEyesSetting; + public bool IsDisableEyeBlink; + public FaceOverrideReplaceDataSet[] FaceOverrideArray; + + public enum OverrideType + { + Invalid = -1, + RightEye = 0, + LeftEye = 1, + Max = 2 + } + } +} + diff --git a/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs.meta b/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs.meta new file mode 100644 index 0000000..d5621f0 --- /dev/null +++ b/Assets/Scripts/umamusume/Gallop/FaceOverrideData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8f48d3d928b991543b1454bfaabf7259 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/umamusume/Gallop/FacialMorph.cs b/Assets/Scripts/umamusume/Gallop/FacialMorph.cs index ccc65ca..70dc215 100644 --- a/Assets/Scripts/umamusume/Gallop/FacialMorph.cs +++ b/Assets/Scripts/umamusume/Gallop/FacialMorph.cs @@ -10,6 +10,7 @@ namespace Gallop [System.Serializable] public class FacialMorph { + public int index; public string name; public string tag = ""; public bool direction; diff --git a/Assets/Scripts/umamusume/GallopExtras.cs b/Assets/Scripts/umamusume/GallopExtras.cs index 3abcb38..03273f2 100644 --- a/Assets/Scripts/umamusume/GallopExtras.cs +++ b/Assets/Scripts/umamusume/GallopExtras.cs @@ -1,9 +1,10 @@ -using Unity; using System.Collections.Generic; using UnityEngine; using static DynamicBone; +using System; +using Object = UnityEngine.Object; -[System.Serializable] +[Serializable] public class AssetTable { public Object this[string key] @@ -26,7 +27,7 @@ public class AssetTable } -[System.Serializable] +[Serializable] public class AssetTableValue { public float this[string key] @@ -48,21 +49,21 @@ public class AssetTableValue } -[System.Serializable] +[Serializable] public class StringObjectPair { public string Key; public Object Value; } -[System.Serializable] +[Serializable] public class StringValuePair { public string Key; public float Value; } -[System.Serializable] +[Serializable] public class TrsArray { public string _path; @@ -82,38 +83,38 @@ public class TrsArray } } -[System.Serializable] +[Serializable] public class FaceGroupInfo { public List _trsArray; } -[System.Serializable] +[Serializable] public class EyeTarget { public List _faceGroupInfo; } -[System.Serializable] +[Serializable] public class EyebrowTarget { public List _faceGroupInfo; } -[System.Serializable] +[Serializable] public class MouthTarget { public List _faceGroupInfo; } -[System.Serializable] +[Serializable] public class TargetInfomation { public List _faceGroupInfo; } -[System.Serializable] +[Serializable] public class ConnectedBoneData { public string Bone1; @@ -121,3 +122,27 @@ public class ConnectedBoneData public float Intensity; public bool IsFold; } + + +[Serializable] +public class FaceOverrideReplaceDataSet +{ + public bool IsOnlyBaseReplace; + public Gallop.Live.Cutt.LiveTimelineDefine.FacialEyeId BaseReplaceFaceType; + public FaceOverrideReplaceData[] DataArray; +} + +[Serializable] +public class FaceOverrideReplaceData +{ + public Gallop.Live.Cutt.LiveTimelineDefine.FacialEyeId[] SrcArray; + public FaceOverrideElement[] DstArray; +} + +[Serializable] +public class FaceOverrideElement +{ + public Gallop.Live.Cutt.LiveTimelineDefine.FacialEyeId Index; + public float Weight; +} + diff --git a/Assets/Scripts/umamusume/IK.meta b/Assets/Scripts/umamusume/IK.meta new file mode 100644 index 0000000..2f74df2 --- /dev/null +++ b/Assets/Scripts/umamusume/IK.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 18af0e9423bc204488746a0cfbdf8a99 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/umamusume/IK/IKCollisionData.cs b/Assets/Scripts/umamusume/IK/IKCollisionData.cs new file mode 100644 index 0000000..c6e8f35 --- /dev/null +++ b/Assets/Scripts/umamusume/IK/IKCollisionData.cs @@ -0,0 +1,47 @@ +using System; +using UnityEngine; + +namespace IK +{ + public class IKCollisionData : ScriptableObject + { + public Parameter[] ParameterArray; + public bool IsHeightScale; + public struct RuntimeParameter + { + public Parameter.CollisionType Type; + public Vector3 Offset; + public bool IsBodyScale; + public float Param1; + + public float Radius { get; } + } + + [Serializable] + public class Parameter + { + public CollisionType Type; + public string LinkBoneName; + public Vector3 Offset; + public Scene SceneType; + public float Param1; + + public enum CollisionType + { + Sphere = 0 + } + + public enum Scene + { + Event = 1, + Live = 2, + All = 65535 + } + } + } + + +} + + + diff --git a/Assets/Scripts/umamusume/IK/IKCollisionData.cs.meta b/Assets/Scripts/umamusume/IK/IKCollisionData.cs.meta new file mode 100644 index 0000000..114cf9c --- /dev/null +++ b/Assets/Scripts/umamusume/IK/IKCollisionData.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4a1187d9f807ff846bde338c226f3450 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: