using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Video; public class EffectBaseManager : MonoBehaviour { //影片组 [SerializeField] private VideoClip[] clips; [SerializeField] private PopType[] clipTypes; //荧幕 [SerializeField] private EffectScreen eScreen; private Dictionary clipDict = new Dictionary(); void Start() { MessageCenterController.Instance.Register(GameEnum.MESSAGE_HIDE_POP_BY_TYPE, HidePop);//影藏弹框 MessageCenterController.Instance.Register(GameEnum.MESSAGE_SHOW_POP_BY_TYPE, ShowPop);//显示弹框 for (int i = 0; i < clips.Length; i++) { if(clipTypes.Length < i -1) { CDebug.Log("报错" + i); } clipDict.Add(clipTypes[i], clips[i]); } } // Update is called once per frame void Update() { if(Input.GetKeyDown(KeyCode.P)) { ChangeMovie(); } } private void HidePop(System.Object data = null) { PopType t = (PopType)data; } private void ShowPop(System.Object data = null) { ShowPopData t = data as ShowPopData; if(clipDict.ContainsKey(t.t)) { eScreen.ChangeMoive(clipDict[t.t]); } } //换片 private void ChangeMovie() { eScreen.ChangeMoive(clips[Random.Range(0, clips.Length)]); } }