1234567891011121314151617181920212223242526272829303132333435363738394041 |
- const QuestApi = require('../net/QuestApi');
- cc.Class({
- extends: cc.Component,
- properties: {
- // questItem: {
- // default: null,
- // type: cc.Node,
- // },
- questWrap: {
- tooltip: '每日任务容器',
- default: null,
- type: cc.Node
- },
- questItem: cc.Prefab
- },
- onLoad () {},
- init (quest) {
- this.quest = quest;
- QuestApi.getMainTask((responseData) => {
- let tasks = responseData.tasks;
- for(let i = 0; i < tasks.length; i++) {
- let item = cc.instantiate(this.questItem);
- this.questWrap.addChild(item);
- item.getComponent('QuestMainItem').init(this, tasks[i].list, tasks[i].sn, i);
- }
- }, (error) => {
- console.log('maintask error' + error);
- });
- },
- start () {
- },
- // update (dt) {},
- });
|