//#region 文件引入 import { _decorator, Button, Component, Label, Node, sp, Sprite,Animation, RichText, SpriteFrame } from "cc"; import UIParse from "../../Mgr_UI/UIParse"; import WuGongData from "../../const/WuGongData"; import RoleDataMgr from "../../Mgr_LocalData/RoleDataMgr"; import { EGongFaType } from "../../const/GameEnum"; import StringUtils from "../../ExUtils/StringUtils"; //#endregion 文件引入 const {ccclass, property,menu} = _decorator; @ccclass("GFitem_Proxy") export default class GFitem_Proxy extends UIParse{ //#region 节点自动生成 @property(Sprite) spr_bg: Sprite = null; @property(Node) n_Select: Node = null; @property(Node) n_red: Node = null; @property(Label) lab_Name: Label = null; //#endregion 节点自动生成 @property(SpriteFrame) protected mShow: SpriteFrame; @property(SpriteFrame) protected mHide: SpriteFrame; private _isShow:boolean = false; onButtonClick(button:Button){ /**点击事件触发*/ switch (button) { default: ConsoleEx.Log(button); break; } } setInfo(wgdata: WuGongData){ CNodeUtils.switchTextByQuality(this.lab_Name, wgdata.config.name, wgdata.config.quality); let isusing = false; switch (wgdata.config.type) { case EGongFaType.剑法: case EGongFaType.刀法: case EGongFaType.枪法: isusing = RoleDataMgr.Ins.attackWuGong && RoleDataMgr.Ins.attackWuGong.id === wgdata.id; break; case EGongFaType.内功: isusing = RoleDataMgr.Ins.defenseWuGong && RoleDataMgr.Ins.defenseWuGong.id === wgdata.id; break; case EGongFaType.轻功: isusing = RoleDataMgr.Ins.speedWuGong && RoleDataMgr.Ins.speedWuGong.id === wgdata.id; break; default: isusing = false break; } CNodeUtils.setActive(this.n_Select, isusing); } setShow(isShow: boolean) { if (this._isShow == isShow) { return; } this._isShow = isShow; this.spr_bg.spriteFrame = this._isShow ? this.mShow : this.mHide; } setRedPoint(isShow: boolean) { CNodeUtils.setActive(this.n_red, isShow); } }