From c8f1eefe4e8e280663fed529e907dff2ec303cc6 Mon Sep 17 00:00:00 2001 From: tengge1 <930372551@qq.com> Date: Fri, 12 Jul 2019 19:47:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=84=9A=E6=9C=AC=E9=9D=A2?= =?UTF-8?q?=E6=9D=BF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/editor2/sidebar/ScriptPanel.jsx | 5 +- .../editor2/sidebar/window/ScriptWindow.jsx | 49 ++++++++++++++++--- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/ShadowEditor.Web/src/editor2/sidebar/ScriptPanel.jsx b/ShadowEditor.Web/src/editor2/sidebar/ScriptPanel.jsx index df03dfbe..52340eca 100644 --- a/ShadowEditor.Web/src/editor2/sidebar/ScriptPanel.jsx +++ b/ShadowEditor.Web/src/editor2/sidebar/ScriptPanel.jsx @@ -102,10 +102,7 @@ class ScriptPanel extends React.Component { handleAddScript() { const window = app.createElement(ScriptWindow); - app.addElement(window, () => { - let win1 = window; - debugger - }); + app.addElement(window); } handleEditScript(uuid) { diff --git a/ShadowEditor.Web/src/editor2/sidebar/window/ScriptWindow.jsx b/ShadowEditor.Web/src/editor2/sidebar/window/ScriptWindow.jsx index 07d13256..4e8181a9 100644 --- a/ShadowEditor.Web/src/editor2/sidebar/window/ScriptWindow.jsx +++ b/ShadowEditor.Web/src/editor2/sidebar/window/ScriptWindow.jsx @@ -8,37 +8,70 @@ import { classNames, PropTypes, Window, Content, Form, FormControl, Label, Input class ScriptWindow extends React.Component { constructor(props) { super(props); - } - render() { - const options = { + this.scriptTypes = { 'javascript': 'JavaScript', 'vertexShader': L_VERTEX_SHADER, 'fragmentShader': L_FRAGMENT_SHADER, 'json': L_SHADER_PROGRAM_INFO }; + this.state = { + name: L_NO_NAME, + type: 'javascript', + }; + + this.handleNameChange = this.handleNameChange.bind(this); + this.handleTypeChange = this.handleTypeChange.bind(this); + this.handleOK = this.handleOK.bind(this); + this.handleCancel = this.handleCancel.bind(this); + } + + render() { + const { name, type } = this.state; + return + title={L_CREATE_SCRIPT} + onClose={this.handleCancel}>
- + - +
- - + +
; } + + handleNameChange(value) { + this.setState({ + name: value, + }); + } + + handleTypeChange(value) { + this.setState({ + type: value, + }); + } + + handleOK() { + debugger + } + + handleCancel() { + app.removeElement(this); + } } export default ScriptWindow; \ No newline at end of file