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
|
Character sheet
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
* Improve action and attribute tooltips
|
* Improve attribute tooltips
|
||||||
* Implement sliders for personality traits
|
* Implement sliders for personality traits
|
||||||
* Center the portraits when there are less than 5
|
* Center the portraits when there are less than 5
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ module TK.SpaceTac.UI {
|
||||||
/**
|
/**
|
||||||
* Fill the tooltip
|
* 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 builder = filler.styled({ size: 20 });
|
||||||
|
|
||||||
let icon = builder.image(`action-${action.code}`);
|
let icon = builder.image(`action-${action.code}`);
|
||||||
|
@ -49,6 +49,7 @@ module TK.SpaceTac.UI {
|
||||||
builder.text(description, 30, 170, { size: 16 });
|
builder.text(description, 30, 170, { size: 16 });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof position != "undefined") {
|
||||||
let shortcut = "";
|
let shortcut = "";
|
||||||
if (action instanceof EndTurnAction) {
|
if (action instanceof EndTurnAction) {
|
||||||
shortcut = "[ space ]";
|
shortcut = "[ space ]";
|
||||||
|
@ -61,5 +62,8 @@ module TK.SpaceTac.UI {
|
||||||
builder.text(shortcut, 150, 120, { color: "#aaaaaa", size: 12 });
|
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 => {
|
builder.in(builder.container("items"), builder => {
|
||||||
let actions = ship.actions.listAll().filter(action => !(action instanceof EndTurnAction));
|
let actions = ship.actions.listAll().filter(action => !(action instanceof EndTurnAction));
|
||||||
actions.forEach(action => {
|
actions.forEach(action => {
|
||||||
let button = builder.button(`action-${action.code}`, 24, 0, undefined,
|
let button = builder.button(`action-${action.code}`, 24, 0, undefined, filler => ActionTooltip.fill(filler, ship, action));
|
||||||
action.getEffectsDescription());
|
|
||||||
button.setScale(0.375);
|
button.setScale(0.375);
|
||||||
});
|
});
|
||||||
builder.distribute("y", 40, 688);
|
builder.distribute("y", 40, 688);
|
||||||
|
|
Loading…
Reference in a new issue