1
0
Fork 0

Fixed ship tooltip/hover being triggered over a dialog

This commit is contained in:
Michaël Lemaire 2017-12-07 01:05:06 +01:00
parent 7315be6be1
commit 56a85333f5
4 changed files with 22 additions and 5 deletions

View File

@ -36,7 +36,6 @@ Character sheet
Battle
------
* Fix arena's ship hovering happening even when the character sheet (or a dialog) is open on top
* Add a voluntary retreat option
* Add scroll buttons when there are too many actions
* Toggle bar/text display in power section of action bar

View File

@ -105,7 +105,11 @@ module TK.SpaceTac.UI {
// Watch mouse move to capture hovering over background
this.input_callback = this.view.input.addMoveCallback((pointer: Phaser.Pointer) => {
var point = new Phaser.Point();
if (this.view.dialogs_opened.length > 0 || this.view.character_sheet.isOpened()) {
return;
}
let point = new Phaser.Point();
if (view.input.hitTest(background, pointer, point)) {
let location = new ArenaLocation(point.x * background.scale.x, point.y * background.scale.y);
let ship = this.getShip(location);

View File

@ -195,6 +195,13 @@ module TK.SpaceTac.UI {
this.portraits.y = 80 + 160 * this.portraits.scale.x;
}
/**
* Check if the sheet is shown
*/
isOpened(): boolean {
return this.x != this.xhidden;
}
/**
* Show the sheet for a given ship
*/

View File

@ -5,6 +5,7 @@ module TK.SpaceTac.UI {
* Main menu (first interactive screen)
*/
export class MainMenu extends BaseView {
static returned = false
layer_stars: Phaser.Group
layer_presents: Phaser.Group
layer_title: Phaser.Group
@ -72,12 +73,18 @@ module TK.SpaceTac.UI {
let fading = this.timer.schedule(5000, () => {
this.animations.show(this.layer_title, 1000);
this.animations.hide(this.layer_presents, 300);
})
this.input.onTap.addOnce(() => {
});
let pass = () => {
this.timer.cancel(fading);
this.animations.show(this.layer_title, 0);
this.animations.hide(this.layer_presents, 0);
});
};
if (MainMenu.returned) {
pass();
} else {
this.input.onTap.addOnce(pass);
MainMenu.returned = true;
}
this.gameui.audio.startMusic("supernatural");
}