
import { _decorator, Component, EditBox, Node, sys, utils } from 'cc';
import { UtilsPanel } from '../../scene/script/UtilsPanel';
import { Config, nav_info } from '../../scene/script/NavInfo';
import { Utils } from '../../scene/script/Utils';
const { ccclass } = _decorator;

@ccclass('CreateGuild')
export class CreateGuild extends Component {

    private edit_name: EditBox = null;
	private edit_desc: EditBox = null;

	protected onLoad(){
		UtilsPanel.getAllNeedCom(this, this.node, false);
	}
	private onGoClick(){
		if(!this.edit_name.string.length){
            nav_info.scene.showTip("guild name can not emtpy");
            return;
        }
        if(!this.edit_desc.string.length){
            nav_info.scene.showTip("guild desc can not emtpy");
            return;
        }
        let str = Config.copy_prefix + "createguild&"+this.edit_name.string + "&" + this.edit_desc.string;
        Utils.copyToZone(str, this, this.onCopy);
	}
    public onCopy(succ:boolean){
        if(succ){
            console.log("copy succ")
            nav_info.scene.showTip("copy succc");
            Utils.tryStartApp();
        }
        else{
            nav_info.scene.showTip("copy fail");
        }
    }

}
