Merge branch '修复timeline打包问题' into 'develop'

修复timeline打包问题

See merge request aibis-dream/aibis-dream!462
This commit is contained in:
2025-06-15 12:06:34 +00:00
7 changed files with 745 additions and 842 deletions
File diff suppressed because it is too large Load Diff
@@ -2929,7 +2929,7 @@ MonoBehaviour:
m_Version: 3
m_AnimClip: {fileID: 0}
m_Locked: 0
m_Muted: 0
m_Muted: 1
m_CustomPlayableFullTypename:
m_Curves: {fileID: 0}
m_Parent: {fileID: 11400000}
@@ -199,7 +199,7 @@ position: 250,200
// <<play_sfx "event:/Scriptal/head_open">>
<<wait 0.5>>
<<Open_play_timeline_no_wait "Art/TimeLineAsset/Open Panel Timeline">>
<<play_open_timeline_no_wait>>
<<fade_out 1.7>>
// <<set $gameStage = 2>>
// <<jump Center>>
@@ -29,47 +29,28 @@ position: 906,-585
<<play_shock_flashback 开场1>>
<<auto_charge_and_release 0.4>>
<<play_shock_flashback 开场2>>
<<Open_play_timeline Art/TimeLineAsset/Emergency>>
<<play_bubble_timeline>>
<<auto_charge_and_release 0.4>>
<<play_shock_flashback 开场1>>
<<auto_charge_and_release 0.2>>
<<play_shock_flashback 开场2>>
<<resume_timeline>>
<<resume_bubble_timeline>>
<<auto_charge_and_release 0.1>>
<<play_shock_flashback 开场2>>
<<auto_charge_and_release 0.1>>
<<play_shock_flashback 开场1>>
<<resume_timeline>>
<<resume_bubble_timeline>>
<<auto_charge_and_release 0.1>>
<<play_shock_flashback 开场1>>
<<auto_charge_and_release 0.1>>
<<play_shock_flashback 开场2>>
<<auto_charge_and_release 0.1>>
<<resume_timeline>>
<<resume_bubble_timeline>>
<<switch_camera BreakCamera>>
<<Open_play_timeline Art/TimeLineAsset/BreakEnding>>
<<play_break_timeline>>
<<jump end>>
===
title: 背板切除后
tags:
colorID: 8
group:插线检查
position: 906,-585
---
<<switch_fix_system_to "Op">>
<<enable_clock>>
//【背景的城市亮起,变成白天,又变成黑夜。时针飞速倒转,时间不断循环。】 #line:0f60a30
//【更多画面闪烁,飞速变化,背景音逐渐变成嗡嗡声和蜂鸣声(声音桥)】 #line:02435ff
////【顶部居中白字】我讨厌这种黏糊糊的感觉。
////【顶部居中白字】刚刚还在管道中奔涌的新鲜冷却液,转瞬就变成了黏在我手上的污垢,让我觉得恶心。
//////考虑用别的方式来做这种情况的内心独白
////【我举起手,手上赫然布满了红色的液体】
////【我放下手,此时头部的液体也变成了红色;背景音逐渐变成嗡嗡声和蜂鸣声(声音桥)】
===
title: end
group: 出口
@@ -89,7 +70,6 @@ position: 248,443
// 火山: 你看清那张脸了吗? #line:02f64d8
// 【声音桥,转场到地铁】 #line:002d60b
<<fade_in 0>>
<<wait 1.5>>
CenterText: 第一章<waitfor=4> #auto_next #line:0bf67b0
<<wait 2>>
+3 -1
View File
@@ -8361,7 +8361,7 @@ Transform:
m_GameObject: {fileID: 519420028}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.009999275, y: 0, z: -10}
m_LocalPosition: {x: 0, y: 0, z: -10}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -10518,6 +10518,8 @@ PlayableDirector:
value: {fileID: 149258302}
- key: {fileID: -2232058861460470490, guid: 6a22dc1e52d77c642996ae783383afeb, type: 2}
value: {fileID: 135020139}
- key: {fileID: 1304984656973272119, guid: 6a22dc1e52d77c642996ae783383afeb, type: 2}
value: {fileID: 0}
m_ExposedReferences:
m_References: []
--- !u!1001 &759307075
+101 -183
View File
@@ -9,6 +9,7 @@ using UnityEngine.Timeline;
using System.Collections.Generic;
using DG.Tweening;
using AibisDream.Utility;
using System.Linq;
namespace AibisDream
{
@@ -16,6 +17,8 @@ namespace AibisDream
{
public DeepInClock deepInClock;
public PlayableDirector openPlayable;
public PlayableDirector breakPlayable;
public PlayableDirector bubblePlayable;
public LightRoom lightRoom;
public GameObject screen;
@@ -43,32 +46,78 @@ namespace AibisDream
public void Update()
{
if (Input.GetKeyDown(KeyCode.K))
}
public IEnumerator PlayOpenTimeline()
{
openPlayable.Play();
while (openPlayable.state == PlayState.Playing)
{
EnableClock();
yield return null;
}
}
public void OpenLightRoom()
public void PlayOpenTimelineNoWait()
{
screen.SetActive(false);
lightRoom.gameObject.SetActive(true);
}
public void EnableClock()
{
lightRoom.gameObject.SetActive(false);
deepInClock.Enable();
}
public void PlayOpenTimeline()
{
// 在播放Timeline之前绑定DialogController
BindDialogController();
//OpenAnima.SetActive(true);
openPlayable.Play();
}
public IEnumerator PlayBreakTimeline()
{
breakPlayable.Play();
while (breakPlayable.state == PlayState.Playing)
{
yield return null;
}
}
public void PlayBreakTimelineNoWait()
{
breakPlayable.Play();
}
public IEnumerator PlayBubbleTimeline()
{
bubblePlayable.Play();
while (bubblePlayable.state == PlayState.Playing)
{
yield return null;
}
}
public void PlayBubbleTimelineNoWait()
{
bubblePlayable.Play();
}
public IEnumerator ResumeBubbleTimeline()
{
if (bubblePlayable != null && bubblePlayable.state == PlayState.Paused)
{
bubblePlayable.Resume();
while (bubblePlayable.state == PlayState.Playing)
{
yield return null;
}
}
}
public void PauseTimeline()
{
if (openPlayable != null && openPlayable.state == PlayState.Playing)
{
openPlayable.Pause();
}
if (breakPlayable != null && breakPlayable.state == PlayState.Playing)
{
breakPlayable.Pause();
}
if (bubblePlayable != null && bubblePlayable.state == PlayState.Playing)
{
bubblePlayable.Pause();
}
}
public void DreamFadeIn(float time, float targetAlpha)
{
dreamSprite.DOFade(targetAlpha, time).SetEase(Ease.InOutSine);
@@ -79,181 +128,62 @@ namespace AibisDream
dreamSprite.gameObject.SetActive(false);
}
// 添加动态绑定方法
public void BindTimelineTarget(string trackName, Object target)
{
if (openPlayable == null) return;
var timeline = openPlayable.playableAsset as TimelineAsset;
if (timeline == null) return;
foreach (var track in timeline.GetOutputTracks())
{
if (track.name == trackName)
{
openPlayable.SetGenericBinding(track, target);
break;
}
}
}
// 添加DialogController绑定方法
private void BindDialogController()
{
if (openPlayable == null) return;
var timeline = openPlayable.playableAsset as TimelineAsset;
if (timeline == null) return;
// 遍历所有轨道
foreach (var track in timeline.GetOutputTracks())
{
// 检查轨道类型是否为Signal Track或其他需要DialogController的轨道
if (track is SignalTrack || track.name.Contains("Dialog"))
{
// 绑定DialogController实例
openPlayable.SetGenericBinding(track, DialogController.Instance);
}
}
}
private void BindPlayToolPanel()
{
if (openPlayable == null) return;
var timeline = openPlayable.playableAsset as TimelineAsset;
if (timeline == null) return;
// 遍历所有轨道
foreach (var track in timeline.GetOutputTracks())
{
// 检查轨道类型是否为Signal Track或其他需要DialogController的轨道
if (track.name.Contains("Fade"))
{
// 绑定DialogController实例
openPlayable.SetGenericBinding(track, UIManager.Instance.GetPanel<PlayToolPanel>());
}
}
}
// 通用的Timeline播放方法
public IEnumerator PlayTimeline(string timelinePath, Dictionary<string, Object> bindings = null)
{
// 加载Timeline资源
var timelineAsset = Resources.Load<TimelineAsset>(timelinePath);
if (timelineAsset == null)
{
Debug.LogError($"找不到Timeline资源: {timelinePath}");
yield break;
}
openPlayable.playableAsset = timelineAsset;
// BindDialogController();
openPlayable.Play();
while (openPlayable.state == PlayState.Playing)
{
yield return null;
}
}
public void PlayTimeline_noWait(string timelinePath)
{
// 加载Timeline资源
var timelineAsset = Resources.Load<TimelineAsset>(timelinePath);
if (timelineAsset == null)
{
Debug.LogError($"找不到Timeline资源: {timelinePath}");
return;
}
openPlayable.playableAsset = timelineAsset;
// BindPlayToolPanel();
// BindDialogController();
openPlayable.Play();
}
public void FinishCut()
{
DialogController.Instance.StartDialogNode("Cut_End");
}
public void PauseTimeline()
{
Debug.Log("TRY PAUSE Timeline"); // 添加这行
if (openPlayable != null && openPlayable.state == PlayState.Playing)
{
Debug.Log("Timeline is being paused"); // 添加这行
openPlayable.Pause();
}
}
public IEnumerator ResumeTimeline()
{
if (openPlayable != null && openPlayable.state == PlayState.Paused)
{
openPlayable.Resume();
// 等待 Timeline 播放完成
while (openPlayable.state == PlayState.Playing)
{
yield return null;
}
}
}
}
public static class OpenYarnCommand
{
private static OpenSystem OpenSystem => FixSystemCenter.SystemDic.Get<OpenSystem>();
[YarnCommand("enable_clock")]
public static void EnableClock()
[YarnCommand("play_open_timeline")]
public static IEnumerator PlayOpenTimeline()
{
OpenSystem.EnableClock();
yield return OpenSystem.PlayOpenTimeline();
}
[YarnCommand("open_light_room")]
public static void OpenLightRoom()
[YarnCommand("play_open_timeline_no_wait")]
public static void PlayOpenTimelineNoWait()
{
OpenSystem.OpenLightRoom();
OpenSystem.PlayOpenTimelineNoWait();
}
// [YarnCommand("play__timeline")]
// public static IEnumerator RunTimeline()
// {
// OpenSystem.PlayOpenTimeline();
// yield return null;
// }
[YarnCommand("Open_play_timeline")]
public static IEnumerator PlayTimeline(string timelinePath)
[YarnCommand("play_break_timeline")]
public static IEnumerator PlayBreakTimeline()
{
yield return OpenSystem.PlayTimeline(timelinePath);
}
[YarnCommand("Open_play_timeline_no_wait")]
public static void PlayTimeline_noWait(string timelinePath)
{
OpenSystem.PlayTimeline_noWait(timelinePath);
yield return OpenSystem.PlayBreakTimeline();
}
[YarnCommand("play_timeline_with_bindings")]
public static IEnumerator PlayTimelineWithBindings(string timelinePath, string[] bindingNames)
[YarnCommand("play_break_timeline_no_wait")]
public static void PlayBreakTimelineNoWait()
{
var bindings = new Dictionary<string, Object>();
OpenSystem.PlayBreakTimelineNoWait();
}
// 解析绑定名称并查找对应物体
foreach (var bindingName in bindingNames)
{
var targetObj = GameObject.Find(bindingName);
if (targetObj != null)
{
bindings[bindingName] = targetObj;
}
else
{
Debug.LogWarning($"找不到绑定物体: {bindingName}");
}
}
[YarnCommand("play_bubble_timeline")]
public static IEnumerator PlayBubbleTimeline()
{
yield return OpenSystem.PlayBubbleTimeline();
}
yield return OpenSystem.PlayTimeline(timelinePath, bindings);
[YarnCommand("play_bubble_timeline_no_wait")]
public static void PlayBubbleTimelineNoWait()
{
OpenSystem.PlayBubbleTimelineNoWait();
}
[YarnCommand("resume_bubble_timeline")]
public static IEnumerator ResumeBubbleTimeline()
{
yield return OpenSystem.ResumeBubbleTimeline();
}
[YarnCommand("pause_timeline")]
public static void PauseTimeline()
{
OpenSystem.PauseTimeline();
}
[YarnCommand("dream_fade_in")]
@@ -267,17 +197,5 @@ namespace AibisDream
{
OpenSystem.DreamDisappear();
}
[YarnCommand("resume_timeline")]
public static IEnumerator ResumeTimeline()
{
yield return OpenSystem.ResumeTimeline();
}
[YarnCommand("pause_timeline")]
public static void PauseTimeline()
{
OpenSystem.PauseTimeline();
}
}
}
+4 -1
View File
@@ -43,7 +43,10 @@ namespace AibisDream
{
director.playableAsset = timeline;
director.Play();
yield return new WaitForSeconds((float)director.duration);
while (director.state == PlayState.Playing)
{
yield return null;
}
}
else
{