import { JCEngine } from "./JCEngine"; import Player from "./Player"; const {ccclass, property} = cc._decorator; @ccclass export default class HomePanel extends cc.Component { @property({type:cc.Node}) bg:cc.Node = null; @property({type:cc.Node}) theme:cc.Node = null; @property({type:cc.Node}) buttons:cc.Node = null; start(){ this.bg.setContentSize(cc.winSize); if (cc.winSize.width < cc.view.getDesignResolutionSize().width) { this.theme.setScale(cc.winSize.width / cc.view.getDesignResolutionSize().width); this.buttons.setScale(cc.winSize.width / cc.view.getDesignResolutionSize().width); } if (window.modeId) { this.match(); } else { for (let i = 0; i < this.buttons.children.length; i++) { this.buttons.children[i].on(cc.Node.EventType.TOUCH_END, () => { window.modeId = i + 1; this.match(); }); } } } match() { if (window.gm.appGame) { JCEngine.boot(window.gm.serverUrl, Player); } else { // JCEngine.boot('ws://192.168.101.12:9999/birdServer', Player); JCEngine.boot(window.gm.serverUrl, Player); } this.node.destroy(); window.gm.addMatchPanel(); } }