Commit 90cee03c authored by limingzhe's avatar limingzhe

fix: debug

parent 770b04a2
......@@ -8,7 +8,7 @@
import { getSprNodeByUrl, setSprNodeMaxLen } from "./util";
const {ccclass, property} = cc._decorator;
const { ccclass, property } = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
......@@ -36,7 +36,7 @@ export default class NewClass extends cc.Component {
// onLoad () {}
start () {
start() {
this.initData();
this.initView();
}
......@@ -46,50 +46,53 @@ export default class NewClass extends cc.Component {
{
type: "music",
iconRes: "btn_music",
text_cn:"拼读儿歌",
text_en:"Music",
text_cn: "拼读儿歌",
text_en: "Music",
},
{
type: "class",
iconRes: "btn_class",
text_cn:"外教课堂",
text_en:"Class",
text_cn: "外教课堂",
text_en: "Class",
},
{
type: "chant",
iconRes: "btn_chant",
text_cn:"律动时光",
text_en:"Chant",
text_cn: "律动时光",
text_en: "Chant",
},
{
type: "practice",
iconRes: "btn_practice",
text_cn:"闯关练习",
text_en:"Practice",
text_cn: "闯关练习",
text_en: "Practice",
},
{
type: "video",
iconRes: "btn_video",
text_cn:"场景动画",
text_en:"Video",
text_cn: "场景动画",
text_en: "Video",
},
{
type: "review",
iconRes: "btn_review",
text_cn:"故事复述",
text_en:"Review",
text_cn: "故事复述",
text_en: "Review",
isLock: true,
},
{
type: "speaking",
iconRes: "btn_speaking",
text_cn:"外教带读",
text_en:"Speaking",
text_cn: "外教带读",
text_en: "Speaking",
isLock: true,
},
{
type: "show",
iconRes: "btn_show",
text_cn:"外教带读",
text_en:"My Show",
text_cn: "外教带读",
text_en: "My Show",
isLock: true,
},
]
}
......@@ -120,7 +123,7 @@ export default class NewClass extends cc.Component {
const listItem = cc.find("view/content/item", this.scrollView);
const itemArr = [];
for (let i=0; i<dataArr.length; i++) {
for (let i = 0; i < dataArr.length; i++) {
const data = dataArr[i];
......@@ -128,11 +131,11 @@ export default class NewClass extends cc.Component {
itemNode['data'] = data;
const iconNodeBase = cc.find(data.iconRes , this.resNode);
const iconLockedBase = cc.find(data.iconRes + "_locked" , this.resNode);
const iconNodeBase = cc.find(data.iconRes, this.resNode);
const iconLockedBase = cc.find(data.iconRes + "_locked", this.resNode);
const iconNode = cc.instantiate( iconNodeBase );
const iconLocked = cc.instantiate( iconLockedBase );
const iconNode = cc.instantiate(iconNodeBase);
const iconLocked = cc.instantiate(iconLockedBase);
const picLayer = cc.find("pic_layer", itemNode);
......@@ -158,22 +161,43 @@ export default class NewClass extends cc.Component {
const lock = cc.find("icon_lock", itemNode);
lock.active = false;
const isLocked = Math.floor( Math.random() * 2);
const isLocked = data.isLock;
if (isLocked) {
iconLocked.active = true;
lock.active = true;
}
itemNode.addComponent(cc.Button);
itemNode.on("click", () => {
switch(data.type) {
case "music":
this.musicCardClick();
break;
}
})
itemArr.push(itemNode);
}
return itemArr;
}
musicCardClick() {
if ( global.middleLayer ) {
const middleLayer = cc.find("middleLayer");
middleLayer.active = false;
console.log('middleLayer: ', middleLayer);
global.middleLayer.loadOnlineCourseWare(20522);
}
}
initScrollViewItem(sv, itemArr, row=1) {
initScrollViewItem(sv, itemArr, row = 1) {
sv.scrollToTop();
const content = sv.content;
......@@ -192,7 +216,7 @@ export default class NewClass extends cc.Component {
let lastX = baseX;
for (let i=0; i<itemArr.length; i++) {
for (let i = 0; i < itemArr.length; i++) {
const item = itemArr[i];
......
......@@ -41,8 +41,8 @@ export default class NewClass extends cc.Component {
// this._currentViewNode = this.loginPage;
// this._currentViewName = "LoginPage"
this._currentViewNode = this.libraryReadPage;
this._currentViewName = "LibraryReadPage"
this._currentViewNode = this.missionPage;
this._currentViewName = "MissionPage"
this._currentViewNode.active = true;
}
......
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