Commit 587ba882 authored by liujiaxin's avatar liujiaxin

fix: btn overlay

parent d64588c0
......@@ -169,16 +169,22 @@ cc.Class({
pressedSF = b.pressedSprite;
const anim = this.showImageNode.getChildByName('image').getComponent(cc.Animation);
let canClick = true;
let b4ClickIsPlaying = false;
anim.on(cc.Animation.EventType.FINISHED, (evt, state) => {
const {width,height, scale} = this.showImageNode.getChildByName('image')
console.log(555, width,height, scale)
// console.log(555, width,height, scale)
canClick = true;
if (state.name === 'popout') {
this.showImageNode.active = true;
} else {
this.showImageNode.active = false;
if (b4ClickIsPlaying) {
this.lrc.resume();
b4ClickIsPlaying = false;
}
}
})
this.showImageButton.on(cc.Node.EventType.TOUCH_START, (event) => {
......@@ -189,6 +195,10 @@ cc.Class({
this.showImageNode.active = true;
canClick = false;
const btn = event.currentTarget;
if (!b4ClickIsPlaying) {
b4ClickIsPlaying = this.lrc.isCurrentAudioSourcePlaying();
}
// const animClip = anim.getClips()[0]
const b = btn.getComponent(cc.Button);
......@@ -262,6 +272,7 @@ cc.Class({
setTimeout(() => {
if (this.titleLable.node.width > this.titleLable.node.parent.width) {
this.titleLable.node.scale = this.titleLable.node.parent.width / this.titleLable.node.width;
console.log('this.titleLable.node.scale', this.titleLable.node.scale);
}
}, 0);
}
......@@ -303,6 +314,21 @@ cc.Class({
// cc.log("This is a callback after the trigger event", event);
})
});
// const btn1 = cc.find('Canvas/BodyContainer/LRCComponent/buttons-group/mode3')
// btn1.actionStatus = this.BUTTON_STATUS.IDLE;
// btn1.addComponent(cc.Button)
// btn1.on('click', (event) => {
// const btn = event.currentTarget;
// this.buttonGroupChange(btn)
// // cc.log("This is a callback after the trigger event", event);
// }) ;
// const btn2 = cc.find('Canvas/BodyContainer/LRCComponent/buttons-group/mode1')
// btn2.actionStatus = this.BUTTON_STATUS.IDLE;
// btn2.on(cc.Node.EventType.TOUCH_START, (event) => {
// const btn = event.currentTarget;
// this.buttonGroupChange(btn)
// // cc.log("This is a callback after the trigger event", event);
// }) ;
},
......@@ -392,15 +418,20 @@ cc.Class({
update (dt) {
if (this.lrc) {
// const sts = this.lrc.getCurrentAudioState();
const sts = this.lrc.isCurrentAudioSourcePlaying();
if (sts /*sts === cc.audioEngine.AudioState.PLAYING*/ ) {
this.setPlayButtonStatus(this.BUTTON_STATUS.ACTIVE);
// this.lastButtonStateCache = this.BUTTON_STATUS.ACTIVE
const playing = this.lrc.isCurrentAudioSourcePlaying();
btnsts = this.BUTTON_STATUS.IDLE
if (playing) {
btnsts = this.BUTTON_STATUS.ACTIVE
// this.setPlayButtonStatus(this.BUTTON_STATUS.ACTIVE);
} else {
this.setPlayButtonStatus(this.BUTTON_STATUS.IDLE);
// this.lastButtonStateCache = this.BUTTON_STATUS.IDLE
// this.setPlayButtonStatus(this.BUTTON_STATUS.IDLE);
}
if (this.actionButton.node.buttonStatus === btnsts ) {
return
}
this.setPlayButtonStatus(btnsts)
}
},
});
This diff is collapsed.
......@@ -88,7 +88,7 @@ cc.Class({
getDefaultData() {
const data = {"title":"aaaaa","pic_url":"http://staging-teach.cdn.ireadabc.com/7324245447e15cca42e0d4c88a32f88a.jpg","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/4a59032f9b5f726cb2cde2178a7f51fc.mp3",
const data = {"title":"Listen number read and write","pic_url":"http://staging-teach.cdn.ireadabc.com/7324245447e15cca42e0d4c88a32f88a.jpg","accompany_audio_url":"http://staging-teach.cdn.ireadabc.com/4a59032f9b5f726cb2cde2178a7f51fc.mp3",
"lrcData":{
"audio_url":"http://staging-teach.cdn.ireadabc.com/1d1184717ebff259c72fedcb6b249431.mp3",
"fontSize":50,"lineHeight":100,
......@@ -98,7 +98,8 @@ cc.Class({
{"time":19.31,"data":"挂在天上放光明","newLine":true},
{"time":23.62,"data":"好像许多小眼睛","newLine":true},
{"time":27.93,"data":"一闪一闪亮晶晶","newLine":true},
{"time":32.32,"data":"满天都是小星星","newLine":true},{"time":41.1,"data":"一闪一闪亮晶晶","newLine":true},{"time":45.45,"data":"满天都是小星星","newLine":true},{"time":49.74,"data":"挂在天上放光明","newLine":true},{"time":54.16,"data":"好像许多小眼睛","newLine":true},{"time":58.39,"data":"一闪一闪亮晶晶","newLine":true},{"time":62.9,"data":"满天都是小星星","newLine":true},{"time":76.36,"data":"一闪一闪亮晶晶","newLine":true},{"time":80.28,"data":"满天都是小星星","newLine":true},{"time":84.65,"data":"挂在天上放光明","newLine":true},{"time":88.92,"data":"好像许多小眼睛","newLine":true},{"time":93.41,"data":"一闪一闪亮晶晶","newLine":true},{"time":97.72,"data":"满天都是小星星","newLine":true}]},"title_audio_url":"http://staging-teach.cdn.ireadabc.com/39065c5f63a31bd1433c1a046e407a98.mp3"}
{"time":32.32,"data":"满天都是小星星","newLine":true},{"time":41.1,"data":"一闪一闪亮晶晶","newLine":true},{"time":45.45,"data":"满天都是小星星","newLine":true},{"time":49.74,"data":"挂在天上放光明","newLine":true},{"time":54.16,"data":"好像许多小眼睛","newLine":true},{"time":58.39,"data":"一闪一闪亮晶晶","newLine":true},{"time":62.9,"data":"满天都是小星星","newLine":true},{"time":76.36,"data":"一闪一闪亮晶晶","newLine":true},{"time":80.28,"data":"满天都是小星星","newLine":true},{"time":84.65,"data":"挂在天上放光明","newLine":true},{"time":88.92,"data":"好像许多小眼睛","newLine":true},{"time":93.41,"data":"一闪一闪亮晶晶","newLine":true},{"time":97.72,"data":"满天都是小星星","newLine":true}]},
"title_audio_url":"http://staging-teach.cdn.ireadabc.com/c42408cda175ea4b754b47bba6eeb692.mp3"}
// if (data.picArr) {
......
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