123456789101112131415161718192021222324252627282930313233343536 |
- import { _decorator, Component, Node, Sprite } from 'cc';
- import { base_ui } from '../../fw/base_ui';
- import { tools } from '../../tools';
- import { userDataManager } from '../../manager/userDataManager';
- const { ccclass, property } = _decorator;
- @ccclass('bag_avatar_preview')
- export class bag_avatar_preview extends base_ui {
- @property(Node) img_avatar:Node = null
- @property(Node) img_avatar_border:Node = null
- @property(Node) btn_close:Node = null
- @property(Node) btn_true:Node = null
- start() {
- this.onButtonListen(this.btn_close, ()=>{
- this.close()
- })
- this.onButtonListen(this.btn_true, ()=>{
- this.requestSetAvatar()
- })
- }
- initView() {
- tools.loadRemoteImg(userDataManager.user_data.avatarUrl, (d)=>{
- this.img_avatar.getComponent(Sprite).spriteFrame = d.sf
- })
- }
- protected close(): void {
- this.node.active = false
- }
- private requestSetAvatar() {
- this.close()
- }
- }
|