Ver.0.3.0.33
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
using AibisDream.FixSystem;
|
||||
using AibisDream.Framework;
|
||||
using Cinemachine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Playables;
|
||||
using Yarn.Unity;
|
||||
using System.Collections;
|
||||
using UnityEngine.Timeline;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using AibisDream.Utility;
|
||||
using System.Linq;
|
||||
|
||||
namespace AibisDream
|
||||
{
|
||||
public class OpenSystem : MonoBehaviour
|
||||
{
|
||||
public DeepInClock deepInClock;
|
||||
public PlayableDirector openPlayable;
|
||||
public PlayableDirector breakPlayable;
|
||||
public PlayableDirector bubblePlayable;
|
||||
public LightRoom lightRoom;
|
||||
public GameObject screen;
|
||||
|
||||
public SpriteRenderer dreamSprite;
|
||||
|
||||
public BubbleSlotGroup bubbleSlotGroup;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// 注册
|
||||
FixSystemCenter.SystemDic.Register(this);
|
||||
var virtualCam = transform.Find("Op Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.Op, virtualCam);
|
||||
var breakCam = transform.Find("Break Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.BreakCamera, breakCam);
|
||||
var dreamCam = transform.Find("Dream Camera").GetComponent<ICinemachineCamera>();
|
||||
CameraKit.Instance.RegisterCamera(CameraEnum.DreamCamera, dreamCam);
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
dreamSprite.gameObject.SetActive(true);
|
||||
dreamSprite.SetAlpha(0);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerator PlayOpenTimeline()
|
||||
{
|
||||
openPlayable.Play();
|
||||
while (openPlayable.state == PlayState.Playing)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayOpenTimelineNoWait()
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
public void DreamDisappear()
|
||||
{
|
||||
dreamSprite.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
public void FinishCut()
|
||||
{
|
||||
DialogController.Instance.StartDialogNode("Cut_End");
|
||||
}
|
||||
}
|
||||
|
||||
public static class OpenYarnCommand
|
||||
{
|
||||
private static OpenSystem OpenSystem => FixSystemCenter.SystemDic.Get<OpenSystem>();
|
||||
|
||||
[YarnCommand("play_open_timeline")]
|
||||
public static IEnumerator PlayOpenTimeline()
|
||||
{
|
||||
yield return OpenSystem.PlayOpenTimeline();
|
||||
}
|
||||
|
||||
[YarnCommand("play_open_timeline_no_wait")]
|
||||
public static void PlayOpenTimelineNoWait()
|
||||
{
|
||||
OpenSystem.PlayOpenTimelineNoWait();
|
||||
}
|
||||
|
||||
[YarnCommand("play_break_timeline")]
|
||||
public static IEnumerator PlayBreakTimeline()
|
||||
{
|
||||
yield return OpenSystem.PlayBreakTimeline();
|
||||
}
|
||||
|
||||
[YarnCommand("play_break_timeline_no_wait")]
|
||||
public static void PlayBreakTimelineNoWait()
|
||||
{
|
||||
OpenSystem.PlayBreakTimelineNoWait();
|
||||
}
|
||||
|
||||
[YarnCommand("play_bubble_timeline")]
|
||||
public static IEnumerator PlayBubbleTimeline()
|
||||
{
|
||||
yield return OpenSystem.PlayBubbleTimeline();
|
||||
}
|
||||
|
||||
[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")]
|
||||
public static void DreamFadeIn(float time, float targetAlpha)
|
||||
{
|
||||
OpenSystem.DreamFadeIn(time, targetAlpha);
|
||||
}
|
||||
|
||||
[YarnCommand("dream_disappear")]
|
||||
public static void DreamDisappear()
|
||||
{
|
||||
OpenSystem.DreamDisappear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user