Added action tooltips on character sheet
This commit is contained in:
parent
513e82b487
commit
821900abc6
2
TODO.md
2
TODO.md
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue