1
0
Fork 0

Added action tooltips on character sheet

This commit is contained in:
Michaël Lemaire 2018-06-06 23:06:04 +02:00
parent 513e82b487
commit 821900abc6
3 changed files with 17 additions and 14 deletions

View File

@ -34,7 +34,7 @@ Map/story
Character sheet
---------------
* Improve action and attribute tooltips
* Improve attribute tooltips
* Implement sliders for personality traits
* Center the portraits when there are less than 5

View File

@ -6,7 +6,7 @@ module TK.SpaceTac.UI {
/**
* Fill the tooltip
*/
static fill(filler: TooltipBuilder, ship: Ship, action: BaseAction, position: number) {
static fill(filler: TooltipBuilder, ship: Ship, action: BaseAction, position?: number): boolean {
let builder = filler.styled({ size: 20 });
let icon = builder.image(`action-${action.code}`);
@ -49,17 +49,21 @@ module TK.SpaceTac.UI {
builder.text(description, 30, 170, { size: 16 });
}
let shortcut = "";
if (action instanceof EndTurnAction) {
shortcut = "[ space ]";
} else if (position == 9) {
shortcut = "[ 0 ]";
} else if (position >= 0 && position < 9) {
shortcut = `[ ${position + 1} ]`;
}
if (shortcut) {
builder.text(shortcut, 150, 120, { color: "#aaaaaa", size: 12 });
if (typeof position != "undefined") {
let shortcut = "";
if (action instanceof EndTurnAction) {
shortcut = "[ space ]";
} else if (position == 9) {
shortcut = "[ 0 ]";
} else if (position >= 0 && position < 9) {
shortcut = `[ ${position + 1} ]`;
}
if (shortcut) {
builder.text(shortcut, 150, 120, { color: "#aaaaaa", size: 12 });
}
}
return true;
}
}
}

View File

@ -306,8 +306,7 @@ module TK.SpaceTac.UI {
builder.in(builder.container("items"), builder => {
let actions = ship.actions.listAll().filter(action => !(action instanceof EndTurnAction));
actions.forEach(action => {
let button = builder.button(`action-${action.code}`, 24, 0, undefined,
action.getEffectsDescription());
let button = builder.button(`action-${action.code}`, 24, 0, undefined, filler => ActionTooltip.fill(filler, ship, action));
button.setScale(0.375);
});
builder.distribute("y", 40, 688);