1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- import Hilo from "../hilo/Hilo";
- const Asset = {
- Mixes: Hilo.EventMixin,
- fire: Hilo.EventMixin.fire,
- on: Hilo.EventMixin.on,
- off: Hilo.EventMixin.off,
- queue: null as any,
- bg: null,
- man: null as any,
- bom: null,
- ground: null,
- ready: null,
- over: null,
- numberGlyphs: null,
- birdAtlas: null,
- holdback: null,
- load: function () {
- let host = "https://ssl.ycxxkj.com/demo_list/game_test1/dist/build/h5";
- var resources = [
- { id: "bg", src: host + "/static/images/map.jpg" },
- { id: "man", src: host + "/static/images/man.png" },
- { id: "bom", src: host + "/static/images/bom.png" }
- ];
- console.log("#debug#🚀 ~ file: Asset.ts:24 ~ resources:", resources);
- this.queue = new Hilo.LoadQueue();
- this.queue.add(resources);
- this.queue.on("complete", this.onComplete.bind(this));
- this.queue.start();
- },
- onComplete: function (e: any) {
- console.log("#debug#🚀 ~ file: Asset.ts:33 ~ Asset onComplete: Asset");
- this.bg = this.queue.get("bg").content;
- this.man = new Hilo.TextureAtlas({
- image: this.queue.get("man").content,
- width: 204,
- height: 375,
- frames: {
- frameWidth: 204,
- frameHeight: 375,
- numFrames: 13
- },
- sprites: {
- man: { from: 0, to: 12 }
- }
- });
- this.bom = new Hilo.TextureAtlas({
- image: this.queue.get("bom").content,
- width: 137,
- height: 135.31,
- frames: {
- frameWidth: 137,
- frameHeight: 135.31,
- numFrames: 16
- },
- sprites: {
- bom: { from: 0, to: 12 }
- }
- });
- this.queue.off("complete");
- this.fire("complete");
- }
- };
- export default Asset;
|