Add new layer property audioCopyright
This commit is contained in:
parent
aad582df70
commit
80794975aa
|
@ -103,7 +103,8 @@ The following *map* properties are supported:
|
||||||
* `mapDescription` (string): A short description of your map
|
* `mapDescription` (string): A short description of your map
|
||||||
* `mapCopyright` (string): Copyright notice
|
* `mapCopyright` (string): Copyright notice
|
||||||
|
|
||||||
And *each tileset* can also have a property called `tilesetCopyright` (string).
|
Each *tileset* can also have a property called `tilesetCopyright` (string).
|
||||||
|
If you are using audio files in your map, you can declare a layer property `audioCopyright` (string).
|
||||||
|
|
||||||
Resulting in a "credit" page in the menu looking like this:
|
Resulting in a "credit" page in the menu looking like this:
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,14 @@
|
||||||
|
|
||||||
let expandedMapCopyright = false;
|
let expandedMapCopyright = false;
|
||||||
let expandedTilesetCopyright = false;
|
let expandedTilesetCopyright = false;
|
||||||
|
let expandedAudioCopyright = false;
|
||||||
|
|
||||||
let mapName: string = "";
|
let mapName: string = "";
|
||||||
let mapLink: string = "";
|
let mapLink: string = "";
|
||||||
let mapDescription: string = "";
|
let mapDescription: string = "";
|
||||||
let mapCopyright: string = "The map creator did not declare a copyright for the map.";
|
let mapCopyright: string = "The map creator did not declare a copyright for the map.";
|
||||||
let tilesetCopyright: string[] = [];
|
let tilesetCopyright: string[] = [];
|
||||||
|
let audioCopyright: string[] = [];
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
if (gameScene.mapFile.properties !== undefined) {
|
if (gameScene.mapFile.properties !== undefined) {
|
||||||
|
@ -41,7 +43,18 @@
|
||||||
(property) => property.name === "tilesetCopyright"
|
(property) => property.name === "tilesetCopyright"
|
||||||
);
|
);
|
||||||
if (propertyTilesetCopyright !== undefined && typeof propertyTilesetCopyright.value === "string") {
|
if (propertyTilesetCopyright !== undefined && typeof propertyTilesetCopyright.value === "string") {
|
||||||
tilesetCopyright = [...tilesetCopyright, propertyTilesetCopyright.value]; //Assignment needed to trigger Svelte's reactivity
|
// Assignment needed to trigger Svelte's reactivity
|
||||||
|
tilesetCopyright = [...tilesetCopyright, propertyTilesetCopyright.value];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const layer of gameScene.mapFile.layers) {
|
||||||
|
if (layer.type && layer.type === "tilelayer" && layer.properties) {
|
||||||
|
const propertyAudioCopyright = layer.properties.find((property) => property.name === "audioCopyright");
|
||||||
|
if (propertyAudioCopyright !== undefined && typeof propertyAudioCopyright.value === "string") {
|
||||||
|
// Assignment needed to trigger Svelte's reactivity
|
||||||
|
audioCopyright = [...audioCopyright, propertyAudioCopyright.value];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,8 +81,21 @@
|
||||||
<p class="string-HTML">{copyright}</p>
|
<p class="string-HTML">{copyright}</p>
|
||||||
{:else}
|
{:else}
|
||||||
<p>
|
<p>
|
||||||
The map creator did not declare a copyright for the tilesets. Warning, This doesn't mean that those
|
The map creator did not declare a copyright for the tilesets. This doesn't mean that those tilesets
|
||||||
tilesets have no license.
|
have no license.
|
||||||
|
</p>
|
||||||
|
{/each}
|
||||||
|
</section>
|
||||||
|
<h3 class="nes-pointer hoverable" on:click={() => (expandedAudioCopyright = !expandedAudioCopyright)}>
|
||||||
|
Copyrights of audio files
|
||||||
|
</h3>
|
||||||
|
<section hidden={!expandedAudioCopyright}>
|
||||||
|
{#each audioCopyright as copyright}
|
||||||
|
<p class="string-HTML">{copyright}</p>
|
||||||
|
{:else}
|
||||||
|
<p>
|
||||||
|
The map creator did not declare a copyright for audio files. This doesn't mean that those tilesets
|
||||||
|
have no license.
|
||||||
</p>
|
</p>
|
||||||
{/each}
|
{/each}
|
||||||
</section>
|
</section>
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
"id":1,
|
"id":1,
|
||||||
"name":"start",
|
"name":"start",
|
||||||
"opacity":1,
|
"opacity":1,
|
||||||
|
"properties":[
|
||||||
|
{
|
||||||
|
"name":"audioCopyright",
|
||||||
|
"type":"string",
|
||||||
|
"value":"Copyright 2021 John Doe"
|
||||||
|
}],
|
||||||
"type":"tilelayer",
|
"type":"tilelayer",
|
||||||
"visible":true,
|
"visible":true,
|
||||||
"width":10,
|
"width":10,
|
||||||
|
@ -124,4 +130,4 @@
|
||||||
"type":"map",
|
"type":"map",
|
||||||
"version":1.4,
|
"version":1.4,
|
||||||
"width":10
|
"width":10
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue