/*
 * @Author: mojunshou 1637302775@qq.com
 * @Date: 2025-03-18 15:35:37
 * @LastEditors: mojunshou 1637302775@qq.com
 * @LastEditTime: 2025-03-18 17:14:13
 * @Description: 游戏设置界面
 */
import { _decorator, Label, Sprite } from 'cc';
import { oops } from 'db://oops-framework/core/Oops';
import { GameComponent } from "db://oops-framework/module/common/GameComponent";
import { UIID } from '../config/GameUIConfig';
import { PlatformUtil } from 'db://oops-framework/core/utils/PlatformUtil';

const { ccclass, property } = _decorator;

/** 显示对象控制 */
@ccclass('SettingView')
export class SettingView extends GameComponent {

    lab_name: Label | null = null;    //名字
    lab_ivnvite: Label | null = null!; //邀请
    sp_head: Sprite | null = null!;    //头像
    lab_groupnum: Label | null = null!; //群号


    lab_proto: Label | null = null!; //协议
    lab_privacy: Label | null = null!; //隐私
    lab_about: Label | null = null!; //关于
    lab_update: Label | null = null!; //更新
    lab_logout: Label | null = null!; //注销
    lab_exit: Label | null = null!; //退出

    protected start() {
        this.setButton();
        this.initComponents();
    }


    private initComponents() {

        const lab_name = this.node.getChildByPath('btn_head/lab_name');
        if (lab_name) {
            this.lab_name = lab_name.getComponent(Label);
        }

        const lab_ivnvite = this.node.getChildByPath('btn_head/lab_ivnvite');
        if (lab_ivnvite) {
            this.lab_ivnvite = lab_ivnvite.getComponent(Label);
        }

        const sp_head = this.node.getChildByPath('btn_head/sp_head');
        if (sp_head) {
            this.sp_head = sp_head.getComponent(Sprite);
        }

        const lab_groupnum = this.node.getChildByPath('btn_group/lab_groupnum');
        if (lab_groupnum) {
            this.lab_groupnum = lab_groupnum.getComponent(Label);
        }

        const lab_proto = this.node.getChildByName('btn_proto');
        if (lab_proto) {
            this.lab_proto = lab_proto.getComponent(Label);
        }

        const lab_privacy = this.node.getChildByName('btn_privacy');
        if (lab_privacy) {
            this.lab_privacy = lab_privacy.getComponent(Label);
        }

        const lab_about = this.node.getChildByName('btn_about');
        if (lab_about) {
            this.lab_about = lab_about.getComponent(Label);
        }

        const lab_update = this.node.getChildByName('btn_update');
        if (lab_update) {
            this.lab_update = lab_update.getComponent(Label);
        }

        const lab_logout = this.node.getChildByName('btn_logout');
        if (lab_logout) {
            this.lab_logout = lab_logout.getComponent(Label);
        }

        const lab_exit = this.node.getChildByName('btn_exit');
        if (lab_exit) {
            this.lab_exit = lab_exit.getComponent(Label);
        }
    }

    /**
     * @description: 点击头像逻辑
     * @return {*}
     */
    private btn_head() {
        //复制邀请码
        // oops.gui.copyText(this.lab_ivnvite!.string);
        // PlatformUtil.copyText(this.lab_ivnvite!.string);
    }

    /**
     * @description: 客服
     * @return {*}
     */
    private btn_service() {



    }

    /**
     * @description: 清理缓存
     * @return {*}
     */
    private btn_cache() {



    }

    /**
     * @description: 关闭
     * @return {*}
     */
    private btn_close() {
        oops.gui.remove(UIID.Setting)
    }



    /**
     * @description: 协议
     * @return {*}
     */
    private btn_proto() {



    }

    /**
     * @description: 隐私
     * @return {*}
     */
    private btn_privacy() {

    }

    /**
     * @description: 关于
     * @return {*}
     */
    private btn_about() {

    }


    private btn_update() {

    }

    /**
     * @description: 注销
     * @return {*}
     */
    private btn_logout() {

    }


    /**
     * @description: 退出
     * @return {*}
     */
    private btn_exit() {
        //清除缓存


        //重启游戏


    }



}