|
@@ -92,7 +92,7 @@ export default class Main extends cc.Component {
|
|
|
this.setupCustomImage()
|
|
|
this.initUI()
|
|
|
// this.reset() //没有答题的情况下要注释掉
|
|
|
- // this.reset() //有答题的情况下开放出来
|
|
|
+ this.reset() //有答题的情况下开放出来
|
|
|
|
|
|
this.playBGM(true)
|
|
|
|
|
@@ -124,40 +124,12 @@ export default class Main extends cc.Component {
|
|
|
}
|
|
|
|
|
|
/* 没有答题的情况下抽奖start */
|
|
|
- initUI() {
|
|
|
- this.questionPanel.active = false;
|
|
|
- this.lotteryPanel.active = true;
|
|
|
- this.labelTitle.string = NetManager.getInst().activityName
|
|
|
-
|
|
|
- /*
|
|
|
- const questionData = NetManager.getInst().questions
|
|
|
- this.MAX_QUESTION_NUM = questionData.length
|
|
|
- for (let i = 0; i < questionData.length; ++i) {
|
|
|
- let itemData = questionData[i]
|
|
|
-
|
|
|
- let itemNode = cc.instantiate((itemData.type == 3) ? this.inputQuestionItem : this.optQuestionItem)
|
|
|
- this.questionNode.addChild(itemNode)
|
|
|
-
|
|
|
- let comp = itemNode.getComponent((itemData.type == 3) ? 'InputQuestionItem' : 'OptQuestionItem')
|
|
|
- comp.loadData(i + 1, itemData)
|
|
|
- this.questionCompArr.push(comp)
|
|
|
- }
|
|
|
- */
|
|
|
-
|
|
|
- const rewardTypes = NetManager.getInst().lotteryItems;
|
|
|
- let index = 0
|
|
|
- for (let idx in rewardTypes) {
|
|
|
- this.rewardType[index++].string = rewardTypes[idx]
|
|
|
- }
|
|
|
- }
|
|
|
- /* 没有答题的情况下抽奖end */
|
|
|
-
|
|
|
- /* 有答题的情况下抽奖start */
|
|
|
// initUI() {
|
|
|
- // this.questionPanel.active = true;
|
|
|
- // this.lotteryPanel.active = false;
|
|
|
+ // this.questionPanel.active = false;
|
|
|
+ // this.lotteryPanel.active = true;
|
|
|
// this.labelTitle.string = NetManager.getInst().activityName
|
|
|
//
|
|
|
+ // /*
|
|
|
// const questionData = NetManager.getInst().questions
|
|
|
// this.MAX_QUESTION_NUM = questionData.length
|
|
|
// for (let i = 0; i < questionData.length; ++i) {
|
|
@@ -170,6 +142,7 @@ export default class Main extends cc.Component {
|
|
|
// comp.loadData(i + 1, itemData)
|
|
|
// this.questionCompArr.push(comp)
|
|
|
// }
|
|
|
+ // */
|
|
|
//
|
|
|
// const rewardTypes = NetManager.getInst().lotteryItems;
|
|
|
// let index = 0
|
|
@@ -177,6 +150,33 @@ export default class Main extends cc.Component {
|
|
|
// this.rewardType[index++].string = rewardTypes[idx]
|
|
|
// }
|
|
|
// }
|
|
|
+ /* 没有答题的情况下抽奖end */
|
|
|
+
|
|
|
+ /* 有答题的情况下抽奖start */
|
|
|
+ initUI() {
|
|
|
+ this.questionPanel.active = true;
|
|
|
+ this.lotteryPanel.active = false;
|
|
|
+ this.labelTitle.string = NetManager.getInst().activityName
|
|
|
+
|
|
|
+ const questionData = NetManager.getInst().questions
|
|
|
+ this.MAX_QUESTION_NUM = questionData.length
|
|
|
+ for (let i = 0; i < questionData.length; ++i) {
|
|
|
+ let itemData = questionData[i]
|
|
|
+
|
|
|
+ let itemNode = cc.instantiate((itemData.type == 3) ? this.inputQuestionItem : this.optQuestionItem)
|
|
|
+ this.questionNode.addChild(itemNode)
|
|
|
+
|
|
|
+ let comp = itemNode.getComponent((itemData.type == 3) ? 'InputQuestionItem' : 'OptQuestionItem')
|
|
|
+ comp.loadData(i + 1, itemData)
|
|
|
+ this.questionCompArr.push(comp)
|
|
|
+ }
|
|
|
+
|
|
|
+ const rewardTypes = NetManager.getInst().lotteryItems;
|
|
|
+ let index = 0
|
|
|
+ for (let idx in rewardTypes) {
|
|
|
+ this.rewardType[index++].string = rewardTypes[idx]
|
|
|
+ }
|
|
|
+ }
|
|
|
/* 有答题的情况下抽奖end */
|
|
|
|
|
|
reset() {
|