Commit 40fcb4df authored by SherryChaos's avatar SherryChaos

add loop break for LoopTrack

parent 3f2d86c1
......@@ -1464,6 +1464,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4896299765901075}
- component: {fileID: -387253940381332063}
- component: {fileID: 114616308496331425}
- component: {fileID: 320369927042751078}
m_Layer: 0
......@@ -1489,6 +1490,18 @@ Transform:
- {fileID: 4384957410883823}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -0}
--- !u!114 &-387253940381332063
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1348777536908202}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e06bcf7a3f4f3504da14d94faabd6f5e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114616308496331425
MonoBehaviour:
m_ObjectHideFlags: 0
......
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.Timeline;
namespace MDPro3.Duel
{
public class DuelFinalBlow : LoopTrackManager
{
public void Destroy()
{
StopLoop();
Destroy(gameObject, 0.5f);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e06bcf7a3f4f3504da14d94faabd6f5e
\ No newline at end of file
using UnityEngine;
using UnityEngine.Playables;
using YgomSystem.Timeline;
namespace MDPro3.Duel
{
public class LoopTrackManager : MonoBehaviour
{
private PlayableDirector playableDirector;
private PlayableDirector PlayableDirector =>
playableDirector = playableDirector != null ? playableDirector
: GetComponent<PlayableDirector>();
public LoopMixerBehaviour loopMixerBehaviour;
public LoopBehaviour loopBehaviour;
public void StopLoop()
{
if(loopMixerBehaviour != null)
{
loopMixerBehaviour.needLoop = false;
}
if(loopBehaviour != null)
{
loopBehaviour.loopClip = null;
loopBehaviour = null;
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 66385358c086ba540861577a5ca6b245
\ No newline at end of file
......@@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MDPro3.Duel.BG
namespace MDPro3.Duel
{
public class PlayableGuide : MonoBehaviour
{
......
using DG.Tweening;
using MDPro3.Duel;
using MDPro3.Duel.BG;
using MDPro3.Duel.YGOSharp;
using MDPro3.Net;
using MDPro3.UI;
......@@ -90,7 +89,7 @@ namespace MDPro3.Servant
private GameObject equipLine;
private GameObject myDice;
private GameObject opDice;
private GameObject duelFinalBlow;
private DuelFinalBlow duelFinalBlow;
private ElementObjectManager timerManager;
private TimerHandler timerHandler;
private PlayableGuide playableGuide;
......@@ -526,7 +525,8 @@ namespace MDPro3.Servant
TimelineManager.inSummonMaterial = false;
GetUI<OcgCoreUI>().CloseHint();
attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f);
if (duelFinalBlow != null)
duelFinalBlow.Destroy();
yield return new WaitForSeconds(TransitionTime);
servantUI.ShutDown();
speaking = false;
......@@ -3979,9 +3979,9 @@ namespace MDPro3.Servant
if (finalBlow)
{
if (duelFinalBlow != null)
Destroy(duelFinalBlow);
duelFinalBlow.Destroy();
//duelFinalBlow = ABLoader.LoadFromFile("MasterDuel/Timeline/DuelText/DuelFinalBlow", true);
duelFinalBlow = Instantiate(container.duelFinalBlow);
duelFinalBlow = Instantiate(container.duelFinalBlow).GetComponent<DuelFinalBlow>();
}
Sleep(20);
}
......@@ -3991,7 +3991,8 @@ namespace MDPro3.Servant
case GameMessage.AttackDisabled:
ES_hint = InterString.Get("攻击被无效时");
attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f);
if (duelFinalBlow != null)
duelFinalBlow.Destroy();
break;
case GameMessage.DamageStepStart:
break;
......@@ -4068,7 +4069,8 @@ namespace MDPro3.Servant
if (duelFinalBlow != null)
{
isFinalAttack = true;
Destroy(duelFinalBlow);
if (duelFinalBlow != null)
duelFinalBlow.Destroy();
}
needDamageResponseInstant = true;
messagePass = false;
......@@ -4736,7 +4738,8 @@ namespace MDPro3.Servant
break;
case GameMessage.NewPhase:
attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f);
if (duelFinalBlow != null)
duelFinalBlow.Destroy();
cardsInSelection.Clear();
var ph = r.ReadUInt16();
......@@ -5414,7 +5417,8 @@ namespace MDPro3.Servant
break;
case GameMessage.SelectBattleCmd:
attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f);
if (duelFinalBlow != null)
duelFinalBlow.Destroy();
if (InIgnoranceReplay()) break;
SetPlayableGuide(true);
......
......@@ -91,8 +91,6 @@ namespace YgomSystem.Timeline
}
}
public LoopMixerBehaviour loopMixerBehaviour;
public static LabeledPlayableController Create(PlayableDirector target)
......
using MDPro3;
using System;
using UnityEngine.Playables;
using UnityEngine.Timeline;
using static Willow.TimelineReplacer;
namespace YgomSystem.Timeline
{
......@@ -14,9 +12,9 @@ namespace YgomSystem.Timeline
public override void PrepareFrame(Playable playable, FrameData info)
{
if(m_director == null)
if (m_director == null)
m_director = playable.GetGraph().GetResolver() as PlayableDirector;
if(loopClip != null && m_director != null)
if (loopClip != null && m_director != null)
if (m_director.time > loopClip.extrapolatedStart + loopClip.duration)
m_director.time = loopClip.extrapolatedStart;
}
......
using AssetStudio;
using MDPro3.Duel;
using System;
using System.Collections.Generic;
using System.Diagnostics;
......@@ -49,16 +50,16 @@ namespace YgomSystem.Timeline
if(!inied)
Ini(playable);
if (m_Director.GetComponent<LabeledPlayableController>() != null)
if (m_Director.TryGetComponent<LabeledPlayableController>(out var lpc))
{
m_Director.GetComponent<LabeledPlayableController>().loopMixerBehaviour = this;
lpc.loopMixerBehaviour = this;
m_Initialized = true;
}
}
}
bool inied;
void Ini(Playable playable)
private bool inied;
private void Ini(Playable playable)
{
var resolver = playable.GetGraph().GetResolver();
if (resolver is PlayableDirector)
......@@ -76,18 +77,23 @@ namespace YgomSystem.Timeline
}
}
}
inied = true;
if(m_Director.TryGetComponent<LoopTrackManager>(out var ltm))
{
ltm.loopMixerBehaviour = this;
}
inied = true;
}
public bool needLoop = true;
public override void PrepareFrame(Playable playable, FrameData info)
{
if(currentClip != null)
if (m_Director.time > currentClip.extrapolatedStart + currentClip.duration - 0.02f)
m_Director.time = currentClip.extrapolatedStart;
}
if (currentClip != null && needLoop)
if (m_Director.time > currentClip.extrapolatedStart + currentClip.duration - 0.02f)
m_Director.time = currentClip.extrapolatedStart;
}
public void PlayClip(string label, TimelineClip loopClip)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment