import { _decorator, Component, Node, Label, Sprite } from 'cc'; import { ClientEvent } from '../clientEvent'; import { Constant } from '../constant'; import UIDialog from '../Game/UIDialog'; import { GameMng, quit_chess_show_view } from '../GameMng'; import ScenceMng from '../gcommon/ScenceMng'; import { UIButton } from '../gcommon/UIButton'; import { UIManager } from '../gcommon/UIManager'; import { native_manager } from '../native_manager'; import gameSocket from '../socket/gameSocket'; import { Tools } from '../Tools'; const { ccclass, property } = _decorator; @ccclass('mine_view') export class mine_view extends Component { @property(Node) btn_setting: Node = null; @property(Node) btn_self_info: Node = null; @property(Node) btn_quit: Node = null; @property(Node) btn_share: Node = null; @property(Node) lab_name: Node = null; @property(Node) lab_id: Node = null; @property(Node) lab_login_name: Node = null; @property(Node) head_spr: Node = null; @property(Node) btn_jifen: Node = null; start() { UIButton.BindClick(this.btn_quit,()=>{ UIDialog.Show(()=>{ gameSocket.Instance.stopConnected = true; // gameSocket.Instance.close() ClientEvent.dispatchEvent(Constant.UI_EVENT.UI_MSG_SHOW_LOGIN) },()=>{},"您确定要退出登陆吗?",null,true) },this) UIButton.BindClick(this.btn_setting,()=>{ UIManager.AddPrefab(GameMng.Instance.uiSettingView) },this) UIButton.BindClick(this.btn_self_info,()=>{ UIManager.AddPrefab(GameMng.Instance.self_info_view) },this) UIButton.BindClick(this.btn_share,()=>{ native_manager.share() },this) UIButton.BindClick(this.btn_jifen,()=>{ UIManager.AddPrefab(GameMng.Instance.uijifen_rule) },this) } onEnable(){ if(GameMng._userData!=null){ this.lab_name.getComponent(Label).string = GameMng._userData.user_name this.lab_id.getComponent(Label).string = "ID:"+GameMng._userData.userid +"" this.lab_login_name.getComponent(Label).string = GameMng._userData.user_name Tools.loadWeiXinHead(GameMng._userData.user_avatar,this.head_spr.getComponent(Sprite)) } } update(deltaTime: number) { } }