Commit f1e39bae authored by 李维's avatar 李维

合并发音显示列表

parent 235d5aa0
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -34,8 +34,9 @@ export default class NewClass extends cc.Component {
@property(cc.Node)
stars: cc.Node = null;
// 语音Item 模板
@property(cc.Node)
scentenceItem: cc.Node = null;
pronounceItem: cc.Node = null;
@property(cc.Node)
storyItem: cc.Node = null;
@property(cc.Node)
......@@ -72,12 +73,16 @@ export default class NewClass extends cc.Component {
nd_storyHFWord: cc.Node = null;
@property(cc.Node)
nd_storyStory: cc.Node = null;
@property(cc.Node)
nd_procA: cc.Node = null;
@property(cc.Node)
nd_procB: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
m_sentenceNodeList = []
onLoad() {
this.scentenceItem.active = false
this.pronounceItem.active = false
this.storyItem.zIndex = 111
this.itemCnt.zIndex = -1
}
......@@ -106,7 +111,7 @@ export default class NewClass extends cc.Component {
this.title.string = _data.name
this.unit.string = _data.unitName
this.last_play.string = lastDate ? `${dateFormate("yyyy.MM.dd", lastDate)} 学习过` : "未学过1"
this.question_right_percent1.string = _data.question_right_percent // 正确率 - 白色描边
this.question_right_percent1.string = ""; // _data.question_right_percent // 正确率 - 白色描边
this.question_right_percent2.string = _data.question_right_percent // 正确率 - 主体红字
this.study_duration.string = _data.study_duration > 999 ? Math.floor(_data.study_duration / 60 * 10) / 10 : _data.study_duration // 学习时长
this.study_duration_unit.string = _data.study_duration > 999 ? "小时" : "分钟";
......@@ -119,12 +124,13 @@ export default class NewClass extends cc.Component {
}
this.m_sentenceNodeList = []
this.nd_procA.active = _data.excellents.length != 0;
for (let v of _data.excellents) {
this.m_sentenceNodeList.push(this.createItem(v, "优秀发音"))
this.m_sentenceNodeList.push(this.createItem(v, this.nd_procA))
}
this.nd_procB.active = _data.tryagains.length != 0;
for (let v of _data.tryagains) {
this.m_sentenceNodeList.push(this.createItem(v, "薄弱跟读"))
this.m_sentenceNodeList.push(this.createItem(v, this.nd_procB))
}
// 句子
......@@ -189,16 +195,24 @@ export default class NewClass extends cc.Component {
this.reportSV.scrollToTop()
}
createItem(v, titleStr) {
let _node = cc.instantiate(this.scentenceItem)
createItem(v, parent) {
let _node = cc.instantiate(this.pronounceItem)
_node.active = true
this.content.addChild(_node)
parent.addChild(_node)
// 星星的判定标准需要改
for (let i = 1; i <= 3; i++) {
_node.getChildByName(`star${i}`).active = v.overall >= i * 33
// 高亮
_node.getChildByName(`active_star${i}`).active = v.overall >= i * 33;
// 非高亮
_node.getChildByName(`star${i}`).active = v.overall < i * 33
}
_node.getChildByName("lbl").getComponent(cc.Label).string = v.test_text
_node.getChildByName("title").getComponent(cc.Label).string = titleStr
// 判断一下字数,超长以后截掉,补省略号
let contentText = v.test_text;
if(contentText.length > 22) {
contentText = contentText.substring(0, 22) + "..."
}
_node.getChildByName("lbl").getComponent(cc.Label).string = contentText
let btn_stop = _node.getChildByName("btn_stop")
let btn_play = _node.getChildByName("btn_play")
......@@ -234,9 +248,11 @@ export default class NewClass extends cc.Component {
});
})
})
btn_stop.on("click", () => {
this.stopAudio()
})
_node.on("stop_audio", () => {
btn_play.active = true
btn_stop.active = false
......
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