add simple live mode
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -342,6 +342,8 @@ namespace Gallop.Live
|
||||
public int characterCount = 0;
|
||||
public int allowCount = 0;
|
||||
|
||||
public int liveMode = 0;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (live != null)
|
||||
@@ -379,9 +381,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 +426,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++)
|
||||
@@ -525,7 +528,7 @@ namespace Gallop.Live
|
||||
else
|
||||
{
|
||||
_liveCurrentTime += Time.deltaTime;
|
||||
//Debug.Log(_liveCurrentTime * 60);
|
||||
Debug.Log(_liveCurrentTime * 60);
|
||||
OnTimelineUpdate(_liveCurrentTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user