CellCanJuSel.ts 926 B

123456789101112131415161718192021222324252627282930313233
  1. import { UIButton } from "../../gcommon/UIButton";
  2. import ScenceMng from "../../gcommon/ScenceMng";
  3. import UIDiffSel from "../DiffSel/UIDiffSel";
  4. import CanjuModel from "./CanjuModel";
  5. import { _decorator ,Component,Label,Node} from "cc";
  6. const {ccclass, property} = _decorator;
  7. @ccclass
  8. export default class CellCanJuSel extends Component {
  9. @property(Node)
  10. lock:Node=null;
  11. private index:number=0;
  12. @property(Label)
  13. label: Label = null;
  14. start(){
  15. UIButton.BindClick(this.node,()=>{
  16. if(!CanjuModel.Instance.isUnlock(this.index))return;
  17. CanjuModel.Instance.selectLv=this.index+1;
  18. UIDiffSel.selectIndex=0;//固定一下难度
  19. ScenceMng.Instance.load('Chess')
  20. },this);
  21. }
  22. setData(i:number){
  23. this.index=i;
  24. this.lock.active=!CanjuModel.Instance.isUnlock(this.index);
  25. this.label.string=""+(i+1);
  26. }
  27. }