1234567891011121314151617181920212223242526272829303132 |
- import { _decorator, Component, Label, Node } from 'cc';
- import { gameManager } from '../gameManager';
- const { ccclass, property } = _decorator;
- @ccclass('back_title')
- export class back_title extends Component {
- @property(Node) btn_back:Node = null;
- @property(Node) img_title:Node = null;
- private mCallBack = null;
- public initView(title:string,call_back){
- this.mCallBack = call_back;
- this.updateTitle(title)
- this.btn_back.off(Node.EventType.TOUCH_END)
- this.btn_back.on(Node.EventType.TOUCH_END,()=>{
- if(this.mCallBack!=null){
- this.mCallBack()
- }
- gameManager.Singleton.sys_click_button_music()
- })
- }
- public updateTitle(title:string){
- if(title.length<=0){
- this.img_title.parent.active = false;
- }else{
- this.img_title.parent.active = true;
- }
- this.img_title.getComponent(Label).string = title;
- }
- }
|