﻿
/**
 * AUTO GENERATE BY UI EDITOR.
 * WARNING: DO NOT MODIFY THIS FILE,MAY CAUSE CODE LOST.
 * AUTHOR: xxxx
 * UI: ${UIPath}
 */

 ${Import}

 @UI.UICallOnly('${UIPath}')
 export default class ${ClassName}_Generate extends ${SuperClassName} {
	 ${Fileds}
 
	protected onAwake() {
		//设置能否每帧触发onUpdate
		this.canUpdate = false;
		this.layer = UI.UILayerBottom;
		this.initButtons();
	}
	protected initButtons() {
		//按钮添加点击
		${StaleButton_Start}
		this.${StaleButton}.onClicked.add(()=>{
			Events.dispatchLocal("PlayButtonClick", "${StaleButton}");
		})
		this.initLanguage(this.${StaleButton});
		this.${StaleButton}.touchMethod = UI.ButtonTouchMethod.PreciseTap;
		${StaleButton_End}
		//按钮添加点击
		${Button_Start}
		this.${Button}.onClicked.add(()=>{
			Events.dispatchLocal("PlayButtonClick", "${Button}");
		})
		this.${Button}.touchMethod = UI.ButtonTouchMethod.PreciseTap;
		${Button_End}

		//按钮多语言
		${StaleButton_HideStart}
		this.initLanguage(this.uiWidgetBase.findChildByPath("${StaleButton_Path}") as any);
		${StaleButton_HideEnd}
		//文本多语言
		${TextBlock_Start}
		this.initLanguage(this.${TextBlock})
		${TextBlock_End}
		//文本多语言
		${TextBlock_HideStart}
		this.initLanguage(this.uiWidgetBase.findChildByPath("${TextBlock_Path}") as any);
		${TextBlock_HideEnd}

	}
	private initLanguage(ui: UI.StaleButton | UI.TextBlock) {
        let call = UI.UIBehavior.getBehavior("lan");
        if (call && ui) {
            call(ui);
        }
    }
 }
 