44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
import GameModel from "../ts/core/GameModel";
|
|
import SKUIUtil from "../ts/gear_2.3.4/util/SKUIUtil";
|
|
import RoleMenuAlert from "../ts/RoleMenuAlert"
|
|
let GameRes = require('./GameRes');
|
|
let CPubFunction = require('./PubFunction');
|
|
|
|
cc.Class({
|
|
|
|
extends: cc.Component,
|
|
properties: {
|
|
PlayerFunUI: cc.Prefab,
|
|
},
|
|
|
|
onLoad() {
|
|
},
|
|
|
|
PlayerAvatar_Init(info) {
|
|
this.pInfo = info;
|
|
},
|
|
|
|
start() {
|
|
cc.find('btnClose', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, 'PlayerAvatar', 'Close', 0));
|
|
cc.find('btnHeadPic', this.node).getComponent(cc.Button).clickEvents.push(CPubFunction.CreateEventHandler(this.node, "PlayerAvatar", 'OpenPlayerFunUI', 0));
|
|
cc.find('btnHeadPic', this.node).getComponent(cc.Sprite).spriteFrame = GameModel.getRoleHead(this.pInfo.resid);
|
|
cc.find('btnHeadPic/level', this.node).getComponent(cc.Label).string = this.pInfo.level;
|
|
},
|
|
|
|
OpenPlayerFunUI() {
|
|
RoleMenuAlert.show(this.pInfo);
|
|
return
|
|
let goFunUI = SKUIUtil.createSubNode(cc.find('Canvas/MainUI'), cc.v2(0, 0), this.PlayerFunUI, 'PlayerFunUI');
|
|
goFunUI.getComponent('PlayerFunUI').PlayerFunUI_Init(this.pInfo);
|
|
this.node.destroy();
|
|
|
|
},
|
|
|
|
Close() {
|
|
this.node.destroy();
|
|
},
|
|
|
|
|
|
|
|
});
|