File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change 11const Soup = require ( '@stews/soup' ) ;
22const aepl = require ( 'aepl' ) ;
33const OUT = new Soup ( Object ) ;
4+ const yaml = require ( 'js-yaml' ) ;
45
56
6- class Script { }
7+ class Script {
8+ translate ( code , meta ) {
9+ Object . assign ( this , yaml . load ( meta ) ) ; // load and add the scene's metadata
10+ this . code = new this . parent . UnityscriptObject ( "code" , code ) ;
11+
12+ let lines = code . split ( "\n" ) ;
13+ this . lines = new this . parent . UnityscriptObject ( "lines" , lines ) ;
14+
15+ let flag = " }" ;
16+
17+ const stStart = code . indexOf ( "void Start" ) ;
18+ const stEnd = code . indexOf ( flag ) ;
19+
20+ const upStart = code . indexOf ( "void Update" ) ;
21+ const upEnd = code . lastIndexOf ( flag ) ;
22+
23+ this . start = code . substring ( stStart , stEnd + flag . length ) ;
24+ this . update = code . substring ( upStart , upEnd + flag . length ) ;
25+
26+ this . start = new this . parent . UnityscriptObject ( "start" , this . start ) ;
27+ this . update = new this . parent . UnityscriptObject ( "update" , this . update ) ;
28+ }
29+ }
730
831
932OUT . push ( "Script" , aepl . init ( "Script" , Script ) ) ;
You can’t perform that action at this time.
0 commit comments