import GameData from "../../gcommon/GameData"; import { Singleton } from "../../gcommon/Singleton"; import { GameConst } from "../../GameConst"; export interface CanjuData{ fen:string, name:string } export default class CanjuModel extends Singleton() { public canjuDataArr:CanjuData[]=[] public get canjuData(){ return this.canjuDataArr[this.selectLv-1]; } selectLv:number=1; getCurMaxLevel(){ var lv= GameData.GetCustomData(GameConst.canjuLevel); return Math.max(1,lv); } setNewMaxLevel(lv:number){ GameData.SetCustomData(GameConst.canjuLevel,lv) } updateMaxLevel(value:number=1){ var lv=this.getCurMaxLevel(); lv+=value; lv=Math.min(lv,this.MaxLv) this.setNewMaxLevel(lv); } selectNextLv(){ if(this.selectLv=index+1 } }