import { UIButton } from "../../gcommon/UIButton"; import { GameMng } from "../../GameMng"; import CanjuModel from "./CanjuModel"; import CellCanJuSel from "./CellCanJuSel"; import { _decorator ,Component,Label,Node,instantiate} from "cc"; const {ccclass, property} = _decorator; @ccclass export default class UICanJuSel extends Component { @property({ type: Node }) public content: Node | null = null; private maxGridNum=12; private allPageNum=0; private curPage:number=1; @property(Node) btnNext: Node = null; @property(Node) btnUp: Node = null; start(){ UIButton.BindClick(this.btnNext,()=>{ this.nextPage(); },this); UIButton.BindClick(this.btnUp,()=>{ this.upPage(); },this); this.initUI(); } initUI(){ for(let i=0;i1) this.curPage--; this.selectPage(this.curPage); } selectPage(pagenum:number){ this.btnUp.active=pagenum!=1; if(pagenum>this.allPageNum)return; let count=this.maxGridNum; if(pagenum==this.allPageNum){ let yushu=CanjuModel.Instance.canjuDataArr.length%this.maxGridNum; if(yushu!=0) count=yushu; } this.content.removeAllChildren(); // let startIndex=(pagenum-1)*this.maxGridNum; if(pagenum>=this.allPageNum){ this.btnNext.active=false; } else{ this.btnNext.active=true; } for(let i=0;i