123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- var HeadIcon = require("HeadIcon")
- cc.Class({
- extends: cc.Component,
- properties: {
- imageAdd: {
- default: null,
- type: cc.Sprite,
- serializable: true,
- },
- imageGold: {
- default: null,
- type: cc.Sprite,
- serializable: true,
- },
- nodeStatusMask: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- textGold: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- textName: {
- default: null,
- type: cc.Label,
- serializable: true,
- },
- headIcon: {
- default: null,
- type: HeadIcon,
- serializable: true,
- },
- },
- resetData(data) {
- this.data = data;
- this.refreshView();
- },
- refreshView() {
- let showNull = this.data == null
- this.imageAdd.node.active = showNull;
- this.textName.node.active = !showNull;
- this.imageGold.node.active = !showNull;
- this.textGold.node.active = !showNull;
- this.headIcon.node.active = !showNull;
- this.nodeStatusMask.active = !showNull;
-
- if (showNull) {
- return;
- }
- this.textName.string = this.data.playerInfo.nickname
- this.headIcon.setPlayerInfo(this.data.playerInfo);
- },
- setPrice(boxsPrice) {
- this.textGold.string = G.PlayerUtils.getPrice(boxsPrice);
- },
- setActive(isShow) {
- this.node.active = isShow;
- },
- });
|