#48 : Zone de saisie privée pour le MJ
This commit is contained in:
@ -11,6 +11,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
|
||||
/** @override */
|
||||
static get defaultOptions() {
|
||||
RdDUtility.initAfficheContenu();
|
||||
return mergeObject(super.defaultOptions, {
|
||||
classes: ["rdd", "sheet", "actor"],
|
||||
template: "systems/foundryvtt-reve-de-dragon/templates/actor-sheet.html",
|
||||
@ -25,7 +26,7 @@ export class RdDActorSheet extends ActorSheet {
|
||||
/* -------------------------------------------- */
|
||||
getData() {
|
||||
let data = super.getData();
|
||||
|
||||
|
||||
data.itemsByType = RdDUtility.buildItemsClassification(data.items);
|
||||
// Competence per category
|
||||
data.competenceByCategory = {};
|
||||
@ -279,6 +280,13 @@ export class RdDActorSheet extends ActorSheet {
|
||||
item.sheet.render(true);
|
||||
});
|
||||
|
||||
// Display info about queue
|
||||
html.find('.conteneur-name a').click((event) => {
|
||||
let myID = event.currentTarget.attributes['data-item-id'].value;
|
||||
RdDUtility.toggleAfficheContenu( myID );
|
||||
this.render(true);
|
||||
});
|
||||
|
||||
if (this.options.editCaracComp) {
|
||||
// On carac change
|
||||
html.find('.carac-value').change((event) => {
|
||||
|
@ -171,6 +171,20 @@ export class RdDUtility {
|
||||
return [];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static initAfficheContenu( actorId ) { // persistent handling of conteneur show/hide
|
||||
if ( !this.afficheContenu )
|
||||
this.afficheContenu = {};
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static toggleAfficheContenu( conteneurId) {
|
||||
this.afficheContenu[conteneurId] = !this.afficheContenu[conteneurId];
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
static getAfficheContenu( conteneurId) {
|
||||
return this.afficheContenu[conteneurId];
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static filterItemsPerTypeForSheet( data ) {
|
||||
data.data.materiel = this.checkNull(data.itemsByType['objet']);
|
||||
@ -240,9 +254,16 @@ export class RdDUtility {
|
||||
*/
|
||||
static buildConteneur( objet, niveau ) {
|
||||
if (!niveau) niveau = 1;
|
||||
objet.niveau = niveau;
|
||||
//console.log("OBJ:", objet);
|
||||
let str = Handlebars.partials['systems/foundryvtt-reve-de-dragon/templates/actor-inventaire-conteneur.html']( { item: objet} );
|
||||
if (objet.type == 'conteneur') {
|
||||
str = str + "<ul class='item-list alterne-list list-item-margin"+niveau+"'>";
|
||||
//console.log("ITEM DISPLAYED", this.getAfficheContenu(objet._id) );
|
||||
if ( this.getAfficheContenu(objet._id) ) {
|
||||
str = str + "<ul class='item-list alterne-list item-display-show list-item-margin"+niveau+"'>";
|
||||
} else {
|
||||
str = str + "<ul class='item-list alterne-list item-display-hide list-item-margin"+niveau+"'>";
|
||||
}
|
||||
for (let subItem of objet.subItems) {
|
||||
str = str + this.buildConteneur(subItem, niveau+1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user