123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import { _decorator, Component, EditBox, Node, Toggle } from 'cc';
- import { tools } from '../tools';
- const { ccclass, property } = _decorator;
- @ccclass('show_copy_scene')
- export class show_copy_scene extends Component {
- @property(Node) btn_sure:Node = null;
- @property(Node) btn_cancel:Node = null;
- @property(Node) editBox_scene_name:Node = null;
- @property(Toggle) toggle_copy_only_widget:Toggle = null;
- private m_sure_callback:Function = null;
- private is_copy_only_widget:boolean = false;
- start() {
- this.btn_sure.on(Node.EventType.TOUCH_END, ()=> {
- if(this.m_sure_callback != null) {
- let string = tools.trimLeftAndRightblank(this.editBox_scene_name.getComponent(EditBox).string)
- this.editBox_scene_name.getComponent(EditBox).string = string
- if(string=='') {
- return tools.showToast('请输入场景名称')
- }
- this.m_sure_callback(string,this)
- }
- },this)
- this.btn_cancel.on(Node.EventType.TOUCH_END, ()=> {
- this.close()
- },this)
- this.toggle_copy_only_widget.node.on(Toggle.EventType.CLICK, ()=>{
- this.is_copy_only_widget = this.toggle_copy_only_widget.isChecked
- })
- this.toggle_copy_only_widget.isChecked = this.getIsCopyOnlyWidget()
- }
- public getIsCopyOnlyWidget():boolean {
- return this.is_copy_only_widget
- }
-
- initView(scene_name:string, sure_callback:Function) {
- this.m_sure_callback = sure_callback
- this.editBox_scene_name.getComponent(EditBox).string = scene_name
- }
- close() {
- this.node.removeFromParent()
- }
- }
|