/// <summary> /// 切换到背景视频播放(播放组织短视频) /// </summary> public static void PlayAvObject() { AVProComponent aVPro = CentorPivot.This.GetComponent <AVProComponent>(); AVObject aVObject = aVPro.AddAVObject(Block_BG.This.m_Video_Org, GlobalData.FUI.Video_Org, true, true, false, 0.1f); aVObject.AddAction(OnFinishedPlayingEvent); aVPro.AddAVObject(Block_BG.This.m_Video_Ani, GlobalData.FUI.Video_Ani, true, false, true, 0.25f); }
private static void OnFinishedPlayingEvent(AVObject aVObject) { TimeActionComponent.This.GetTimeAction().SetInterval(0.01f).SetLoop(-1).StartUpdate( (TimeAction timeAction) => { //设定音量衰减 1.5秒后 无声音 if (aVObject.MediaPlayer.m_Volume > 0) { float volumeNext = aVObject.MediaPlayer.m_Volume - 0.07f; if (volumeNext <= 0) { volumeNext = 0f; } aVObject.MediaPlayer.m_Volume = volumeNext; } //设置视频变暗 if (aVObject.DisplayUGUI.color.r > 0) { float r = aVObject.DisplayUGUI.color.r; float g = aVObject.DisplayUGUI.color.g; float b = aVObject.DisplayUGUI.color.b; r = r - 0.05f; g = g - 0.05f; b = b - 0.05f; if (r <= 0) { r = 0f; } if (g <= 0) { g = 0f; } if (b <= 0) { b = 0f; } aVObject.DisplayUGUI.color = new Color(r, g, b); } if (aVObject.MediaPlayer.m_Volume == 0f && aVObject.DisplayUGUI.color.r == 0f) { timeAction.EndLoop(); } }, (TimeAction timeAction) => { AVProComponent aVPro = CentorPivot.This.GetComponent <AVProComponent>(); //关闭组织视频 aVPro.RemoveAVObject(GlobalData.FUI.Video_Org); //开始播放登录场景视频 aVPro.GetAVObject(GlobalData.FUI.Video_Ani).Play(); //切换流程 ProcedureComponent.This.GetProcedure <ProcedureLaunch>().OnChange(); } ); }