1234567891011121314151617181920212223242526272829303132333435363738 |
- import { _decorator, Component, EditBox, Node } 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;
- private m_sure_callback:Function = null;
- 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)
- }
-
- 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()
- }
- }
|