
import { _decorator, Component, Label, Node } 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('JoinGuild')
export class JoinGuild extends Component {
    private lb_id: Label = null;

	protected onLoad(){
		UtilsPanel.getAllNeedCom(this, this.node, false);
	}
    protected start(): void {
        this.lb_id.string = nav_info.match_id + ":الانضمام إلى النقابة ";
    }
	private onGoClick(){
        if(!nav_info.match_id.length){
            nav_info.scene.showTip("no match id");
            return;
        }
        let str = Config.copy_prefix + "joinguild&"+nav_info.match_id;
        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");
        }
    }

}
