1
0
Fork 0
spacetac/src/ui/Preload.ts

169 lines
7.6 KiB
TypeScript
Raw Normal View History

2015-04-07 00:00:00 +00:00
/// <reference path="BaseView.ts"/>
2017-02-09 00:00:35 +00:00
module TS.SpaceTac.UI {
2015-04-07 00:00:00 +00:00
export class Preload extends BaseView {
2017-01-22 17:00:59 +00:00
private preloadBar: Phaser.Image;
2014-12-29 00:00:00 +00:00
preload() {
// Add preload sprite
2017-01-22 17:00:59 +00:00
let bg = this.add.image(678, 426, "preload-background");
this.preloadBar = this.add.image(684, bg.y + 166, "preload-bar");
this.load.setPreloadSprite(this.preloadBar);
2015-02-16 00:00:00 +00:00
// Load images
2017-01-22 16:17:59 +00:00
this.loadImage("menu/title.png");
this.loadImage("menu/button.png");
2017-01-23 18:12:36 +00:00
this.loadImage("menu/button-hover.png");
2017-05-15 23:15:07 +00:00
this.loadImage("menu/button-fullscreen.png");
this.loadImage("menu/load-bg.png");
2017-06-01 22:37:43 +00:00
this.loadSheet("common/particles.png", 32);
2017-05-03 18:12:13 +00:00
this.loadImage("common/transparent.png");
this.loadImage("common/debug.png");
this.loadImage("common/waiting.png");
this.loadImage("common/arrow.png");
this.loadImage("common/button-ok.png");
this.loadImage("common/button-cancel.png");
2017-05-14 21:03:03 +00:00
this.loadImage("battle/shiplist/background.png");
this.loadImage("battle/shiplist/item-background.png");
this.loadImage("battle/shiplist/damage.png");
this.loadImage("battle/shiplist/hover.png");
this.loadImage("battle/shiplist/info-button.png");
this.loadImage("battle/background.jpg");
2015-02-04 00:00:00 +00:00
this.loadImage("battle/actionbar.png");
this.loadImage("battle/action-inactive.png");
this.loadImage("battle/action-active.png");
2017-01-19 23:39:13 +00:00
this.loadImage("battle/action-selected.png");
2017-05-16 23:12:05 +00:00
this.loadImage("battle/action-cooldown.png");
this.loadImage("battle/power-available.png");
this.loadImage("battle/power-using.png");
this.loadImage("battle/power-used.png");
2017-05-15 18:30:44 +00:00
this.loadImage("battle/arena/background.png");
this.loadImage("battle/arena/ap-indicator.png");
this.loadImage("battle/arena/ship-normal-enemy.png");
this.loadImage("battle/arena/ship-normal-own.png");
this.loadImage("battle/arena/ship-playing-enemy.png");
this.loadImage("battle/arena/ship-playing-own.png");
2017-05-15 18:30:44 +00:00
this.loadImage("battle/arena/ship-hull-base.png");
this.loadImage("battle/arena/ship-hull-full.png");
this.loadImage("battle/arena/ship-shield-base.png");
this.loadImage("battle/arena/ship-shield-full.png");
this.loadImage("battle/arena/ship-effect-good.png");
this.loadImage("battle/arena/ship-effect-bad.png");
2017-05-23 16:42:55 +00:00
this.loadImage("battle/arena/ship-power.png");
2017-02-15 22:34:27 +00:00
this.loadImage("battle/arena/stasis.png");
this.loadImage("battle/arena/target.png");
this.loadImage("battle/arena/blast.png");
this.loadImage("battle/actions/move.png");
2015-02-23 00:00:00 +00:00
this.loadImage("battle/actions/endturn.png");
this.loadImage("battle/weapon/default.png");
this.loadImage("battle/weapon/bullets.png");
this.loadImage("battle/weapon/hot.png");
this.loadImage("battle/weapon/shield-impact.png");
2017-02-15 16:41:24 +00:00
this.loadImage("battle/weapon/blast.png");
2017-03-12 23:32:41 +00:00
this.loadImage("battle/outcome/dialog.png");
this.loadImage("battle/outcome/title-victory.png");
this.loadImage("battle/outcome/title-defeat.png");
this.loadImage("battle/outcome/button-menu.png");
this.loadImage("battle/outcome/button-map.png");
this.loadImage("battle/outcome/button-revert.png");
this.loadImage("battle/outcome/button-loot.png");
2017-01-26 00:01:31 +00:00
this.loadImage("map/starsystem-background.png");
2017-03-15 23:45:52 +00:00
this.loadImage("map/current-location.png");
this.loadImage("map/name.png");
2017-06-05 22:05:34 +00:00
this.loadImage("map/subname.png");
this.loadSheet("map/action.png", 323, 192);
2017-06-05 17:53:27 +00:00
this.loadImage("map/orbit.png");
this.loadImage("map/boundaries.png");
this.loadSheet("map/button-zoom.png", 115, 191);
2017-01-26 23:01:04 +00:00
this.loadImage("map/location-star.png");
this.loadImage("map/location-planet.png");
this.loadImage("map/location-warp.png");
2017-06-05 17:53:27 +00:00
this.loadSheet("map/status.png", 32, 32);
2017-02-27 23:36:12 +00:00
this.loadImage("character/sheet.png");
this.loadImage("character/close.png");
this.loadImage("character/ship.png");
this.loadImage("character/ship-selected.png");
2017-03-17 00:07:00 +00:00
this.loadImage("character/skill-upgrade.png");
2017-02-27 23:36:12 +00:00
this.loadImage("character/cargo-slot.png");
this.loadImage("character/equipment-slot.png");
this.loadImage("character/slot-power.png");
2017-03-05 14:12:08 +00:00
this.loadImage("character/slot-hull.png");
this.loadImage("character/slot-shield.png");
this.loadImage("character/slot-engine.png");
this.loadImage("character/slot-weapon.png");
this.loadImage("character/upgrade-available.png");
2017-03-23 18:58:09 +00:00
this.loadImage("character/price-tag.png");
2017-05-09 17:19:26 +00:00
this.loadImage("character/experience.png");
2017-03-07 00:28:40 +00:00
this.loadImage("equipment/ironhull.png");
this.loadImage("equipment/forcefield.png");
this.loadImage("equipment/nuclearreactor.png");
this.loadImage("equipment/rocketengine.png");
2017-05-28 20:37:07 +00:00
this.loadImage("equipment/gatlinggun.png");
this.loadImage("equipment/powerdepleter.png");
this.loadImage("equipment/submunitionmissile.png");
this.loadImage("equipment/repairdrone.png");
this.loadImage("equipment/shieldtransfer.png");
2015-02-16 00:00:00 +00:00
// Load ships
this.loadShip("avenger");
this.loadShip("breeze");
this.loadShip("commodore");
this.loadShip("creeper");
this.loadShip("falcon");
this.loadShip("flea");
this.loadShip("jumper");
this.loadShip("rhino");
this.loadShip("scout");
this.loadShip("tomahawk");
this.loadShip("trapper");
this.loadShip("whirlwind");
this.loadShip("xander");
2015-02-16 00:00:00 +00:00
// Load sounds
this.loadSound("battle/ship-change.wav");
2015-02-20 00:00:00 +00:00
this.loadSound("battle/weapon-bullets.wav");
2017-05-17 16:21:14 +00:00
this.loadSound("battle/weapon-missile-launch.wav");
this.loadSound("battle/weapon-missile-explosion.wav");
this.loadSound("battle/drone-deploy.wav");
this.loadSound("battle/drone-destroy.wav");
this.loadSound("battle/drone-activate.wav");
// Load musics
2017-06-01 22:37:43 +00:00
this.loadSound("music/division.mp3");
this.loadSound("music/mechanolith.mp3");
this.loadSound("music/spring-thaw.mp3");
this.loadSound("music/supernatural.mp3");
2017-01-22 17:00:59 +00:00
this.load.start();
2014-12-29 00:00:00 +00:00
}
create() {
this.game.state.start("mainmenu");
2014-12-29 00:00:00 +00:00
}
2015-02-04 00:00:00 +00:00
2017-06-01 22:37:43 +00:00
static getKey(path: string): string {
return path.replace(/\//g, "-").replace(/\.[a-z0-9]+$/, '');
}
/**
* Load a ship's sprite and portrait
*/
2017-02-10 00:08:28 +00:00
loadShip(name: string) {
this.loadImage("ship/" + name + "/sprite.png");
this.loadImage("ship/" + name + "/portrait.png");
}
2017-06-01 22:37:43 +00:00
loadSheet(path: string, frame_width: number, frame_height = frame_width) {
this.load.spritesheet(Preload.getKey(path), "assets/images/" + path, frame_width, frame_height);
}
2017-02-10 00:08:28 +00:00
loadImage(path: string) {
2017-06-01 22:37:43 +00:00
this.load.image(Preload.getKey(path), "assets/images/" + path);
2015-02-04 00:00:00 +00:00
}
2015-02-16 00:00:00 +00:00
2017-02-10 00:08:28 +00:00
loadSound(path: string) {
2017-06-01 22:37:43 +00:00
this.load.audio(Preload.getKey(path), "assets/sounds/" + path);
2015-02-16 00:00:00 +00:00
}
2014-12-29 00:00:00 +00:00
}
}