import { _decorator, Color, Component, Label, Node, Sprite } from 'cc'; import { ani_frame } from '../../../data/data'; const { ccclass, property } = _decorator; @ccclass('frame_item') export class frame_item extends Component { @property(Node) frame_name:Node = null; private m_data:ani_frame = null; private m_call_back = null; private m_index = 0; public initView(data:ani_frame,call,farme_index:number){ this.m_data = data; this.m_call_back =call; this.m_index = farme_index; this.frame_name.getComponent(Label).string = `第${farme_index}帧` this.node.on(Node.EventType.TOUCH_END,()=>{ if(this.m_call_back!=null){ this.m_call_back(this) } }) } public getIndex(){ return this.m_index; } public getData(){ return this.m_data; } public setData(data:ani_frame){ this.m_data = data; } public selectStatus(){ this.node.getComponent(Sprite).color = Color.GREEN; } public unSelectStatus(){ this.node.getComponent(Sprite).color = Color.WHITE; } }