コード例 #1
0
 handleDemo: function() {
   Parse.Analytics.track('runDemo', {world:this.props.worldModel.id});
   this.handleReset();
   var demoSolution = this.props.worldModel.get('solution');
   var lines = demoSolution.split('\n');
   program = parser.newParser(lines, this.refs.worldCanvas.world.robot).parse();
   this.runner = new Runner(program, this.refs.worldCanvas.renderer);
   this.setState({runState: "demo"});
   this.runner.run(
     this.getSpeed(),
     this.handleRunnerStopped
   );
 },
コード例 #2
0
 handleRun: function() {
   Parse.Analytics.track('runProgram', {world:this.props.worldModel.id});
   this.handleSave();
   this.handleReset();
   var lines = this.refs.codeEditor.getDOMNode().value.split('\n');
   try {
     this.program = parser.newParser(lines, this.refs.worldCanvas.world.robot).parse();
   } catch (e) {
     this.setState({runState:"", errors:[e]});
     return
   }
   this.refs.codeEditor.setState({editing:false});
   this.runner = new Runner(this.program, this.refs.worldCanvas.renderer);
   this.handleContinue();
 },
コード例 #3
0
 handleSpeedClick: function(speed) {
   this.setState({speed:speed});
   Parse.Analytics.track('setSpeed', {speed:speed, world:this.props.worldModel.id});
 },
コード例 #4
0
 success: function(program) {
   Parse.Analytics.track('finishedWorld', {world:this.props.worldModel.id});
   this.setState({programModel:program});
   this.props.onFinished(program);
 }.bind(this)