123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- import { GameMng, quit_chess_show_view } from "../GameMng";
- import { UIButton } from "../gcommon/UIButton";
- import GBaseUI from "../gcommon/GBaseUI";
- import { UIManager } from "../gcommon/UIManager";
- import { _decorator,Node, Label } from "cc";
- import { createFirendRoom } from "./createFirendRoom";
- const {ccclass, property} = _decorator;
- @ccclass
- export default class UIduizhan extends GBaseUI {
- @property(Node)
- btnClose: Node = null;
- @property(Node)
- btnRenji: Node = null;
- @property(Node)
- btnHaoyou: Node = null;
- @property(Node)
- btnJifen: Node = null;
- @property(Node)
- btnTongqian: Node = null;
- @property(Node)
- btnJoinRoom: Node = null;
- @property(Node)
- nodeRenji: Node = null;
- @property(Node)
- labName: Node = null;
- @property(Node)
- nodeJifen: Node = null;
- @property(Node)
- nodeTongqian: Node = null;
- static show_type:quit_chess_show_view = null;
- static Show(type?:quit_chess_show_view){
- UIduizhan.show_type = type
- UIManager.AddPrefab(GameMng.Instance.uiduizhan);
- }
- start () {
- UIButton.BindClick(this.btnClose,()=>{
- this.closeUI();
- },this);
- UIButton.BindClick(this.btnRenji,()=>{
- this.labName.getComponent(Label).string = "人机对战"
- this.nodeRenji.active = true;
- },this);
- UIButton.BindClick(this.btnJifen,()=>{
- this.labName.getComponent(Label).string = "积分场"
- this.nodeJifen.active = true;
- },this);
- UIButton.BindClick(this.btnTongqian,()=>{
- this.labName.getComponent(Label).string = "铜钱场"
- this.nodeTongqian.active = true;
- },this);
- UIButton.BindClick(this.btnJoinRoom,()=>{
- console.log("btnJoinRoom","btnJoinRoom")
- UIManager.AddPrefab(GameMng.Instance.joinRoom,this.node)
- },this);
- UIButton.BindClick(this.btnHaoyou,()=>{
- createFirendRoom.Show(this.node.parent)
- },this);
- if(UIduizhan.show_type!=null){
- switch(UIduizhan.show_type){
- case quit_chess_show_view.haoyou:{
- createFirendRoom.Show(this.node.parent)
- break;
- }
- case quit_chess_show_view.renji:{
- this.labName.getComponent(Label).string = "人机对战"
- this.nodeRenji.active = true;
- break;
- }
- case quit_chess_show_view.jifen:{
- this.labName.getComponent(Label).string = "积分场"
- this.nodeJifen.active = true;
- break;
- }
- case quit_chess_show_view.tongqian:{
- this.labName.getComponent(Label).string = "铜钱"
- this.nodeTongqian.active = true;
- break;
- }
- }
- }
- }
- closeUI(){
- let isQuit = true;
- if( this.nodeRenji.active === true){
- this.nodeRenji.active = false;
- isQuit = false;
- this.labName.getComponent(Label).string = "象棋"
- }
- if(this.nodeJifen.active === true){
- this.nodeJifen.active = false;
- isQuit = false;
- this.labName.getComponent(Label).string = "象棋"
- }
- if(this.nodeTongqian.active === true){
- isQuit = false;
- this.nodeTongqian.active = false;
- this.labName.getComponent(Label).string = "象棋"
- }
- if(isQuit){
- this.node.destroy()
- }
- }
-
- }
|