LayaAir開發


起言:在通過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"]]));

 

  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM