import { _decorator, Component, Node, Sprite, Label, SpriteFrame, ImageAsset, Texture2D } from 'cc'; import { ResourcesUtils } from '../../core/resourceManager/ResourcesUtils'; import { g } from '../../Data/g'; import { ISJSB } from '../../Data/platform'; import { FsUtils } from '../../FsUtils/FsUtils'; const { ccclass, property } = _decorator; /**我的个人信息 */ @ccclass('MyInfoWindow') export class MyInfoWindow extends Component { @property({ type: Sprite, tooltip: "头像" }) headImg: Sprite; @property({ type: Label, tooltip: "昵称文本" }) nickNameLabel: Label; @property({ type: Label, tooltip: "等级文本" }) LvLabel: Label; @property({ type: Label, tooltip: "上级好友文本" }) higherLeveLabel: Label; @property({ type: Label, tooltip: "一级好友文本" }) level1Label: Label; @property({ type: Label, tooltip: "二级好友文本" }) level2Label: Label; @property({ type: Label, tooltip: "三级好友文本" }) level3Label: Label; @property({ type: Label, tooltip: "四级好友文本" }) level4Label: Label; @property({ type: Label, tooltip: "五级好友文本" }) level5Label: Label; start() { } private async onOpenHandler() { if (ISJSB && g.userData.avator) { let img = await ResourcesUtils.loadRemote(g.userData.avator, { ext: ".png" }, this); const spriteFrame = new SpriteFrame(); const texture = new Texture2D(); texture.image = img; spriteFrame.texture = texture; this.headImg.spriteFrame = spriteFrame; } this.nickNameLabel.string = g.userData.nickName; this.LvLabel.string = g.userData.lv + ''; this.higherLeveLabel.string = g.gameData.myFissionData.parentNickname == "" ? '无' : g.gameData.myFissionData.parentNickname; this.higherLeveLabel.string = FsUtils.beautySub(this.higherLeveLabel.string, 6); this.level1Label.string = g.gameData.myFissionData.g1Members.length + '人'; this.level2Label.string = g.gameData.myFissionData.g2Members.length + '人'; this.level3Label.string = g.gameData.myFissionData.g3Members.length + '人'; this.level4Label.string = g.gameData.myFissionData.g4Members.length + '人'; this.level5Label.string = g.gameData.myFissionData.g5Members.length + '人'; } }