mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-04-21 23:13:39 +02:00
Inverted from isImage to isIcon. Should be more logical for users
This commit is contained in:
parent
51e681cef9
commit
cce86c7032
8 changed files with 33 additions and 31 deletions
|
|
@ -114,11 +114,11 @@ Hooks.once('init', () => {
|
|||
images: {
|
||||
full: {
|
||||
value: 'systems/daggerheart/assets/icons/domains/sage.svg',
|
||||
isPath: true
|
||||
isIcon: false
|
||||
},
|
||||
empty: {
|
||||
value: 'systems/daggerheart/assets/icons/domains/sage.svg',
|
||||
isPath: true
|
||||
isIcon: false
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -132,12 +132,12 @@ Hooks.once('init', () => {
|
|||
images: {
|
||||
full: {
|
||||
value: 'icons/magic/fire/barrier-wall-explosion-orange.webp',
|
||||
isPath: true,
|
||||
isIcon: false,
|
||||
noColorFilter: true
|
||||
},
|
||||
empty: {
|
||||
value: 'icons/magic/fire/barrier-wall-flame-ring-blue.webp',
|
||||
isPath: true,
|
||||
isIcon: false,
|
||||
noColorFilter: true
|
||||
}
|
||||
}
|
||||
|
|
@ -151,10 +151,12 @@ Hooks.once('init', () => {
|
|||
label: 'Hunger',
|
||||
images: {
|
||||
full: {
|
||||
value: 'fa-solid fa-burger'
|
||||
value: 'fa-solid fa-burger',
|
||||
isIcon: true
|
||||
},
|
||||
empty: {
|
||||
value: 'fa-regular fa-burger'
|
||||
value: 'fa-regular fa-burger',
|
||||
isIcon: true
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2657,7 +2657,7 @@
|
|||
"resources": {
|
||||
"resources": {
|
||||
"value": { "label": "Icon" },
|
||||
"isPath": { "label": "Is Image" },
|
||||
"isIcon": { "label": "Font Awesome Icon" },
|
||||
"noColorFilter": { "label": "Disable Color Filter" }
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
super._attachPartListeners(partId, htmlElement, options);
|
||||
|
||||
for (const element of htmlElement.querySelectorAll('.path-field input'))
|
||||
element.addEventListener('change', this.toggleResourceIsPath.bind(this));
|
||||
element.addEventListener('change', this.toggleResourceIsIcon.bind(this));
|
||||
}
|
||||
|
||||
async _prepareContext(_options) {
|
||||
|
|
@ -149,14 +149,14 @@ export default class DhHomebrewSettings extends HandlebarsApplicationMixin(Appli
|
|||
this.render();
|
||||
}
|
||||
|
||||
async toggleResourceIsPath(event) {
|
||||
async toggleResourceIsIcon(event) {
|
||||
const element = event.target.closest('.resource-icon-container');
|
||||
const { actorType, resourceKey, imageKey } = element.dataset;
|
||||
|
||||
const current = this.settings.resources[actorType].resources[resourceKey].images[imageKey];
|
||||
await this.settings.updateSource({
|
||||
[`resources.${actorType}.resources.${resourceKey}.images.${imageKey}`]: {
|
||||
isPath: !current.isPath,
|
||||
isIcon: !current.isIcon,
|
||||
value: ''
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -969,8 +969,8 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
label: game.i18n.localize(resource.label),
|
||||
value: resourceData.value,
|
||||
max: resourceData.max,
|
||||
fullIcon: resource.images?.full ?? { value: 'fa-solid fa-circle' },
|
||||
emptyIcon: resource.images?.empty ?? { value: 'fa-regular fa-circle' }
|
||||
fullIcon: resource.images?.full ?? { value: 'fa-solid fa-circle', isIcon: true },
|
||||
emptyIcon: resource.images?.empty ?? { value: 'fa-regular fa-circle', isIcon: true }
|
||||
};
|
||||
|
||||
return acc;
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
* reverse
|
||||
* label
|
||||
* images {
|
||||
* full { value, isPath, noColorFilter }
|
||||
* empty { value, isPath noColorFilter }
|
||||
* full { value, isIcon, noColorFilter }
|
||||
* empty { value, isIcon noColorFilter }
|
||||
* }
|
||||
*/
|
||||
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ export class Resource extends foundry.abstract.DataModel {
|
|||
}
|
||||
|
||||
static getDefaultResourceData = label => {
|
||||
const images = Resource._schema.fields.images.getInitialValue();
|
||||
const images = Resource.schema.fields.images.getInitialValue();
|
||||
return {
|
||||
initial: 0,
|
||||
max: 0,
|
||||
|
|
@ -233,7 +233,7 @@ export class Resource extends foundry.abstract.DataModel {
|
|||
};
|
||||
|
||||
static getDefaultImageData = imageKey => {
|
||||
return Resource._schema.fields.images.fields[imageKey].getInitialValue();
|
||||
return Resource.schema.fields.images.fields[imageKey].getInitialValue();
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -244,10 +244,10 @@ const imageIconField = defaultValue =>
|
|||
initial: defaultValue,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.value.label'
|
||||
}),
|
||||
isPath: new foundry.data.fields.BooleanField({
|
||||
isIcon: new foundry.data.fields.BooleanField({
|
||||
required: true,
|
||||
initial: false,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.isPath.label'
|
||||
initial: true,
|
||||
label: 'DAGGERHEART.SETTINGS.Homebrew.FIELDS.resources.resources.isIcon.label'
|
||||
}),
|
||||
noColorFilter: new foundry.data.fields.BooleanField({
|
||||
required: true,
|
||||
|
|
|
|||
|
|
@ -34,14 +34,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="resource-icon-content">
|
||||
{{#if ../images.full.isPath}}
|
||||
{{#if ../images.full.isIcon}}
|
||||
{{formGroup this.value value=../images.full.value name=(concat "resources." @../key ".resources." key ".images.full.value") localize=true }}
|
||||
{{else}}
|
||||
<div class="form-fields">
|
||||
<file-picker name="{{concat "resources." @../key ".resources." key ".images.full.value"}}" value="{{../images.full.value}}" type="image"></file-picker>
|
||||
</div>
|
||||
{{else}}
|
||||
{{formGroup this.value value=../images.full.value name=(concat "resources." @../key ".resources." key ".images.full.value") localize=true }}
|
||||
{{/if}}
|
||||
{{formGroup this.isPath value=../images.full.isPath name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.isIcon value=../images.full.isIcon name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.noColorFilter value=../images.full.noColorFilter name=(concat "resources." @../key ".resources." key ".images.full.noColorFilter") localize=true }}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
|
@ -55,14 +55,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="resource-icon-content">
|
||||
{{#if ../images.empty.isPath}}
|
||||
{{#if ../images.empty.isIcon}}
|
||||
{{formGroup this.value value=../images.empty.value name=(concat "resources." @../key ".resources." key ".images.empty.value") localize=true }}
|
||||
{{else}}
|
||||
<div class="form-fields">
|
||||
<file-picker name="{{concat "resources." @../key ".resources." key ".images.empty.value"}}" value="{{../images.empty.value}}" type="image"></file-picker>
|
||||
</div>
|
||||
{{else}}
|
||||
{{formGroup this.value value=../images.empty.value name=(concat "resources." @../key ".resources." key ".images.empty.value") localize=true }}
|
||||
{{/if}}
|
||||
{{formGroup this.isPath value=resource.images.empty.isPath name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.isIcon value=resource.images.empty.isIcon name="" classes="path-field" localize=true }}
|
||||
{{formGroup this.noColorFilter value=resource.images.empty.noColorFilter name=(concat "resources." @../key ".resources." key ".images.empty.noColorFilter") localize=true }}
|
||||
</div>
|
||||
{{/with}}
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@
|
|||
<h4>{{resource.label}}</h4>
|
||||
{{#times resource.max}}
|
||||
<span class='resource-value' data-action='toggleResource' data-value="{{add this 1}}" data-resource="{{resource.id}}">
|
||||
{{#unless resource.fullIcon.isPath}}
|
||||
{{#if resource.fullIcon.isIcon}}
|
||||
<i class='{{resource.fullIcon.value}} full {{#unless (gte ../value (add this 1))}}hidden{{/unless}}'></i>
|
||||
{{else}}
|
||||
<img src="{{resource.fullIcon.value}}" class="full {{#unless resource.fullIcon.noColorFilter}}filter{{else}}non-transparent{{/unless}} {{#unless (gte ../value (add this 1))}}hidden{{/unless}}" />
|
||||
{{/unless}}
|
||||
{{#unless resource.emptyIcon.isPath}}
|
||||
{{/if}}
|
||||
{{#if resource.emptyIcon.isIcon}}
|
||||
<i class='{{resource.emptyIcon.value}} empty {{#if (gte ../value (add this 1))}}hidden{{/if}}'></i>
|
||||
{{else}}
|
||||
<img src="{{resource.emptyIcon.value}}" class="empty {{#unless resource.fullIcon.noColorFilter}}filter{{else}}non-transparent{{/unless}} {{#if (gte ../value (add this 1))}}hidden{{/if}}" />
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</span>
|
||||
{{/times}}
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue