Merged changed from Croakfang's branch. (#72)
* merge (#71) * Bug fix, improved UI layout and live vocals * Bug Fixes, New Live Compatibility --------- Co-authored-by: CroakFang <1605296300@qq.com> * recovered shader functions * Fixed texture loading for costume 0015 --------- Co-authored-by: CroakFang <1605296300@qq.com>
This commit is contained in:
@@ -15,7 +15,7 @@ public class CameraOrbit : MonoBehaviour
|
||||
public GameObject CameraTargetHelper;
|
||||
public Vector3 TargetCenter;
|
||||
|
||||
EventSystem eventSystem;
|
||||
public EventSystem eventSystem;
|
||||
bool controlOn;
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ public class CameraOrbit : MonoBehaviour
|
||||
OrbitCamZoomSlider.minValue = camDistMin;
|
||||
OrbitCamZoomSlider.maxValue = camDistMax;
|
||||
|
||||
eventSystem = EventSystem.current;
|
||||
|
||||
lookRotation = transform.localRotation;
|
||||
instance = this;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ public class LiveCharacterSelect : MonoBehaviour
|
||||
public CharaEntry CharaEntry;
|
||||
public string CostumeId;
|
||||
public Image CharaImage;
|
||||
public Image BackGroundImage;
|
||||
public Image CostumeImage;
|
||||
public Text IndexText;
|
||||
|
||||
@@ -22,9 +21,8 @@ public class LiveCharacterSelect : MonoBehaviour
|
||||
{
|
||||
CharaEntry = charaentry;
|
||||
CostumeId = costumeId;
|
||||
CharaImage.enabled = true;
|
||||
CharaImage.sprite = charaentry.Icon;
|
||||
BackGroundImage.enabled = true;
|
||||
BackGroundImage.sprite = charaentry.Icon;
|
||||
CostumeImage.sprite = costumeSprite;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -160,9 +160,9 @@ public class UmaContainerCharacter : UmaContainer
|
||||
//Materials
|
||||
foreach (var rend in gameObject.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
for (int i = 0; i < rend.sharedMaterials.Length; i++)
|
||||
for (int i = 0; i < rend.materials.Length; i++)
|
||||
{
|
||||
Material mat = rend.sharedMaterials[i];
|
||||
Material mat = rend.materials[i];
|
||||
|
||||
var matHlp = Materials.FirstOrDefault(m => m.Mat == mat);
|
||||
if (matHlp == null)
|
||||
@@ -572,7 +572,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
foreach (Renderer r in Body.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
string mainTex = "", toonMap = "", tripleMap = "", optionMap = "", zekkenNumberTex = "";
|
||||
|
||||
@@ -615,7 +615,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
switch (costumeIdShort.Split('_')[0]) //costume ID
|
||||
{
|
||||
case "0001":
|
||||
switch (r.sharedMaterials.ToList().IndexOf(m))
|
||||
switch (r.materials.ToList().IndexOf(m))
|
||||
{
|
||||
case 0:
|
||||
mainTex = $"tex_bdy{costumeIdShort}_00_waku0_diff";
|
||||
@@ -646,13 +646,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
tripleMap = $"tex_bdy{costumeIdShort}_00_0_{bust}_base";
|
||||
optionMap = $"tex_bdy{costumeIdShort}_00_0_{bust}_ctrl";
|
||||
break;
|
||||
case "0006":
|
||||
mainTex = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_diff";
|
||||
toonMap = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_shad_c";
|
||||
tripleMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_base";
|
||||
optionMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_ctrl";
|
||||
break;
|
||||
case "0009":
|
||||
case "0006": case "0009": case "0015":
|
||||
mainTex = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_diff";
|
||||
toonMap = $"tex_bdy{costumeIdLong}_{skin}_{bust}_{"00"}_shad_c";
|
||||
tripleMap = $"tex_bdy{costumeIdLong}_0_{bust}_00_base";
|
||||
@@ -681,7 +675,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
{
|
||||
foreach (Renderer r in Body.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
//BodyAlapha's shader need to change manually.
|
||||
if (m.name.Contains("bdy") && m.name.Contains("Alpha"))
|
||||
@@ -721,7 +715,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
|
||||
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
if (head.name.Contains("mchr"))
|
||||
{
|
||||
@@ -866,7 +860,7 @@ public class UmaContainerCharacter : UmaContainer
|
||||
var textures = MobHeadTextures;
|
||||
foreach (Renderer r in hair.GetComponentsInChildren<Renderer>())
|
||||
{
|
||||
foreach (Material m in r.sharedMaterials)
|
||||
foreach (Material m in r.materials)
|
||||
{
|
||||
|
||||
//Glasses's shader need to change manually.
|
||||
|
||||
@@ -9,6 +9,8 @@ public class UmaViewerAudio
|
||||
{
|
||||
|
||||
static UmaViewerMain Main => UmaViewerMain.Instance;
|
||||
public static int LastAudioPartIndex = -1;
|
||||
|
||||
public struct UmaSoundInfo
|
||||
{
|
||||
public UmaDatabaseEntry awb;
|
||||
@@ -20,7 +22,42 @@ public class UmaViewerAudio
|
||||
public bool enable;
|
||||
public float volume;
|
||||
public float pan;
|
||||
public int cur_active_source = - 1;
|
||||
public AudioSource activeSource;
|
||||
public List<AudioSource> sourceList;
|
||||
|
||||
public void SwitchActiveSource(int index, bool forceUpdate = false)
|
||||
{
|
||||
if (cur_active_source == index && !forceUpdate) return;
|
||||
cur_active_source = index;
|
||||
for(int i = 0; i < sourceList.Count; i++)
|
||||
{
|
||||
if (i + 1 == index)
|
||||
{
|
||||
activeSource = sourceList[i];
|
||||
sourceList[i].volume = volume;
|
||||
sourceList[i].panStereo = pan;
|
||||
}
|
||||
else
|
||||
{
|
||||
sourceList[i].volume = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetVolume(float volume)
|
||||
{
|
||||
if (volume == this.volume || !activeSource) return;
|
||||
this.volume = volume;
|
||||
activeSource.volume = volume;
|
||||
}
|
||||
|
||||
public void SetPanStereo(float pan)
|
||||
{
|
||||
if (pan == this.pan || !activeSource) return;
|
||||
this.pan = pan;
|
||||
activeSource.panStereo = pan;
|
||||
}
|
||||
}
|
||||
|
||||
static public UmaSoundInfo getSoundPath(string name)
|
||||
@@ -96,21 +133,11 @@ public class UmaViewerAudio
|
||||
right3 = 6,
|
||||
}
|
||||
|
||||
public static void ApplyMainVolume(CuteAudioSource sourceList)
|
||||
{
|
||||
foreach (var source in sourceList.sourceList)
|
||||
{
|
||||
source.volume = (sourceList.enable ? sourceList.volume : 0);
|
||||
source.panStereo = sourceList.pan;
|
||||
}
|
||||
}
|
||||
|
||||
static public void AlterUpdate(float _liveCurrentTime, PartEntry partInfo, List<CuteAudioSource> liveVocal)
|
||||
static public void AlterUpdate(float _liveCurrentTime, PartEntry partInfo, List<CuteAudioSource> liveVocal, bool forceUpdate = false)
|
||||
{
|
||||
|
||||
var timeLineData = partInfo.PartSettings["time"];
|
||||
|
||||
//need to improve
|
||||
var targetIndex = 0;
|
||||
for (int i = timeLineData.Count - 1; i >= 0; i--)
|
||||
{
|
||||
@@ -121,32 +148,96 @@ public class UmaViewerAudio
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
string partName = liveVocal[i].tag;
|
||||
if (LastAudioPartIndex == targetIndex) return;
|
||||
LastAudioPartIndex = targetIndex;
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName)){
|
||||
liveVocal[i].enable = partInfo.PartSettings[partName][targetIndex] > 0;
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_vol"))
|
||||
{
|
||||
var volume = partInfo.PartSettings[partName + "_vol"][targetIndex];
|
||||
liveVocal[i].volume = (volume == 999 ? 1 : volume);
|
||||
}
|
||||
|
||||
float volume_rate = 1;
|
||||
if (partInfo.PartSettings.ContainsKey("volume_rate"))
|
||||
{
|
||||
volume_rate = partInfo.PartSettings["volume_rate"][targetIndex];
|
||||
}
|
||||
|
||||
if (volume_rate == 999) //chorus
|
||||
{
|
||||
var activeVocal = new List<CuteAudioSource>();
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
var vocal = liveVocal[i];
|
||||
var partName = vocal.tag;
|
||||
var active_index = (int)partInfo.PartSettings[partName][targetIndex];
|
||||
vocal.SwitchActiveSource(active_index, forceUpdate);
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_pan"))
|
||||
{
|
||||
var pan = partInfo.PartSettings[partName + "_pan"][targetIndex];
|
||||
liveVocal[i].pan = (pan == 999 ? 0 : pan);
|
||||
var part = partInfo.PartSettings[partName + "_pan"];
|
||||
var pan = part[targetIndex];
|
||||
vocal.SetPanStereo(pan == 999 ? 0 : pan);
|
||||
}
|
||||
|
||||
if (active_index > 0)
|
||||
{
|
||||
activeVocal.Add(vocal);
|
||||
}
|
||||
}
|
||||
|
||||
switch(activeVocal.Count)
|
||||
{
|
||||
case 1:
|
||||
activeVocal[0].SetVolume(0.9954f);
|
||||
break;
|
||||
case 2:
|
||||
activeVocal[0].SetVolume(0.7031f);
|
||||
activeVocal[1].SetVolume(0.7031f);
|
||||
break;
|
||||
case 3:
|
||||
activeVocal[0].SetVolume(0.7056f);
|
||||
activeVocal[1].SetVolume(0.56f);
|
||||
activeVocal[1].SetVolume(0.56f);
|
||||
break;
|
||||
default:
|
||||
var per_vol = CalculateApproximateDBValues(0.9954f, activeVocal.Count);
|
||||
activeVocal.ForEach(v => v.SetVolume(per_vol));
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < liveVocal.Count; i++)
|
||||
{
|
||||
var vocal = liveVocal[i];
|
||||
var partName = vocal.tag;
|
||||
var active_index = (int)partInfo.PartSettings[partName][targetIndex];
|
||||
vocal.SwitchActiveSource(active_index, forceUpdate);
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName))
|
||||
{
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_vol"))
|
||||
{
|
||||
var part = partInfo.PartSettings[partName + "_vol"];
|
||||
var volume = part[targetIndex];
|
||||
vocal.SetVolume(volume == 999 ? 0 : volume);
|
||||
}
|
||||
|
||||
if (partInfo.PartSettings.ContainsKey(partName + "_pan"))
|
||||
{
|
||||
var part = partInfo.PartSettings[partName + "_pan"];
|
||||
var pan = part[targetIndex];
|
||||
vocal.SetPanStereo(pan == 999 ? 0 : pan);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach(var cute in liveVocal)
|
||||
{
|
||||
ApplyMainVolume(cute);
|
||||
}
|
||||
static public float CalculateApproximateDBValues(float total_volume, int num_sounds)
|
||||
{
|
||||
var total_db = 15f;
|
||||
var P0 = total_volume * (Math.Pow(10, total_db / 10));
|
||||
var P_per_sound = P0 / num_sounds;
|
||||
var per_volume = 10 * Math.Log10(P_per_sound / total_volume);
|
||||
return (float)(per_volume / total_db);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,6 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
|
||||
public void LoadLiveUma(List<LiveCharacterSelect> characters)
|
||||
{
|
||||
UmaAssetManager.UnloadAllBundle();
|
||||
for (int i = 0; i < characters.Count; i++)
|
||||
{
|
||||
if (characters[i].CharaEntry.Name != "")
|
||||
@@ -666,6 +665,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
Gallop.Live.Director mController = MainLive.GetComponentInChildren<Gallop.Live.Director>();
|
||||
mController.live = live;
|
||||
mController.IsRecordVMD = UI.isRecordVMD;
|
||||
mController.RequireStage = UI.isRequireStage;
|
||||
|
||||
List<GameObject> transferObjs = new List<GameObject>() {
|
||||
MainLive,
|
||||
@@ -678,7 +678,7 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
// Move the GameObject (you attach this in the Inspector) to the newly loaded Scene
|
||||
transferObjs.ForEach(o => SceneManager.MoveGameObjectToScene(o, SceneManager.GetSceneByName("LiveScene")));
|
||||
mController.Initialize();
|
||||
|
||||
|
||||
characters.ForEach(a =>
|
||||
{
|
||||
if (a.CharaEntry == null || a.CostumeId == "")
|
||||
@@ -687,8 +687,18 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
a.CostumeId = "0002_00_00";
|
||||
}
|
||||
});//fill empty
|
||||
|
||||
|
||||
var actual_member_count = mController._liveTimelineControl.data.worksheetList[0].charaMotSeqList.Count;
|
||||
if (actual_member_count > characters.Count)
|
||||
{
|
||||
Debug.LogWarning($"actual member count is {actual_member_count} current {characters.Count}");
|
||||
var actual_characters = new List<LiveCharacterSelect>();
|
||||
for (int i = 0; i < actual_member_count; i++)
|
||||
{
|
||||
actual_characters.Add(characters[i % characters.Count]);
|
||||
}
|
||||
characters = actual_characters;
|
||||
}
|
||||
LoadLiveUma(characters);
|
||||
|
||||
var Lyrics = LoadLiveLyrics(live.MusicId);
|
||||
@@ -735,8 +745,19 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(UmaDatabaseEntry SongAwb, int subindex = -1)
|
||||
public void loadLivePreviewSound(int songid)
|
||||
{
|
||||
string nameVar = $"snd_bgm_live_{songid}_preview_02";
|
||||
UmaDatabaseEntry previewAwb = Main.AbSounds.FirstOrDefault(a => a.Name.Contains(nameVar) && a.Name.EndsWith("awb"));
|
||||
if (previewAwb != null)
|
||||
{
|
||||
PlaySound(previewAwb, volume : 0.4f, loop : true);
|
||||
}
|
||||
}
|
||||
|
||||
public void PlaySound(UmaDatabaseEntry SongAwb, int subindex = -1, float volume = 1, bool loop = false)
|
||||
{
|
||||
CurrentLyrics.Clear();
|
||||
if (CurrentAudioSources.Count > 0)
|
||||
{
|
||||
var tmp = CurrentAudioSources[0];
|
||||
@@ -748,17 +769,17 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
{
|
||||
foreach (AudioClip clip in LoadAudio(SongAwb))
|
||||
{
|
||||
AddAudioSource(clip);
|
||||
AddAudioSource(clip, volume, loop);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
AddAudioSource(LoadAudio(SongAwb)[subindex]);
|
||||
AddAudioSource(LoadAudio(SongAwb)[subindex], volume, loop);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void AddAudioSource(AudioClip clip)
|
||||
private void AddAudioSource(AudioClip clip, float volume = 1, bool loop = false)
|
||||
{
|
||||
AudioSource source;
|
||||
if (CurrentAudioSources.Count > 0)
|
||||
@@ -771,6 +792,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
}
|
||||
CurrentAudioSources.Add(source);
|
||||
source.clip = clip;
|
||||
source.volume = volume;
|
||||
source.loop = loop;
|
||||
source.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ using System.Text;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.Networking.Types;
|
||||
using UnityEngine.UI;
|
||||
using static PageManager;
|
||||
using Debug = UnityEngine.Debug;
|
||||
@@ -142,6 +143,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
[Header("Live")]
|
||||
public bool LiveTime = false;
|
||||
public bool isRecordVMD;
|
||||
public bool isRequireStage = true;
|
||||
public Dropdown LiveRecoedToggle;
|
||||
public int LiveMode = 1;
|
||||
|
||||
@@ -152,7 +154,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
private void Awake()
|
||||
{
|
||||
Instance = this;
|
||||
AudioPlayButton.onClick.AddListener(AudioPause);
|
||||
AudioPlayButton.onClick.AddListener(PauseAudio);
|
||||
AudioSlider.onValueChanged.AddListener(AudioProgressChange);
|
||||
AnimationPlayButton.onClick.AddListener(AnimationPause);
|
||||
AnimationSlider.onValueChanged.AddListener(AnimationProgressChange);
|
||||
@@ -243,8 +245,11 @@ public class UmaViewerUI : MonoBehaviour
|
||||
public void LoadedAssetsClear()
|
||||
{
|
||||
LoadedAssetEntries.Clear();
|
||||
LoadedAssetPageCtrl.ResetCtrl();
|
||||
LoadedAssetPageCtrl.Initialize(LoadedAssetEntries.Values.ToList(), LoadedAssetScrollRect);
|
||||
if (LoadedAssetPageCtrl)
|
||||
{
|
||||
LoadedAssetPageCtrl.ResetCtrl();
|
||||
LoadedAssetPageCtrl.Initialize(LoadedAssetEntries.Values.ToList(), LoadedAssetScrollRect);
|
||||
}
|
||||
}
|
||||
|
||||
public void CopyAllLoadedAssetsPath()
|
||||
@@ -555,7 +560,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
foreach (var live in Main.Lives.OrderBy(c => c.MusicId))
|
||||
{
|
||||
createContainer(live, UmaContainerLivePrefab, LiveList, () => ShowLiveSelectPannel(live));
|
||||
createContainer(live, UmaContainerLivePrefab, LiveList, () => ShowLiveSelectPanel(live));
|
||||
createContainer(live, UmaContainerLivePrefab, LiveSoundList, () => ListLiveSounds(live.MusicId));
|
||||
}
|
||||
}
|
||||
@@ -627,9 +632,10 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
void ShowLiveSelectPannel(LiveEntry entry)
|
||||
void ShowLiveSelectPanel(LiveEntry entry)
|
||||
{
|
||||
LiveSelectPannel.SetActive(true);
|
||||
Builder.loadLivePreviewSound(entry.MusicId);
|
||||
for (int i = LiveSelectList.content.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(LiveSelectList.content.GetChild(i).gameObject);
|
||||
@@ -649,7 +655,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
chara.SelectChara(this);
|
||||
foreach (var t in LiveSelectList.content.GetComponentsInChildren<LiveCharacterSelect>())
|
||||
{
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.white : Color.black);
|
||||
t.GetComponentInChildren<Text>().color = (t == chara ? Color.green : Color.black);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1090,7 +1096,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
Builder.CurrentUMAContainer?.SetFaceOverrideData(isOn);
|
||||
}
|
||||
|
||||
public void AudioPause()
|
||||
public void PauseAudio()
|
||||
{
|
||||
var sources = Builder.CurrentAudioSources;
|
||||
if (sources.Count > 0)
|
||||
@@ -1115,15 +1121,25 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void StopAudio()
|
||||
{
|
||||
var sources = Builder.CurrentAudioSources;
|
||||
foreach (AudioSource source in sources)
|
||||
{
|
||||
source.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public void AudioProgressChange(float val)
|
||||
{
|
||||
if (Builder.CurrentAudioSources.Count > 0)
|
||||
{
|
||||
var time = Builder.CurrentAudioSources[0].clip.length * val;
|
||||
foreach (AudioSource source in Builder.CurrentAudioSources)
|
||||
{
|
||||
if (source.clip)
|
||||
{
|
||||
source.time = source.clip.length * val;
|
||||
source.time = Mathf.Clamp(time, 0, source.clip.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1396,6 +1412,8 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
public void SetLiveRecordMode(bool val) { isRecordVMD = val; }
|
||||
|
||||
public void SetLiveRequireStage(bool val) { isRequireStage = val; }
|
||||
|
||||
public void ShowMessage(string msg, UIMessageType type)
|
||||
{
|
||||
MessageText.text += type switch
|
||||
|
||||
@@ -87,7 +87,6 @@ namespace Gallop
|
||||
bool isTail = gameObject.name.Contains("tail");//The tail needs less traction
|
||||
var dynamic = bone.gameObject.AddComponent<DynamicBone>();
|
||||
dynamic.m_Root = bone;
|
||||
dynamic.m_UpdateMode = DynamicBone.UpdateMode.Normal;
|
||||
dynamic.m_Gravity = new Vector3(0, Mathf.Clamp01(-30 / spring._gravity), 0);
|
||||
dynamic.m_LimitAngel_Min = spring._limitAngleMin;
|
||||
dynamic.m_LimitAngel_Max = spring._limitAngleMax;
|
||||
|
||||
@@ -1242,7 +1242,7 @@ namespace Gallop
|
||||
public static float CalcMorphWeight(float time, int speed, int interFrame, InterpolateType interType, LiveTimelineKey curKey, LiveTimelineKey nextKey)
|
||||
{
|
||||
|
||||
float keyTime = (float)curKey.frame / 60;
|
||||
float keyTime = (float)curKey.FrameSecond;
|
||||
|
||||
switch (speed)
|
||||
{
|
||||
|
||||
@@ -75,6 +75,8 @@ namespace Gallop.Live.Cutt
|
||||
_tempAnim.AddClip(key.clip, key.clip.name);
|
||||
}
|
||||
}
|
||||
_tempAnim.wrapMode = WrapMode.Clamp;
|
||||
_tempAnim.enabled = false;
|
||||
}
|
||||
|
||||
public void AlterUpdate(float currentTime)
|
||||
@@ -108,39 +110,24 @@ namespace Gallop.Live.Cutt
|
||||
LiveTimelineKeyCharaMotionData arg = curKey.key as LiveTimelineKeyCharaMotionData;
|
||||
AnimationClip anim = arg.clip;
|
||||
|
||||
if ((curKey != null && _curIndex != -1 && _curIndex != _prevIndex) || Director.instance.sliderControl.is_Touched || Director.instance._syncTime == false || director.IsRecordVMD)
|
||||
double start;
|
||||
if (arg.isMotionHeadFrameAll)
|
||||
{
|
||||
|
||||
double start;
|
||||
if(arg.isMotionHeadFrameAll)
|
||||
{
|
||||
start = (double)arg.motionHeadFrame / 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (double)arg.motionHeadFrameSeparetes[charaIndex] / 60;
|
||||
}
|
||||
double interval = currentTime - (double)arg.frame / 60;
|
||||
start = (double)arg.motionHeadFrame / 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
start = (double)arg.motionHeadFrameSeparetes[charaIndex] / 60;
|
||||
}
|
||||
double interval = (currentTime - arg.FrameSecond) * arg.playSpeed;
|
||||
float currentAnimationTime = (float)(start + interval);
|
||||
|
||||
_tempAnim.wrapMode = (arg.loop ? WrapMode.Loop : WrapMode.Default);
|
||||
_tempAnim[anim.name].time = (float)(start + interval);
|
||||
|
||||
if (Mathf.Abs(_prevFrameAnimationTime - currentTime) < 0.01f && Director.instance.sliderControl.is_Touched)
|
||||
{
|
||||
if (_tempAnim.IsPlaying(anim.name))
|
||||
{
|
||||
_tempAnim.Stop();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_tempAnim.Play(anim.name);
|
||||
}
|
||||
}
|
||||
else if (!_tempAnim.IsPlaying(anim.name))
|
||||
{
|
||||
_tempAnim.Play(anim.name);
|
||||
}
|
||||
var state = _tempAnim[anim.name];
|
||||
state.enabled = true;
|
||||
state.weight = 1;
|
||||
state.time = arg.loop ? Mathf.Repeat(currentAnimationTime, state.length) : currentAnimationTime;
|
||||
_tempAnim.Sample();
|
||||
state.enabled = false;
|
||||
|
||||
_prevIndex = _curIndex;
|
||||
}
|
||||
|
||||
@@ -254,7 +254,7 @@ namespace Gallop.Live.Cutt
|
||||
{
|
||||
for (int i = thisList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
if (currentTime >= (double)thisList[i].frame / 60)
|
||||
if (currentTime >= thisList[i].FrameSecond)
|
||||
{
|
||||
thisTimeKeyIndex.index = i;
|
||||
thisTimeKeyIndex.key = thisList[i];
|
||||
@@ -285,7 +285,7 @@ namespace Gallop.Live.Cutt
|
||||
{
|
||||
if (thisTimeKeyIndex.nextKey != null)
|
||||
{
|
||||
if (currentTime >= (double)thisTimeKeyIndex.nextKey.frame / 60)
|
||||
if (currentTime >= thisTimeKeyIndex.nextKey.FrameSecond)
|
||||
{
|
||||
thisTimeKeyIndex.index++;
|
||||
thisTimeKeyIndex.key = thisList[thisTimeKeyIndex.index];
|
||||
@@ -602,6 +602,19 @@ namespace Gallop.Live.Cutt
|
||||
{
|
||||
public int frame;
|
||||
public LiveTimelineKeyAttribute attribute;
|
||||
|
||||
private double _framesecond = -999;
|
||||
|
||||
public double FrameSecond {
|
||||
get{
|
||||
if (_framesecond == -999)
|
||||
{
|
||||
_framesecond = (double)frame / 60;
|
||||
}
|
||||
return _framesecond;
|
||||
}
|
||||
set => _framesecond = value;
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
|
||||
@@ -20,22 +20,21 @@ namespace Gallop.Live.Cyalume
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (CyalumeMaterial == null)
|
||||
return;
|
||||
if (passedtime >= intervaltime)
|
||||
{
|
||||
y_offset += (float)0.03125;
|
||||
if(y_offset >= 1.0f)
|
||||
if (y_offset >= 1.0f)
|
||||
{
|
||||
y_offset = 0.0f;
|
||||
}
|
||||
CyalumeMaterial.SetTextureOffset("_MainTex", new Vector2(0, y_offset));
|
||||
passedtime = 0;
|
||||
}
|
||||
passedtime += Time.deltaTime;
|
||||
//Debug.Log(CyalumeMaterial);
|
||||
//Debug.Log(passedtime);
|
||||
|
||||
passedtime += Time.fixedDeltaTime;
|
||||
}
|
||||
|
||||
public void InitializeCyalume()
|
||||
@@ -47,7 +46,7 @@ namespace Gallop.Live.Cyalume
|
||||
GameObject tempObj = Instantiate((GameObject)obj.Value, transform);
|
||||
if (obj.Value.name.Contains("cyalume")){
|
||||
CyalumeObj = tempObj;
|
||||
CyalumeMaterial = gameObject.GetComponentInChildren<MeshRenderer>().sharedMaterial;
|
||||
CyalumeMaterial = gameObject.GetComponentInChildren<MeshRenderer>().material;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ namespace Gallop.Live
|
||||
|
||||
public bool IsRecordVMD;
|
||||
|
||||
public bool RequireStage = true;
|
||||
|
||||
public Transform MainCameraTransform => _mainCameraTransform;
|
||||
|
||||
private Transform _mainCameraTransform;
|
||||
@@ -97,9 +99,12 @@ namespace Gallop.Live
|
||||
{
|
||||
_instance = this;
|
||||
Debug.Log(string.Format(CUTT_PATH, live.MusicId));
|
||||
Debug.Log(live.BackGroundId);
|
||||
Builder.LoadAssetPath(string.Format(CUTT_PATH, live.MusicId), transform);
|
||||
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), transform);
|
||||
if (RequireStage)
|
||||
{
|
||||
Debug.Log(live.BackGroundId);
|
||||
Builder.LoadAssetPath(string.Format(STAGE_PATH, live.BackGroundId), transform);
|
||||
}
|
||||
|
||||
//Make CharacterObject
|
||||
|
||||
@@ -128,6 +133,7 @@ namespace Gallop.Live
|
||||
|
||||
//Get live parts info
|
||||
UmaDatabaseEntry partAsset = UmaViewerMain.Instance.AbList[string.Format(LIVE_PART_PATH, live.MusicId)];
|
||||
UmaViewerAudio.LastAudioPartIndex = -1;
|
||||
|
||||
Debug.Log(partAsset.Name);
|
||||
|
||||
@@ -352,7 +358,7 @@ namespace Gallop.Live
|
||||
_liveTimelineControl.AlterUpdate(_liveCurrentTime);
|
||||
if (!_soloMode)
|
||||
{
|
||||
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal);
|
||||
UmaViewerAudio.AlterUpdate(_liveCurrentTime, partInfo, liveVocal, sliderControl.is_Outed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user