起言:在通过layaair技术开发游戏之前最好对TS和es6有一定的了解。
一、LayaBox引擎开发各组件作用
文档地址:http://ldc.layabox.com/
二、开发过程遇到的问题
1.tab切换(常用在排行,功能切换等方面)
this.topTab.selectHandler = new Laya.Handler(this, this.onTabSelected);//选中时执行函数
this.topTab.selectedIndex = 1;//设置默认选中下标
this.list.renderHandler = new Laya.Handler(this, this.updateListCell);//修改cell信息是调用,可与其他ui互调
eg:
updateCellInfo(_cell:RebirthRecordCell, _index:number){
_cell.updateCellInfo();
}
this.list.dataSource = [1,2,3,4,5];//数组长度就是加载的cell内容条数
深入:
switch (_index) {
case 0:
this.rankList.dataSource = AllCfg.getInstance().getRankingIds();
break;
case 1:
this.rankList.dataSource = [];
break;
case 2:
this.rankList.dataSource = this._worldRankData;
break;
default:
break;
}//切换时候重新渲染
2.抽奖功能
//可以利用tween 动作
Laya.Tween.to(this.rotatePart, {rotation:rotation}, 5000, Laya.Ease.cubicOut,Laya.Handler.create(this,this.tencost_onTweeed, [_response["data"]["spinItems"]]));