update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { _decorator, instantiate, isValid, Label, Node, Sprite, UITransform, Vec3, VideoPlayer, view } from 'cc';
|
||||
import { _decorator, instantiate, isValid, Label, Node,VideoClip, Sprite, UITransform, Vec3, VideoPlayer, view } from 'cc';
|
||||
import Utils from '../../Main/Common/Utils';
|
||||
import { InnerMsgCode } from '../../Main/Config/InnerMsgCode';
|
||||
import li_BaseView from '../../Main/Common/li_BaseView';
|
||||
@@ -23,6 +23,8 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
private vpWait: BgVideo | null = null; //播表情视频时暂停的背景视频
|
||||
private emoReady: BgVideo | null = null; //已准备好播放的表情
|
||||
|
||||
private videoPlayer: VideoPlayer = null;
|
||||
|
||||
/**获取videoplayer副本 */
|
||||
getVideoClone() {
|
||||
let vp = instantiate(this._nodeTab.videoRole)
|
||||
@@ -36,6 +38,7 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
this.registerListenner();
|
||||
Utils.parseNode(this.node, this._nodeTab)
|
||||
this.sceneBg = this._nodeTab.sceneBg.getComponent(Sprite)!;
|
||||
this.videoPlayer = this._nodeTab.videoRole.getComponent(VideoPlayer);
|
||||
if (GlobalValue.NpcVideoMod) {
|
||||
this.setVideoInited(true, true)
|
||||
}
|
||||
@@ -47,18 +50,13 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
|
||||
|
||||
registerListenner() {
|
||||
Utils.addInnerEL(InnerMsgCode.SimplePlayVide,this,this.playLocalLoopVideo);
|
||||
Utils.addInnerEL(InnerMsgCode.SceneLayerBgUp, this, this.resiveBgUp)
|
||||
Utils.addInnerEL(InnerMsgCode.BgVideo_Ready, this, this.resiveBgVideoReady)
|
||||
Utils.addInnerEL(InnerMsgCode.BgVideo_End, this, this.resiveBgVideoEnd)
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
}
|
||||
|
||||
update(deltaTime: number) {
|
||||
|
||||
}
|
||||
|
||||
//刷新场景背景消息
|
||||
resiveBgUp(data) {
|
||||
@@ -116,6 +114,19 @@ export class SceneBgVideoLayer extends li_BaseView {
|
||||
}
|
||||
}
|
||||
|
||||
playLocalLoopVideo(data:any) {
|
||||
ResManager.I.changeBundleVideo(this.videoPlayer,data.path,"Chat18x",(res:VideoClip)=>{
|
||||
this.videoPlayer.play();
|
||||
let uiT:UITransform = this.videoPlayer.node.getComponent(UITransform);
|
||||
|
||||
const size = uiT.contentSize;
|
||||
console.log(size);
|
||||
const targetSize = data.size;
|
||||
console.log(targetSize);
|
||||
|
||||
this.videoPlayer.node.setScale(new Vec3(targetSize.y/576,targetSize.y/576,1));
|
||||
});
|
||||
}
|
||||
|
||||
/**播放循环视频 */
|
||||
playLoopVideo(path: string, force = false) {
|
||||
|
||||
Reference in New Issue
Block a user