123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import Main from "../../../main/Main";
- import { __RoleIcon } from "../../data/sdata/SManage";
- /**
- * 称号节点
- */
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class RoleTitleItem extends cc.Component {
- @property(cc.Sprite)
- mIcon: cc.Sprite = null;//图片
- @property(cc.Label)
- mName: cc.Label = null;//名字
- @property(cc.Node)
- mLock: cc.Node = null;//锁
- public roleIcon:__RoleIcon
- private callback:(frameIcon:RoleTitleItem)=>void
- public setCallback(callback:(frameIcon:RoleTitleItem)=>void){
- this.callback = callback
- }
- public onclick(){
- if(this.callback){
- this.callback(this)
- }
- }
- public init(){
- this.mName.string = this.roleIcon.name
- cc.resources.load('icon/role_head/ch/'+this.roleIcon.icon, cc.SpriteFrame, (err, spriteFrame:cc.SpriteFrame) =>{
- if(err){
- cc.error(err);
- }else{
- this.mIcon.spriteFrame = spriteFrame;
- }
- });
- }
- public flushLock(main:Main){
- let roleIcon = main.player.roleIcon
- if(roleIcon.data.indexOf(this.roleIcon.id) < 0){
- this.mLock.active = true
- }else{
- this.mLock.active = false
- }
- }
-
- }
|