1、把你抽奖单独做成一个项目,编译并发布
2、在小游戏中加载抽奖程序的全部资源,包括JS
如:
var atlas:Object[] = [{ url: "res/atlas/choujiang.js", type: Loader.TEXT },
{ url: "res/atlas/choujiang.json", type: Loader.ATLAS },
];
Laya.loader.load(atlas, Handler.create(this, this.onLoaded), Handler.create(this, this.onLoading, null, false));
3、注入JSvar js:any = Laya.loader.getRes("res/atlas/choujiang.js");
Browser.window.eval(js);
4、运行JS
var ChouJiang = Browser.window.eval("模块名+类名");
var choujiang:any = new ChouJiang();
choujiang.play();