Commit 40fcb4df authored by SherryChaos's avatar SherryChaos

add loop break for LoopTrack

parent 3f2d86c1
...@@ -1464,6 +1464,7 @@ GameObject: ...@@ -1464,6 +1464,7 @@ GameObject:
serializedVersion: 6 serializedVersion: 6
m_Component: m_Component:
- component: {fileID: 4896299765901075} - component: {fileID: 4896299765901075}
- component: {fileID: -387253940381332063}
- component: {fileID: 114616308496331425} - component: {fileID: 114616308496331425}
- component: {fileID: 320369927042751078} - component: {fileID: 320369927042751078}
m_Layer: 0 m_Layer: 0
...@@ -1489,6 +1490,18 @@ Transform: ...@@ -1489,6 +1490,18 @@ Transform:
- {fileID: 4384957410883823} - {fileID: 4384957410883823}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: -0, z: -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 --- !u!114 &114616308496331425
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 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; ...@@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
namespace MDPro3.Duel.BG namespace MDPro3.Duel
{ {
public class PlayableGuide : MonoBehaviour public class PlayableGuide : MonoBehaviour
{ {
......
using DG.Tweening; using DG.Tweening;
using MDPro3.Duel; using MDPro3.Duel;
using MDPro3.Duel.BG;
using MDPro3.Duel.YGOSharp; using MDPro3.Duel.YGOSharp;
using MDPro3.Net; using MDPro3.Net;
using MDPro3.UI; using MDPro3.UI;
...@@ -90,7 +89,7 @@ namespace MDPro3.Servant ...@@ -90,7 +89,7 @@ namespace MDPro3.Servant
private GameObject equipLine; private GameObject equipLine;
private GameObject myDice; private GameObject myDice;
private GameObject opDice; private GameObject opDice;
private GameObject duelFinalBlow; private DuelFinalBlow duelFinalBlow;
private ElementObjectManager timerManager; private ElementObjectManager timerManager;
private TimerHandler timerHandler; private TimerHandler timerHandler;
private PlayableGuide playableGuide; private PlayableGuide playableGuide;
...@@ -526,7 +525,8 @@ namespace MDPro3.Servant ...@@ -526,7 +525,8 @@ namespace MDPro3.Servant
TimelineManager.inSummonMaterial = false; TimelineManager.inSummonMaterial = false;
GetUI<OcgCoreUI>().CloseHint(); GetUI<OcgCoreUI>().CloseHint();
attackLine.SetActive(false); attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f); if (duelFinalBlow != null)
duelFinalBlow.Destroy();
yield return new WaitForSeconds(TransitionTime); yield return new WaitForSeconds(TransitionTime);
servantUI.ShutDown(); servantUI.ShutDown();
speaking = false; speaking = false;
...@@ -3979,9 +3979,9 @@ namespace MDPro3.Servant ...@@ -3979,9 +3979,9 @@ namespace MDPro3.Servant
if (finalBlow) if (finalBlow)
{ {
if (duelFinalBlow != null) if (duelFinalBlow != null)
Destroy(duelFinalBlow); duelFinalBlow.Destroy();
//duelFinalBlow = ABLoader.LoadFromFile("MasterDuel/Timeline/DuelText/DuelFinalBlow", true); //duelFinalBlow = ABLoader.LoadFromFile("MasterDuel/Timeline/DuelText/DuelFinalBlow", true);
duelFinalBlow = Instantiate(container.duelFinalBlow); duelFinalBlow = Instantiate(container.duelFinalBlow).GetComponent<DuelFinalBlow>();
} }
Sleep(20); Sleep(20);
} }
...@@ -3991,7 +3991,8 @@ namespace MDPro3.Servant ...@@ -3991,7 +3991,8 @@ namespace MDPro3.Servant
case GameMessage.AttackDisabled: case GameMessage.AttackDisabled:
ES_hint = InterString.Get("攻击被无效时"); ES_hint = InterString.Get("攻击被无效时");
attackLine.SetActive(false); attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f); if (duelFinalBlow != null)
duelFinalBlow.Destroy();
break; break;
case GameMessage.DamageStepStart: case GameMessage.DamageStepStart:
break; break;
...@@ -4068,7 +4069,8 @@ namespace MDPro3.Servant ...@@ -4068,7 +4069,8 @@ namespace MDPro3.Servant
if (duelFinalBlow != null) if (duelFinalBlow != null)
{ {
isFinalAttack = true; isFinalAttack = true;
Destroy(duelFinalBlow); if (duelFinalBlow != null)
duelFinalBlow.Destroy();
} }
needDamageResponseInstant = true; needDamageResponseInstant = true;
messagePass = false; messagePass = false;
...@@ -4736,7 +4738,8 @@ namespace MDPro3.Servant ...@@ -4736,7 +4738,8 @@ namespace MDPro3.Servant
break; break;
case GameMessage.NewPhase: case GameMessage.NewPhase:
attackLine.SetActive(false); attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f); if (duelFinalBlow != null)
duelFinalBlow.Destroy();
cardsInSelection.Clear(); cardsInSelection.Clear();
var ph = r.ReadUInt16(); var ph = r.ReadUInt16();
...@@ -5414,7 +5417,8 @@ namespace MDPro3.Servant ...@@ -5414,7 +5417,8 @@ namespace MDPro3.Servant
break; break;
case GameMessage.SelectBattleCmd: case GameMessage.SelectBattleCmd:
attackLine.SetActive(false); attackLine.SetActive(false);
Destroy(duelFinalBlow, 0.5f); if (duelFinalBlow != null)
duelFinalBlow.Destroy();
if (InIgnoranceReplay()) break; if (InIgnoranceReplay()) break;
SetPlayableGuide(true); SetPlayableGuide(true);
......
...@@ -91,8 +91,6 @@ namespace YgomSystem.Timeline ...@@ -91,8 +91,6 @@ namespace YgomSystem.Timeline
} }
} }
public LoopMixerBehaviour loopMixerBehaviour; public LoopMixerBehaviour loopMixerBehaviour;
public static LabeledPlayableController Create(PlayableDirector target) public static LabeledPlayableController Create(PlayableDirector target)
......
using MDPro3;
using System; using System;
using UnityEngine.Playables; using UnityEngine.Playables;
using UnityEngine.Timeline; using UnityEngine.Timeline;
using static Willow.TimelineReplacer;
namespace YgomSystem.Timeline namespace YgomSystem.Timeline
{ {
...@@ -14,9 +12,9 @@ namespace YgomSystem.Timeline ...@@ -14,9 +12,9 @@ namespace YgomSystem.Timeline
public override void PrepareFrame(Playable playable, FrameData info) public override void PrepareFrame(Playable playable, FrameData info)
{ {
if(m_director == null) if (m_director == null)
m_director = playable.GetGraph().GetResolver() as PlayableDirector; 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) if (m_director.time > loopClip.extrapolatedStart + loopClip.duration)
m_director.time = loopClip.extrapolatedStart; m_director.time = loopClip.extrapolatedStart;
} }
......
using AssetStudio; using AssetStudio;
using MDPro3.Duel;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
...@@ -49,16 +50,16 @@ namespace YgomSystem.Timeline ...@@ -49,16 +50,16 @@ namespace YgomSystem.Timeline
if(!inied) if(!inied)
Ini(playable); 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; m_Initialized = true;
} }
} }
} }
bool inied; private bool inied;
void Ini(Playable playable) private void Ini(Playable playable)
{ {
var resolver = playable.GetGraph().GetResolver(); var resolver = playable.GetGraph().GetResolver();
if (resolver is PlayableDirector) if (resolver is PlayableDirector)
...@@ -76,15 +77,20 @@ namespace YgomSystem.Timeline ...@@ -76,15 +77,20 @@ 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) public override void PrepareFrame(Playable playable, FrameData info)
{ {
if(currentClip != null) if (currentClip != null && needLoop)
if (m_Director.time > currentClip.extrapolatedStart + currentClip.duration - 0.02f) if (m_Director.time > currentClip.extrapolatedStart + currentClip.duration - 0.02f)
m_Director.time = currentClip.extrapolatedStart; m_Director.time = currentClip.extrapolatedStart;
} }
......
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