Commit 13c30981 authored by limingzhe's avatar limingzhe

fix: 新UI

parent c48ab451
...@@ -46,6 +46,7 @@ cc.Class({ ...@@ -46,6 +46,7 @@ cc.Class({
this.barBaseW = this.bar.width; this.barBaseW = this.bar.width;
this.barSpr = this.bar.getComponent(cc.Sprite); this.barSpr = this.bar.getComponent(cc.Sprite);
this.barSf = this.barSpr.spriteFrame; this.barSf = this.barSpr.spriteFrame;
this.barBtn = cc.find("barBtn", this.node);
this.setProgress(0); this.setProgress(0);
}, },
...@@ -62,9 +63,18 @@ cc.Class({ ...@@ -62,9 +63,18 @@ cc.Class({
rect.width = w; rect.width = w;
this.bar.width = w; this.bar.width = w;
this.barSpr.spriteFrame.setRect(rect); this.barSpr.spriteFrame.setRect(rect);
this.setBarBtn(w);
}, 1); }, 1);
}, },
setBarBtn(w) {
if (!this.barBtn) {
return;
}
this.barBtn.x = w;
},
// update (dt) {}, // update (dt) {},
}); });
{
"ver": "2.3.5",
"uuid": "e47c7377-6024-4d80-bdaa-08f6128d6e09",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1136,
"height": 22,
"platformSettings": {},
"subMetas": {
"bg_di": {
"ver": "1.0.4",
"uuid": "e8357659-1266-4376-88ef-a3121f71ee34",
"rawTextureUuid": "e47c7377-6024-4d80-bdaa-08f6128d6e09",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1136,
"height": 22,
"rawWidth": 1136,
"rawHeight": 22,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "4808ebb7-71dc-437e-94bb-b3bbc856c79b",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1136,
"height": 22,
"platformSettings": {},
"subMetas": {
"bg_tiao": {
"ver": "1.0.4",
"uuid": "60a74a74-2d69-49e3-ba49-b1f31fb0f5a1",
"rawTextureUuid": "4808ebb7-71dc-437e-94bb-b3bbc856c79b",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 1136,
"height": 22,
"rawWidth": 1136,
"rawHeight": 22,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
This diff is collapsed.
...@@ -48,22 +48,52 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -48,22 +48,52 @@ export default class SceneComponent extends MyCocosSceneComponent {
// this.initIcon(); // this.initIcon();
} }
playBtn;
pauseBtn;
initBtn() { initBtn() {
const canvas = cc.find("Canvas"); const canvas = cc.find("Canvas");
const jumpBtn = cc.find("Canvas/btn_skip"); //this.getSprNode('btn_right'); const jumpBtn = cc.find("Canvas/btn_skip"); //this.getSprNode('btn_right');
jumpBtn.on('touchstart', () => { jumpBtn.on('touchstart', () => {
this.videoPlayEnd(); this.videoPlayEnd();
}) })
// jumpBtn.parent = canvas;
// jumpBtn.anchorX = 1;
// jumpBtn.anchorY = 1;
// jumpBtn.x = canvas.width / 2;
// jumpBtn.y = canvas.height / 2;
const playBtn = cc.find('Canvas/btn_play');
playBtn.on('click', () => {
console.log(' in click 1')
this.video.play();
this.refreshBtnState();
})
playBtn.zIndex = 10;
this.playBtn = playBtn;
this.playBtn.active = false;
const pauseBtn = cc.find('Canvas/btn_pause');
pauseBtn.on('click', () => {
console.log(' in click 2')
this.video.pause();
this.refreshBtnState();
})
pauseBtn.zIndex = 10;
this.pauseBtn = pauseBtn;
this.pauseBtn.active = false;
}
async refreshBtnState() {
await asyncDelay(0.01);
if (this.video.isPlaying()) {
this.pauseBtn.active = true;
this.playBtn.active = false;
} else {
this.pauseBtn.active = false;
this.playBtn.active = true;
}
} }
...@@ -152,7 +182,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -152,7 +182,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
// return; // return;
// } // }
video.play(); video.play();
checkIsPlaying(); this.refreshBtnState();
// checkIsPlaying();
}) })
const checkIsPlaying = () => { const checkIsPlaying = () => {
...@@ -227,7 +259,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -227,7 +259,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
// return; // return;
// } // }
video.play(); video.play();
checkIsPlaying(); this.refreshBtnState();
// checkIsPlaying();
}) })
const checkIsPlaying = () => { const checkIsPlaying = () => {
...@@ -450,9 +483,9 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -450,9 +483,9 @@ export default class SceneComponent extends MyCocosSceneComponent {
percent = percent < 0 ? 0 : percent; percent = percent < 0 ? 0 : percent;
percent = percent > 1 ? 1 : percent; percent = percent > 1 ? 1 : percent;
console.log('this.video.currentTime: ', this.video.currentTime); // console.log('this.video.currentTime: ', this.video.currentTime);
console.log('this.video.getDuration(): ', this.video.getDuration()); // console.log('this.video.getDuration(): ', this.video.getDuration());
console.log('percent: ', percent); // console.log('percent: ', percent);
this.progressJs.setProgress(percent); this.progressJs.setProgress(percent);
} }
} }
......
{
"ver": "2.3.5",
"uuid": "c1e47358-d474-4fa5-bc0c-c0fe545374fc",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 90,
"height": 90,
"platformSettings": {},
"subMetas": {
"btn_play": {
"ver": "1.0.4",
"uuid": "b3f36e9c-7645-4a72-b831-b3456be17fc7",
"rawTextureUuid": "c1e47358-d474-4fa5-bc0c-c0fe545374fc",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 90,
"height": 90,
"rawWidth": 90,
"rawHeight": 90,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "9134e709-56e6-4504-ad19-a7b5ef3f7519",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 90,
"height": 90,
"platformSettings": {},
"subMetas": {
"btn_stop": {
"ver": "1.0.4",
"uuid": "fde96e9d-780a-4322-a13a-88a834e944d2",
"rawTextureUuid": "9134e709-56e6-4504-ad19-a7b5ef3f7519",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 90,
"height": 90,
"rawWidth": 90,
"rawHeight": 90,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "da9aa884-5886-4107-89c8-e87509b435bd",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 35,
"height": 35,
"platformSettings": {},
"subMetas": {
"icon_point": {
"ver": "1.0.4",
"uuid": "726627f7-8e16-48da-9461-d69400adcd48",
"rawTextureUuid": "da9aa884-5886-4107-89c8-e87509b435bd",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 35,
"height": 35,
"rawWidth": 35,
"rawHeight": 35,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment