12345678910111213141516171819202122232425262728293031323334353637383940 |
- import { _decorator, Component, Label, Node, Vec3 } from 'cc';
- import { gameManager } from '../gameManager';
- import { SdkUtil } from '../../sdkUtil';
- const { ccclass, property } = _decorator;
- @ccclass('back_title')
- export class back_title extends Component {
- @property(Node) btn_back:Node = null;
- @property(Node) img_title_bg:Node = null;
- @property(Node) img_title:Node = null;
- private mCallBack = null;
- protected start(): void {
- if(SdkUtil.iPhoneIsLingdongdao()&&SdkUtil.KS_GAME==false) {
- let p = this.img_title_bg.getPosition()
- this.img_title_bg.setPosition(p.x,p.y-60,p.z)
- }
- }
- 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;
- }
- }
|