You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.5 KiB
74 lines
2.5 KiB
// Learn TypeScript:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
|
|
// Learn Attribute:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
|
|
// Learn life-cycle callbacks:
|
|
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
|
|
|
|
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../FrameWork/Event/EventMgr";
|
|
import User from "../../FrameWork/User/User";
|
|
import List from "../../Platform/th/List";
|
|
import { GameType } from "../PrefabManager/PrefabManage";
|
|
import smallgameItemNode from "./smallgameItemNode";
|
|
|
|
const { ccclass, property } = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class smallgame extends cc.Component {
|
|
@property(List)
|
|
listCJ: List = null;
|
|
dataListCJ: any[];
|
|
|
|
Config = [
|
|
{ title: '接红包', icon: 'res/接红包', savekey: 'smallgamejhb', money: 10, gametype: GameType.SaiChe },
|
|
{ title: '上厕所', icon: 'res/上厕所', savekey: 'smallgamescs', money: 10, gametype: GameType.WcPage },
|
|
{ title: '拼图', icon: 'res/拼图', savekey: 'smallgamept', money: 10, gametype: GameType.PinTuEnter },
|
|
{ title: '佛山电焊', icon: 'res/佛山电焊', savekey: 'smallgamefsdh', money: 10, gametype: GameType.FoShanDianHan },
|
|
{ title: '麻将合十', icon: 'res/麻将合十', savekey: 'smallgamemjhs', money: 10, gametype: GameType.Game_xmj },
|
|
{ title: '三仙归洞', icon: 'res/三仙归洞', savekey: 'smallgamesxgd', money: 10, gametype: GameType.HaoYunBaoPeng },
|
|
|
|
]
|
|
|
|
|
|
// LIFE-CYCLE CALLBACKS:
|
|
|
|
// onLoad () {}
|
|
|
|
start() {
|
|
User.setStatistics("smallgameguide", 1)
|
|
this.init()
|
|
this.scheduleOnce(() => {
|
|
this.setList()
|
|
}, 0.01)
|
|
}
|
|
|
|
init() {
|
|
}
|
|
|
|
setList() {
|
|
let array = this.Config
|
|
this.dataListCJ = []
|
|
for (let n = 0; n < array.length; n++) {
|
|
this.dataListCJ.push(array[n]);
|
|
}
|
|
this.listCJ.numItems = this.dataListCJ.length;
|
|
|
|
// let index = TanWeiManager.getLockItemIndex()
|
|
this.listCJ.scrollTo(0)
|
|
}
|
|
onListMGridRender(item: cc.Node, idx: number) {
|
|
|
|
let config = this.dataListCJ[idx]
|
|
// console.log(config)
|
|
let danItem: smallgameItemNode = item.getComponent('smallgameItemNode')
|
|
danItem.init(config)
|
|
}
|
|
|
|
onTouchClose() {
|
|
this.node.removeFromParent()
|
|
this.node.destroy()
|
|
}
|
|
|
|
// update (dt) {}
|
|
}
|
|
|