using System; using System.Collections; using Cysharp.Threading.Tasks; using DragonSoul.Shared; using Mono.Event; using UnityEngine; using UnityEngine.Playables; using UnityEngine.UI; namespace UnityTest.ZXL { public class FirstProcess : ProcessBase { // private bool isNext; public PlayableDirector playable; protected override void OnInit() { base.OnInit(); playable.Stop(); EventManager.Instance.Subscribe(ConstEventArgs.EventId, ConstEventLogic); EventManager.Instance.Subscribe(ClickObjectEventArgs.EventId, ClickObjectEvent); // Minutia1_1(); } protected override void OnLevel() { base.OnLevel(); EventManager.Instance.Unsubscribe(ConstEventArgs.EventId, ConstEventLogic); EventManager.Instance.Unsubscribe(ClickObjectEventArgs.EventId, ClickObjectEvent); } private void ConstEventLogic(object sender, GameEventArgs e) { var args = e as ConstEventArgs; switch (args.constDataType) { case ConstDataType.None: break; case ConstDataType.动画2_1播放中断_等待用户点击: task_1_1.SetResult(true); break; default: throw new ArgumentOutOfRangeException(); } } private void ClickObjectEvent(object sender, GameEventArgs e) { var args = e as ClickObjectEventArgs; } // 1-1 // ①来到三维场景,播放动画2-1;当同学A打开乙炔柜体后,乙炔气瓶开关高亮,用户点击后再播放剩余动画、弹出“存在泄露”UI,不断闪烁,并伴随着咻~咻~咻~咻的泄气声,关闭柜门后“存在泄露”UI及泄气声消失; // ②此时电脑屏幕高亮,点击后出现电脑画面,画面中“确定”按钮高亮,鼠标点击后,显示启动中UI; // ③启动后0.5s,“蹦”的一声,柜体被爆炸打开,气瓶火焰向外喷射,并且光度计发生轻微爆炸,用户屏幕颤抖,三位同学倒地(动画2-2); private ETTask task_1_1; private async ETTask Minutia1_1(ETCancellationToken token) { // await UniTask.Delay(TimeSpan.FromSeconds(5)); await CommonHelper.WaitTime(5); playable.Play(); await ETTaskHelper.WaitCompletion(task_1_1, token); playable.Pause(); // 等待点击 ObjectDataComponent.Instance().GetObject(HighlightObjectType.乙炔气瓶开关).HighlightOpen(); await ETTaskHelper.WaitCompletion(task_1_1, token); playable.Resume(); var ui = UIManager.Instance().ShowUI(UIType.WeakTips); var tipsUI = ui as WeakTipsUI; tipsUI.SetContent("存在泄露"); ObjectDataComponent.Instance().GetObject(HighlightObjectType.乙炔气瓶开关).HighlightOpen(); await ETTaskHelper.WaitCompletion(task_1_1, token); var screen = ObjectDataComponent.Instance().GetObject(HighlightObjectType.电脑屏幕); screen.HighlightOpen(); await ETTaskHelper.WaitCompletion(task_1_1, token); var canvas = screen.transform.GetChild(0).gameObject; canvas.SetActive(true); var button = canvas.GetComponentInChildren