气泡
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
using System.Linq.Expressions;
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using AibisDream.Kit;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
@@ -17,15 +15,13 @@ namespace AibisDream
|
||||
public class OpenSystem : MonoBehaviour
|
||||
{
|
||||
public DeepInClock deepInClock;
|
||||
public PlayableDirector OpenPlayable;
|
||||
public GameObject OpenAnima;
|
||||
public SpriteDeepIn deepIn;
|
||||
public PlayableDirector openPlayable;
|
||||
public LightRoom lightRoom;
|
||||
public GameObject screen;
|
||||
public GameObject breakGlass;
|
||||
|
||||
public SpriteRenderer dreamSprite;
|
||||
private bool isCuttingMode = false;
|
||||
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
@@ -38,7 +34,9 @@ namespace AibisDream
|
||||
var dreamCam = transform.Find("Dream Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.DreamCamera, dreamCam);
|
||||
}
|
||||
private void Start() {
|
||||
|
||||
private void Start()
|
||||
{
|
||||
dreamSprite.gameObject.SetActive(true);
|
||||
dreamSprite.SetAlpha(0);
|
||||
}
|
||||
@@ -51,13 +49,6 @@ namespace AibisDream
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
// deepInClock.OnClockReached -= PlayFadeIn;
|
||||
// fadeInPlayable.stopped -= PlayDeepIn;
|
||||
// deepIn.OnFinished -= Finished;
|
||||
}
|
||||
|
||||
public void OpenLightRoom()
|
||||
{
|
||||
screen.SetActive(false);
|
||||
@@ -70,57 +61,37 @@ namespace AibisDream
|
||||
deepInClock.Enable();
|
||||
}
|
||||
|
||||
// public void PlayFadeIn()
|
||||
// {
|
||||
// fadeInAnima.SetActive(true);
|
||||
// fadeInPlayable.Play();
|
||||
// }
|
||||
public void PlayOpenTimeline()
|
||||
{
|
||||
// 在播放Timeline之前绑定DialogController
|
||||
BindDialogController();
|
||||
//OpenAnima.SetActive(true);
|
||||
OpenPlayable.Play();
|
||||
openPlayable.Play();
|
||||
}
|
||||
public void DreamFadeIn(float time,float targetAlpha)
|
||||
|
||||
public void DreamFadeIn(float time, float targetAlpha)
|
||||
{
|
||||
dreamSprite.DOFade(targetAlpha, time).SetEase(Ease.InOutSine);
|
||||
}
|
||||
|
||||
public void DreamDisappear()
|
||||
{
|
||||
dreamSprite.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
// private void PlayDeepIn(PlayableDirector director)
|
||||
// {
|
||||
// fadeInAnima.SetActive(false);
|
||||
// deepIn.gameObject.SetActive(true);
|
||||
// deepIn.Play();
|
||||
// }
|
||||
|
||||
private void Finished()
|
||||
{
|
||||
DialogController.Instance.StartDialogNode("DeepInEnd");
|
||||
}
|
||||
public void SwitchToBodyModule()
|
||||
{
|
||||
StartCoroutine(FixSystemCenter.StateMachine.SwitchState(FixState.BodyModule));
|
||||
Debug.Log("SwitchToBodyModule");
|
||||
}
|
||||
|
||||
// 添加动态绑定方法
|
||||
public void BindTimelineTarget(string trackName, Object target)
|
||||
{
|
||||
if (OpenPlayable == null) return;
|
||||
if (openPlayable == null) return;
|
||||
|
||||
var timeline = OpenPlayable.playableAsset as TimelineAsset;
|
||||
var timeline = openPlayable.playableAsset as TimelineAsset;
|
||||
if (timeline == null) return;
|
||||
|
||||
foreach (var track in timeline.GetOutputTracks())
|
||||
{
|
||||
if (track.name == trackName)
|
||||
{
|
||||
OpenPlayable.SetGenericBinding(track, target);
|
||||
openPlayable.SetGenericBinding(track, target);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -129,9 +100,9 @@ namespace AibisDream
|
||||
// 添加DialogController绑定方法
|
||||
private void BindDialogController()
|
||||
{
|
||||
if (OpenPlayable == null) return;
|
||||
if (openPlayable == null) return;
|
||||
|
||||
var timeline = OpenPlayable.playableAsset as TimelineAsset;
|
||||
var timeline = openPlayable.playableAsset as TimelineAsset;
|
||||
if (timeline == null) return;
|
||||
|
||||
// 遍历所有轨道
|
||||
@@ -141,15 +112,16 @@ namespace AibisDream
|
||||
if (track is SignalTrack || track.name.Contains("Dialog"))
|
||||
{
|
||||
// 绑定DialogController实例
|
||||
OpenPlayable.SetGenericBinding(track, DialogController.Instance);
|
||||
openPlayable.SetGenericBinding(track, DialogController.Instance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void BindPlayToolPanel()
|
||||
{
|
||||
if (OpenPlayable == null) return;
|
||||
if (openPlayable == null) return;
|
||||
|
||||
var timeline = OpenPlayable.playableAsset as TimelineAsset;
|
||||
var timeline = openPlayable.playableAsset as TimelineAsset;
|
||||
if (timeline == null) return;
|
||||
|
||||
// 遍历所有轨道
|
||||
@@ -159,7 +131,7 @@ namespace AibisDream
|
||||
if (track is SignalTrack || track.name.Contains("Fade"))
|
||||
{
|
||||
// 绑定DialogController实例
|
||||
OpenPlayable.SetGenericBinding(track, UIManager.Instance.GetPanel<PlayToolPanel>());
|
||||
openPlayable.SetGenericBinding(track, UIManager.Instance.GetPanel<PlayToolPanel>());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -174,57 +146,14 @@ namespace AibisDream
|
||||
Debug.LogError($"找不到Timeline资源: {timelinePath}");
|
||||
yield break;
|
||||
}
|
||||
OpenPlayable.playableAsset = timelineAsset;
|
||||
|
||||
openPlayable.playableAsset = timelineAsset;
|
||||
BindPlayToolPanel();
|
||||
OpenPlayable.Play();
|
||||
while (OpenPlayable.state == PlayState.Playing)
|
||||
openPlayable.Play();
|
||||
while (openPlayable.state == PlayState.Playing)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
|
||||
|
||||
// // 创建临时PlayableDirector
|
||||
// var director = gameObject.AddComponent<PlayableDirector>();
|
||||
// director.playableAsset = timelineAsset;
|
||||
|
||||
// // 处理绑定
|
||||
// if (bindings != null)
|
||||
// {
|
||||
// foreach (var track in timelineAsset.GetOutputTracks())
|
||||
// {
|
||||
// // 尝试从bindings中找到匹配的绑定
|
||||
// if (bindings.TryGetValue(track.name, out var binding))
|
||||
// {
|
||||
// director.SetGenericBinding(track, binding);
|
||||
// }
|
||||
// // 特殊处理DialogController
|
||||
// else if (track is SignalTrack || track.name.Contains("Dialog"))
|
||||
// {
|
||||
// director.SetGenericBinding(track, DialogController.Instance);
|
||||
// }
|
||||
// // 尝试在场景中查找同名物体
|
||||
// else
|
||||
// {
|
||||
// var targetObj = GameObject.Find(track.name);
|
||||
// if (targetObj != null)
|
||||
// {
|
||||
// director.SetGenericBinding(track, targetObj);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// // 播放Timeline
|
||||
// director.Play();
|
||||
|
||||
// // 等待Timeline播放完成
|
||||
// while (director.state == PlayState.Playing)
|
||||
// {
|
||||
// yield return null;
|
||||
// }
|
||||
|
||||
// // 清理
|
||||
// Destroy(director);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,19 +172,12 @@ namespace AibisDream
|
||||
{
|
||||
OpenSystem.OpenLightRoom();
|
||||
}
|
||||
|
||||
[YarnCommand("play_open_timeline")]
|
||||
public static IEnumerator RunTimeline()
|
||||
{
|
||||
OpenSystem.PlayOpenTimeline();
|
||||
yield return null;
|
||||
|
||||
// if (true)
|
||||
// {
|
||||
// while (OpenSystem.OpenPlayable.state == PlayState.Playing)
|
||||
// {
|
||||
// yield return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
[YarnCommand("Open_play_timeline")]
|
||||
@@ -268,7 +190,7 @@ namespace AibisDream
|
||||
public static IEnumerator PlayTimelineWithBindings(string timelinePath, string[] bindingNames)
|
||||
{
|
||||
var bindings = new Dictionary<string, Object>();
|
||||
|
||||
|
||||
// 解析绑定名称并查找对应物体
|
||||
foreach (var bindingName in bindingNames)
|
||||
{
|
||||
@@ -285,16 +207,17 @@ namespace AibisDream
|
||||
|
||||
yield return OpenSystem.PlayTimeline(timelinePath, bindings);
|
||||
}
|
||||
|
||||
[YarnCommand("dream_fade_in")]
|
||||
public static void DreamFadeIn(float time,float targetAlpha)
|
||||
public static void DreamFadeIn(float time, float targetAlpha)
|
||||
{
|
||||
OpenSystem.DreamFadeIn(time,targetAlpha);
|
||||
OpenSystem.DreamFadeIn(time, targetAlpha);
|
||||
}
|
||||
|
||||
[YarnCommand("dream_disappear")]
|
||||
public static void DreamDisappear()
|
||||
{
|
||||
OpenSystem.DreamDisappear();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user