Added a new button bar for system specific buttons
This commit is contained in:
@@ -49,6 +49,8 @@
|
||||
"delete_confirm": "Are you sure you want to delete '{name}' ?",
|
||||
"drop_here": "Drop here",
|
||||
"send_to_chat": "To Chat",
|
||||
"locked": "Locked",
|
||||
"unlocked": "Unlocked",
|
||||
"edge_translation_disclaimer": ""
|
||||
},
|
||||
"logo": {
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
"delete_confirm": "¿Estás seguro de que quieres borrar '{name}' ?",
|
||||
"drop_here": "Dejar caer aquí",
|
||||
"send_to_chat": "To Chat",
|
||||
"locked": "Locked",
|
||||
"unlocked": "Unlocked",
|
||||
"edge_translation_disclaimer": "Edge Studio nos da su permiso para ofrecer este módulo a la comunidad, pero tanto los textos así como los códigos que lo constituyen no tienen su aprobación explícita."
|
||||
},
|
||||
"logo": {
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
"delete_confirm": "Etes-vous sûr de vouloir supprimer '{name}' ?",
|
||||
"drop_here": "Déposez ici",
|
||||
"send_to_chat": "Vers Conv.",
|
||||
"locked": "Verrouillé",
|
||||
"unlocked": "Déverrouillé",
|
||||
"edge_translation_disclaimer": ""
|
||||
},
|
||||
"logo": {
|
||||
|
||||
@@ -17,15 +17,40 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the SendToChat button on top of sheet
|
||||
* @override
|
||||
* Add buttons to L5R specific bar
|
||||
* @return {{label: string, class: string, icon: string, onclick: Function|null}[]}
|
||||
*/
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
_getL5rHeaderButtons() {
|
||||
/**
|
||||
* @var {{label: string, class: string, icon: string, onclick: Function|null}[]}
|
||||
*/
|
||||
const buttons = [];
|
||||
|
||||
if (this.isEditable && !this.actor.limited) {
|
||||
// Lock/Unlock
|
||||
buttons.unshift({
|
||||
label: `l5r5e.global.${this.actor.data.data.soft_locked ? "" : "un"}locked`,
|
||||
class: "l5r-softlock",
|
||||
icon: this.actor.data.data.soft_locked ? "fas fa-lock" : "fas fa-unlock",
|
||||
onclick: () =>
|
||||
game.l5r5e.HelpersL5r5e.debounce(
|
||||
"lock-" + this.object.id,
|
||||
() => {
|
||||
this.actor.update({
|
||||
data: {
|
||||
soft_locked: !this.actor.data.data.soft_locked,
|
||||
},
|
||||
});
|
||||
},
|
||||
500,
|
||||
true
|
||||
)(),
|
||||
});
|
||||
}
|
||||
|
||||
// Send To Chat
|
||||
buttons.unshift({
|
||||
label: game.i18n.localize("l5r5e.global.send_to_chat"),
|
||||
label: "l5r5e.global.send_to_chat",
|
||||
class: "send-to-chat",
|
||||
icon: "fas fa-comment-dots",
|
||||
onclick: () =>
|
||||
@@ -44,6 +69,9 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
getData(options = {}) {
|
||||
const sheetData = super.getData(options);
|
||||
|
||||
// System Header Buttons
|
||||
sheetData.l5rHeaderButtons = this._getL5rHeaderButtons();
|
||||
|
||||
sheetData.data.dtypes = ["String", "Number", "Boolean"];
|
||||
|
||||
// Sort Items by name
|
||||
@@ -109,6 +137,14 @@ export class BaseSheetL5r5e extends ActorSheet {
|
||||
// Commons
|
||||
game.l5r5e.HelpersL5r5e.commonListeners(html, this.actor);
|
||||
|
||||
// System Header Buttons
|
||||
const l5rHeaderButtons = this._getL5rHeaderButtons();
|
||||
html.find(".l5r-header-button").click((event) => {
|
||||
event.preventDefault();
|
||||
const button = l5rHeaderButtons.find((b) => event.currentTarget.classList.contains(b.class));
|
||||
button.onclick(event);
|
||||
});
|
||||
|
||||
// *** Everything below here is only needed if the sheet is editable ***
|
||||
if (!this.isEditable) {
|
||||
return;
|
||||
|
||||
@@ -17,11 +17,12 @@ export class CharacterSheetL5r5e extends BaseCharacterSheetL5r5e {
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the TwentyQuestions button on top of sheet
|
||||
* Add the TwentyQuestions button in L5R specific bar
|
||||
* @override
|
||||
* @return {{label: string, class: string, icon: string, onclick: Function|null}[]}
|
||||
*/
|
||||
_getHeaderButtons() {
|
||||
let buttons = super._getHeaderButtons();
|
||||
_getL5rHeaderButtons() {
|
||||
const buttons = super._getL5rHeaderButtons();
|
||||
if (!this.isEditable || this.actor.limited) {
|
||||
return buttons;
|
||||
}
|
||||
|
||||
@@ -245,6 +245,7 @@ export class TwentyQuestions {
|
||||
parseInt(formData.step18.heritage_add_honor);
|
||||
|
||||
// Update the actor
|
||||
actorDatas.soft_locked = true;
|
||||
actorDatas.template = formData.template;
|
||||
actorDatas.zeni = Math.floor(formData.step2.wealth * 50);
|
||||
actorDatas.identity = {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,6 +6,20 @@
|
||||
text-shadow: 0 0 2px $red;
|
||||
}
|
||||
}
|
||||
.l5r-buttons-bar {
|
||||
display: flex;
|
||||
flex: 0 0 100%;
|
||||
overflow: hidden;
|
||||
padding: 0 8px;
|
||||
line-height: 30px;
|
||||
justify-content: flex-end;
|
||||
background: rgba(186, 187, 177, 0.5);
|
||||
|
||||
a.l5r-header-button {
|
||||
flex: none;
|
||||
margin: 0 0 0 8px;
|
||||
}
|
||||
}
|
||||
&.actor {
|
||||
.sheet-header {
|
||||
height: 26rem;
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<form class="{{cssClass}}" data-lang="{{localize 'I18N.Language'}}" autocomplete="off">
|
||||
{{!-- L5R Button bar --}}
|
||||
<div class="l5r-buttons-bar">
|
||||
{{#each l5rHeaderButtons}}
|
||||
<a class="l5r-header-button {{this.class}}"><i class="{{this.icon}}"></i>{{localize this.label}}</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img dragndrop-actor-id pointer" src="{{data.img}}" {{#if data.editable_not_soft_locked}}data-edit="img"{{/if}} data-actor-id="{{actor.id}}" draggable="true" title="{{data.name}}"/>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<form class="{{cssClass}}" data-lang="{{localize 'I18N.Language'}}" autocomplete="off">
|
||||
{{!-- L5R Button bar --}}
|
||||
<div class="l5r-buttons-bar">
|
||||
{{#each l5rHeaderButtons}}
|
||||
<a class="l5r-header-button {{this.class}}"><i class="{{this.icon}}"></i>{{localize this.label}}</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<img class="profile-img dragndrop-actor-id pointer" src="{{data.img}}" {{#if data.editable_not_soft_locked}}data-edit="img"{{/if}} data-actor-id="{{actor.id}}" draggable="true" title="{{data.name}}"/>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
<form class="{{cssClass}}" data-lang="{{localize 'I18N.Language'}}" autocomplete="off">
|
||||
{{!-- L5R Button bar --}}
|
||||
<div class="l5r-buttons-bar">
|
||||
{{#each l5rHeaderButtons}}
|
||||
<a class="l5r-header-button {{this.class}}"><i class="{{this.icon}}"></i>{{localize this.label}}</a>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{!-- Sheet Header --}}
|
||||
<header class="sheet-header">
|
||||
<div class="header-fields identity-wrapper">
|
||||
|
||||
Reference in New Issue
Block a user