123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- import AudioMng from "../../gcommon/AudioMng";
- import { UIButton } from "../../gcommon/UIButton";
- import GameData from "../../gcommon/GameData";
- import ScenceMng from "../../gcommon/ScenceMng";
- import { GameMng } from "../../GameMng";
- import CanjuModel from "../ChessCanJuSel/CanjuModel";
- import UICanJuSel from "../ChessCanJuSel/UICanJuSel";
- import ChessMng, { ChessType } from "../DiffSel/ChessMng";
- import UIDiffSel from "../DiffSel/UIDiffSel";
- import GBoardChess from "./GBoardChess";
- import { Vec3,tween,UITransform ,_decorator ,Component,Label,Node,instantiate,Animation,Prefab,Sprite, director, Director} from "cc";
- const {ccclass, property} = _decorator;
- @ccclass
- export default class UIEndChess extends Component {
- @property(Animation)
- winAnimation:Animation=null;
- @property(Animation)
- failAnimation:Animation=null;
- @property(Node)
- btnRestart: Node = null;
- @property(Node)
- btnMoreLv: Node = null;
- @property(Node)
- btnback: Node = null;
- @property(Node)
- winSp: Node = null;
- @property(Node)
- failSp: Node = null;
- @property(Label)
- endtimelabel: Label = null;
- @property(Label)
- bushulabel: Label = null;
- start(){
-
- UIButton.BindClick(this.btnMoreLv, () => {
- if(ChessMng.Instance.chesstype==ChessType.renjiboyi)
- UIDiffSel.selectIndex++;
- else if(ChessMng.Instance.chesstype==ChessType.canju){
- CanjuModel.Instance.selectNextLv();
- }
-
- this.node.active=false;
- GBoardChess.instance.restartGame();
- }, this);
- UIButton.BindClick(this.btnRestart, () => {
- this.node.active=false;
- GBoardChess.instance.restartGame();
- }, this);
- }
- setData(result:number,time:string,bushu:number){
- this.endtimelabel.string=time;
- this.bushulabel.string=bushu.toString();
-
- if(result==0){
- AudioMng.Instance.PlaySoundByName(GameMng.Instance.winclip);
- this.winSp.active=true;
- this.failSp.active=false;
-
- this.winAnimation.play('win');
- if(ChessMng.Instance.chesstype==ChessType.renjiboyi)
- {
- if(UIDiffSel.selectIndex<UIDiffSel.lvArr.length-1)
- {
- this.btnMoreLv.active=true;
- }
- else this.btnMoreLv.active=false;
- }
- else if(ChessMng.Instance.chesstype==ChessType.canju)
- {
- if (CanjuModel.Instance.selectLv == CanjuModel.Instance.getCurMaxLevel()) {
- CanjuModel.Instance.updateMaxLevel()
- }
-
- this.btnMoreLv.active=true;
-
- }
-
- GameData.SaveGame();
- }
- else{
- AudioMng.Instance.PlaySoundByName(GameMng.Instance.failclip);
- this.winSp.active=false;
- this.failSp.active=true;
- this.failAnimation.play('win');
- this.btnMoreLv.active=false;
- }
-
- }
- }
|