123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- import { _decorator, Component, Node, Label, Sprite } from 'cc';
- import { ClientEvent } from '../clientEvent';
- import { Constant } from '../constant';
- import { GameMng } from '../GameMng';
- import GBaseUI from '../gcommon/GBaseUI';
- import { UIButton } from '../gcommon/UIButton';
- import UITips from '../gcommon/UITips';
- import { msgManager } from '../socket/msgManager';
- import { Tools } from '../Tools';
- import { userData } from '../UserData/userData';
- const { ccclass, property } = _decorator;
- @ccclass('user_info_view')
- export class user_info_view extends GBaseUI {
- @property(Node)
- lab_name: Node = null;
- @property(Node)
- btn_close: Node = null;
- @property(Node)
- spr_icon: Node = null;
- @property(Node)
- lab_id: Node = null;
- @property(Node)
- btn_add_firend: Node = null;
- start() {
- UIButton.BindClick(this.btn_close,()=>{
- this.closeUI()
- },this)
- ClientEvent.on(Constant.EVENT_TYPE.MSG_ADD_FIREND,this.on_add_firend,this)
- }
- onDestroy(){
- ClientEvent.off(Constant.EVENT_TYPE.MSG_ADD_FIREND,this.on_add_firend,this)
- }
- on_add_firend(){
- UITips.show("添加好友成功!")
- }
- show(user_data:userData){
- let self = this;
- if(user_data.userid===GameMng._userData.userid||GameMng.isMyFirend(user_data.userid)){
- this.btn_add_firend.active = false;
- }else{
- this.btn_add_firend.active = true;
- }
- UIButton.BindClick(this.btn_add_firend,()=>{
- msgManager.add_firend(user_data.userid)
- self.btn_add_firend.active = false;
- },this)
- Tools.loadWeiXinHead(user_data.user_avatar,this.spr_icon.getComponent(Sprite))
- this.lab_name.getComponent(Label).string = user_data.user_name
- this.lab_id.getComponent(Label).string ="ID:"+user_data.userid
- }
- update(deltaTime: number) {
-
- }
- }
|