Commit f152a1f5 authored by liujiaxin's avatar liujiaxin

fix: ccc 2.4.0 bug

parent 99758a88
...@@ -156,7 +156,7 @@ cc.Class({ ...@@ -156,7 +156,7 @@ cc.Class({
cc.director.on('GAME_RESOURCE_LOADED', (preloadedData) => { cc.director.on('GAME_RESOURCE_LOADED', (preloadedData) => {
this.lrc.initialize(); this.lrc.initialize(preloadedData);
this.showImageNode.active = false; this.showImageNode.active = false;
if (this.pic_url) { if (this.pic_url) {
cc.assetManager.loadRemote(this.pic_url, (err, spriteFrame) => { cc.assetManager.loadRemote(this.pic_url, (err, spriteFrame) => {
......
...@@ -98,10 +98,15 @@ cc.Class({ ...@@ -98,10 +98,15 @@ cc.Class({
initialize() { initialize(preloadedData) {
console.log('initialize'); console.log('initialize');
const t1 = Date.now()
// const aitem = preloadedData.find(item => {
// return item.url == this.audio_url
// });
if (this.audio_url) { if (this.audio_url) {
cc.assetManager.loadRemote(this.audio_url, (err, audioClip) => { cc.assetManager.loadRemote(this.audio_url, (err, audioClip) => {
console.log(Date.now() - t1);
if(err) { if(err) {
// TODO handle error // TODO handle error
return; return;
...@@ -122,8 +127,8 @@ cc.Class({ ...@@ -122,8 +127,8 @@ cc.Class({
// audioEngine.setVolume(this.currentAudioId, 1); // audioEngine.setVolume(this.currentAudioId, 1);
this.resetLRC(); // this.resetLRC();
this.renderHighlight(); // this.renderHighlight();
// this.currentAudioId = audioEngine.play(audioClip, false, 1); // this.currentAudioId = audioEngine.play(audioClip, false, 1);
...@@ -194,6 +199,18 @@ cc.Class({ ...@@ -194,6 +199,18 @@ cc.Class({
// this.node.height = area.rect.width; // this.node.height = area.rect.width;
// this.node.parent.zIndex = 99999 // this.node.parent.zIndex = 99999
this.richText.node = new Proxy(this.richText.node , {
set: function(obj, key, val){
obj[key] = val;
return true;
},
get: function(obj, key){
return obj[key]
}
})
const karaokeConf = gameData.lrcData const karaokeConf = gameData.lrcData
this._lrcData = karaokeConf.lyrics; this._lrcData = karaokeConf.lyrics;
...@@ -559,7 +576,7 @@ cc.Class({ ...@@ -559,7 +576,7 @@ cc.Class({
justifyContentPosition(){ justifyContentPosition(){
let {height: h} = this.calcHighlightRichText.node.getContentSize(); let {height: h} = this.calcHighlightRichText.node.getContentSize();
if (this.magicHeight === null) { if (this.magicHeight === null) {
this.magicHeight = h - this.richText.lineHeight; this.magicHeight = h - this.richText.lineHeight; // this.richText._labelHeight
} }
// let sw = 0; // let sw = 0;
// let sh = 0; // let sh = 0;
...@@ -570,13 +587,17 @@ cc.Class({ ...@@ -570,13 +587,17 @@ cc.Class({
// this.calcSentenceRichText.string = ''; // this.calcSentenceRichText.string = '';
// h = Math.min(h, h - sh + this.node.h) // h = Math.min(h, h - sh + this.node.h)
// } // }
if (this.richText.node.height > this.node.height) { if (this.richText._labelHeight > this.node.height) {
let posY = (this.node.height - this.richText.node.height ) / 2; let posY = (this.node.height - this.richText._labelHeight ) / 2;
if (h > this.node.height){ if (h > this.node.height){
posY = posY + (h - this.node.height); posY = posY + (h - this.node.height);
} }
const b4 = this.richText.node.y;
// setTimeout(() => {
this.richText.node.y = posY;// + this.magicHeight; this.richText.node.y = posY;// + this.magicHeight;
// }, 0)
// console.log('this.richText.node.y',b4 , this.richText.node.y, posY)
} }
}, },
findSentenceIndexByWords(s, sentenceIndexObj) { findSentenceIndexByWords(s, sentenceIndexObj) {
...@@ -761,7 +782,9 @@ cc.Class({ ...@@ -761,7 +782,9 @@ cc.Class({
this.calcHighlightRichText.string = textForCalc; this.calcHighlightRichText.string = textForCalc;
this.richText.string = `${textForCalc}${remained}`; this.richText.string = `${textForCalc}${remained}`;
// console.log(this.richText.node.getContentSize()); // console.log(this.richText.node.getContentSize());
// setTimeout(() => {
this.justifyContentPosition(); this.justifyContentPosition();
// }, 0)
// } // }
}, },
...@@ -969,7 +992,7 @@ cc.Class({ ...@@ -969,7 +992,7 @@ cc.Class({
}, },
resume() { resume() {
const adSrc = this.getCurrentPlayingSource(); const adSrc = this.getCurrentPlayingSource();
const ct = adSrc.getCurrentTime(); const ct = adSrc && adSrc.getCurrentTime();
if (this.__currentInteractivateMode == this.PLAY_MODE.MODE2) { if (this.__currentInteractivateMode == this.PLAY_MODE.MODE2) {
if (!this.playByTimePhaseStep) { if (!this.playByTimePhaseStep) {
this.playByTimePhaseStep = this.MODE2_STEP.ONE; this.playByTimePhaseStep = this.MODE2_STEP.ONE;
......
This diff is collapsed.
...@@ -88,7 +88,17 @@ cc.Class({ ...@@ -88,7 +88,17 @@ cc.Class({
getDefaultData() { 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","lrcData":{"audio_url":"http://staging-teach.cdn.ireadabc.com/1d1184717ebff259c72fedcb6b249431.mp3","fontSize":50,"lineHeight":100,"lyrics":[{"time":11.09,"data":"yi shan yi shan liang jing jing","newLine":true},{"time":14.9,"data":"满天都是小星星","newLine":true},{"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"} 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",
"lrcData":{
"audio_url":"http://staging-teach.cdn.ireadabc.com/1d1184717ebff259c72fedcb6b249431.mp3",
"fontSize":50,"lineHeight":100,
"lyrics":[
{"time":11.09,"data":"yi shan yi shan liang jing jing","newLine":true},
{"time":14.9,"data":"1111满天都是小星星","newLine":true},
{"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"}
// if (data.picArr) { // if (data.picArr) {
...@@ -108,7 +118,7 @@ cc.Class({ ...@@ -108,7 +118,7 @@ cc.Class({
console.log(' preload data, ', data); console.log(' preload data, ', data);
// typeof // typeof
this.loadEnd(); this.loadEnd(data);
if (window && window["air"]) { if (window && window["air"]) {
window["air"].hideAirClassLoading(); window["air"].hideAirClassLoading();
} }
......
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