123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import { _decorator, Component, Node, tween, Vec3 } from 'cc';
- import GBoardChess from '../Game/ChessGame/GBoardChess';
- import UIDialog from '../Game/UIDialog';
- import { GameMng } from '../GameMng';
- import AudioMng from '../gcommon/AudioMng';
- import ScenceMng from '../gcommon/ScenceMng';
- import { UIButton } from '../gcommon/UIButton';
- import { UIManager } from '../gcommon/UIManager';
- const { ccclass, property } = _decorator;
- @ccclass('chess_btns')
- export class chess_btns extends Component {
- @property(Node)
- btn_caidan:Node=null; //菜单
- @property(Node)
- btn_huiqi:Node=null; //悔棋
- @property(Node)
- btn_tishi:Node=null;//提示
- @property(Node)
- btn_duiju:Node=null;//对局分析
- @property(Node)
- caidan_list:Node=null;//菜单列表
- @property(Node)
- cd_btn_quit:Node=null; //退出
- @property(Node)
- cd_btn_tihe:Node=null; //提和
- @property(Node)
- cd_btn_renshu:Node=null; //认输
- @property(Node)
- cd_btn_chonglai:Node=null; //重来
- @property(Node)
- cd_btn_shezhi:Node=null; //设置
- start() {
- UIButton.BindClick(this.btn_caidan,()=>{
- if(this.caidan_list.active){
- this.caidan_list.active= false;
- return
- }
- this.caidan_list.scale = new Vec3(0,0,0)
- this.caidan_list.active = true;
- tween()
- .target(this.caidan_list)
- .to(0.2,{scale:new Vec3(1.1,1.1,1)})
- .delay(0.2)
- .call(()=>{
- this.caidan_list.scale = new Vec3(1,1,1)
- })
- .start()
- },this);
- UIButton.BindClick(this.btn_huiqi,()=>{
- this.onClickQuit();
- GBoardChess.instance.retract()
- },this);
- UIButton.BindClick(this.btn_tishi,()=>{
- this.onClickQuit();
- GBoardChess.instance.tishi()
- },this);
- UIButton.BindClick(this.btn_duiju,()=>{
-
- },this);
- this.initCaiDanListBtsEvent();
- }
- initCaiDanListBtsEvent(){
- UIButton.BindClick(this.cd_btn_quit,()=>{
- this.onClickQuit();
- UIDialog.Show(()=>{
- GBoardChess.instance.recvQuit({type:0})
- },()=>{
- },"是否确定退出",GBoardChess.instance.uiLayer,true)
- },this);
- UIButton.BindClick(this.cd_btn_tihe,()=>{
- this.onClickQuit();
- GBoardChess.instance.heqi()
- },this);
- UIButton.BindClick(this.cd_btn_renshu,()=>{
-
- },this);
- UIButton.BindClick(this.cd_btn_chonglai,()=>{
- this.onClickQuit();
- GBoardChess.instance.restartGame()
- },this);
- UIButton.BindClick(this.cd_btn_shezhi,()=>{
- this.onClickQuit();
- UIManager.AddPrefab(GameMng.Instance.uiChessSettingView)
- },this);
- }
- onClickQuit(){
- this.caidan_list.active = false;
- }
- update(deltaTime: number) {
-
- }
- }
|