| 7 | import { BridgedSandbox } from './BridgedSandbox.ts'; |
| 8 | |
| 9 | export class CCLScripter implements IScripter { |
| 10 | public backendVersion:string = 'KagerouEngine/v1'; |
| 11 | public frontendVersion:string = 'KagerouHost/v1'; |
| 12 | public workerUrl:string; |
| 13 | |
| 14 | /** Setup default logger **/ |
| 15 | public logger:Logger = { |
| 16 | log:(msg:any) => { console.log(msg); }, |
| 17 | error:(msg:any) => { console.error(msg); }, |
| 18 | warn:(msg:any) => { console.warn(msg); } |
| 19 | }; |
| 20 | |
| 21 | constructor(url:string) { |
| 22 | this.workerUrl = url; |
| 23 | } |
| 24 | |
| 25 | public getWorker():Worker { |
| 26 | return new Worker(this.workerUrl); |
| 27 | } |
| 28 | |
| 29 | public getSandbox(stage:StageElement, player:IPlayer):BridgedSandbox { |
| 30 | return new BridgedSandbox(this, stage, player); |
| 31 | } |
| 32 | } |