1
0
Fork 0

Added "presents" info on main title

This commit is contained in:
Michaël Lemaire 2017-12-04 19:30:18 +01:00
parent bb780415a3
commit 09d6e897dc
4 changed files with 38 additions and 14 deletions

View file

@ -56,7 +56,6 @@ Battle
* Area targetting should include the hotkeyed ship at best (apply exclusion and power limit), not necessarily center on it
* Add shortcut to perform only the "move" part of a move+fire simulation
* Fix delay of shield/hull impact effects (should depend on weapon animation, and ship location)
* Indicate visually the power gain of "end turn"
* Add a turn count marker in the ship list
* Resolve the confusion of action icon's power indicator with its keyboard shortcut
* BattleChecks should be done proactively when all diffs have been simulated by an action, in addition to reactively after applying

View file

@ -45,7 +45,7 @@ module TK.SpaceTac.UI {
* If a previous tween is running for this object, it will be stopped, and a new one will be created.
*/
private createTween(obj: any): Phaser.Tween {
this.tweens.removeFrom(obj);
this.tweens.removeFrom(obj, false);
let result = this.tweens.create(obj);
return result;
}

View file

@ -78,15 +78,23 @@ module TK.SpaceTac.UI {
*
* This new builder will inherit the style settings, and will create components in the specified parent
*/
in(container: UIContainer | string): UIBuilder {
return new UIBuilder(this.view, container, this.text_style);
in(container: UIContainer | string, body?: (builder: UIBuilder) => void): UIBuilder {
let result = new UIBuilder(this.view, container, this.text_style);
if (body) {
body(result);
}
return result;
}
/**
* Create a new UIBuilder with style changes
*/
styled(changes: UITextStyleI): UIBuilder {
return new UIBuilder(this.view, this.parent, merge(this.text_style, changes));
styled(changes: UITextStyleI, body?: (builder: UIBuilder) => void): UIBuilder {
let result = new UIBuilder(this.view, this.parent, merge(this.text_style, changes));
if (body) {
body(result);
}
return result;
}
/**

View file

@ -5,17 +5,21 @@ module TK.SpaceTac.UI {
* Main menu (first interactive screen)
*/
export class MainMenu extends BaseView {
layer_stars: Phaser.Group;
layer_title: Phaser.Group;
button_new_game: Phaser.Button;
button_quick_battle: Phaser.Button;
button_load_game: Phaser.Button;
dialog_load_game: LoadDialog;
layer_stars: Phaser.Group
layer_presents: Phaser.Group
layer_title: Phaser.Group
button_new_game: Phaser.Button
button_quick_battle: Phaser.Button
button_load_game: Phaser.Button
dialog_load_game: LoadDialog
create() {
super.create();
let builder = new UIBuilder(this);
this.layer_stars = this.getLayer("stars");
this.layer_presents = this.getLayer("presents");
this.layer_title = this.getLayer("title");
// Stars
@ -30,6 +34,14 @@ module TK.SpaceTac.UI {
this.tweens.create(star).to({ x: -30 }, 30000 * x / fade).to({ x: 1950 }, 0.00001).to({ x: 1920 * x }, 30000 * (1 - x) / fade).loop().start();
}
// Presents...
builder.in(this.layer_presents, builder => {
builder.styled({ center: true }, builder => {
builder.text("Michael Lemaire", this.getMidWidth(), this.getHeight() * 0.4, { size: 32 });
builder.text("presents", this.getMidWidth(), this.getHeight() * 0.6, { size: 24 });
});
});
// Menu buttons
this.button_new_game = this.addButton(322, 674, "New Game", "Start a new campaign in a generated universe", () => this.onNewGame());
this.button_load_game = this.addButton(960, 674, "Load / Join", "Load a saved game or join a friend", () => this.onLoadGame());
@ -51,15 +63,20 @@ module TK.SpaceTac.UI {
this.dialog_load_game.moveToLayer(this.layer_title);
this.dialog_load_game.setVisible(false);
// Fading in
this.tweens.create(this.layer_stars).from({ alpha: 0 }, 5000).start();
// Animations
this.layer_stars.visible = false;
this.layer_presents.visible = false;
this.layer_title.visible = false;
this.animations.show(this.layer_presents, 500);
this.animations.show(this.layer_stars, 5000);
let fading = this.timer.schedule(5000, () => {
this.animations.show(this.layer_title, 1000);
this.animations.hide(this.layer_presents, 300);
})
this.input.onTap.addOnce(() => {
this.timer.cancel(fading);
this.animations.show(this.layer_title, 0);
this.animations.hide(this.layer_presents, 0);
});
this.gameui.audio.startMusic("supernatural");