Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1370544f03 | ||
|
|
7bd2084209 | ||
|
|
0ae6336f52 | ||
|
|
8f1a5271dd | ||
|
|
199f9b2d3b | ||
|
|
f178245152 | ||
|
|
cd4c9e129e | ||
|
|
fb26eacc8d | ||
|
|
d809217d23 | ||
|
|
e4cdf1c355 | ||
|
|
0a4d32aaac |
116
MaterialDeck.js
@@ -20,17 +20,17 @@ export const moduleName = "MaterialDeck";
|
||||
export var selectedTokenId;
|
||||
|
||||
let ready = false;
|
||||
let activeSounds = [];
|
||||
|
||||
//CONFIG.debug.hooks = true;
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Global variables
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
var enableModule;
|
||||
export var enableModule;
|
||||
|
||||
//Websocket variables
|
||||
let ip = "localhost"; //Ip address of the websocket server
|
||||
let port = "3001"; //Port of the websocket server
|
||||
var ws; //Websocket variable
|
||||
let wsOpen = false; //Bool for checking if websocket has ever been opened => changes the warning message if there's no connection
|
||||
let wsInterval; //Interval timer to detect disconnections
|
||||
@@ -50,9 +50,6 @@ async function analyzeWSmessage(msg){
|
||||
console.log("streamdeck connected to server");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (data == undefined || data.payload == undefined) return;
|
||||
|
||||
const action = data.action;
|
||||
@@ -62,7 +59,6 @@ async function analyzeWSmessage(msg){
|
||||
if (coordinates == undefined) coordinates = 0;
|
||||
const settings = data.payload.settings;
|
||||
|
||||
|
||||
if (data.data == 'init'){
|
||||
|
||||
}
|
||||
@@ -101,17 +97,16 @@ async function analyzeWSmessage(msg){
|
||||
combatTracker.keyPress(settings,context);
|
||||
else if (action == 'playlist')
|
||||
playlistControl.keyPress(settings,context);
|
||||
else if (action == 'soundboard'){
|
||||
else if (action == 'soundboard')
|
||||
soundboard.keyPressDown(settings);
|
||||
}
|
||||
else if (action == 'other')
|
||||
otherControls.keyPress(settings);
|
||||
}
|
||||
|
||||
else if (event == 'keyUp'){
|
||||
if (action == 'soundboard'){
|
||||
soundboard.keyPressUp(settings);
|
||||
}
|
||||
else if (action == 'other')
|
||||
otherControls.keyPress(settings);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -122,8 +117,8 @@ async function analyzeWSmessage(msg){
|
||||
* If message is received, reset the interval, and send the message to analyzeWSmessage()
|
||||
*/
|
||||
function startWebsocket() {
|
||||
//ip = localhost;
|
||||
ws = new WebSocket('ws://'+ip+':'+port);
|
||||
const address = game.settings.get(moduleName,'address');
|
||||
ws = new WebSocket('ws://'+address+'/');
|
||||
|
||||
ws.onmessage = function(msg){
|
||||
//console.log(msg);
|
||||
@@ -134,7 +129,7 @@ function startWebsocket() {
|
||||
|
||||
ws.onopen = function() {
|
||||
WSconnected = true;
|
||||
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+ip+':'+port);
|
||||
ui.notifications.info("Material Deck "+game.i18n.localize("MaterialDeck.Notifications.Connected") +": "+address);
|
||||
wsOpen = true;
|
||||
const msg = {
|
||||
target: "server",
|
||||
@@ -181,28 +176,30 @@ export function sendWS(txt){
|
||||
*/
|
||||
Hooks.once('ready', ()=>{
|
||||
enableModule = (game.settings.get(moduleName,'Enable')) ? true : false;
|
||||
if (enableModule == false) return;
|
||||
|
||||
game.socket.on(`module.MaterialDeck`, (payload) =>{
|
||||
//console.log(payload);
|
||||
if (payload.msgType != "playSound") return;
|
||||
playTrack(payload.trackNr,payload.play,payload.repeat,payload.volume);
|
||||
playTrack(payload.trackNr,payload.src,payload.play,payload.repeat,payload.volume);
|
||||
});
|
||||
|
||||
for (let i=0; i<64; i++)
|
||||
activeSounds[i] = false;
|
||||
|
||||
if (enableModule == false) return;
|
||||
if (game.user.isGM == false) {
|
||||
ready = true;
|
||||
return;
|
||||
}
|
||||
|
||||
startWebsocket();
|
||||
|
||||
soundboard = new SoundboardControl();
|
||||
streamDeck = new StreamDeck();
|
||||
tokenControl = new TokenControl();
|
||||
move = new Move();
|
||||
macroControl = new MacroControl();
|
||||
combatTracker = new CombatTracker();
|
||||
playlistControl = new PlaylistControl();
|
||||
soundboard = new SoundboardControl();
|
||||
otherControls = new OtherControls();
|
||||
|
||||
|
||||
@@ -235,18 +232,9 @@ Hooks.once('ready', ()=>{
|
||||
|
||||
});
|
||||
|
||||
export function playTrack(soundNr,play,repeat,volume){
|
||||
export function playTrack(soundNr,src,play,repeat,volume){
|
||||
if (play){
|
||||
let trackId = game.settings.get(moduleName,'soundboardSettings').sounds[soundNr];
|
||||
let playlistId = game.settings.get(moduleName,'soundboardSettings').playlist;
|
||||
let sounds = game.playlists.entities.find(p => p._id == playlistId).data.sounds;
|
||||
let sound = sounds.find(p => p._id == trackId);
|
||||
if (sound == undefined){
|
||||
activeSounds[soundNr] = false;
|
||||
return;
|
||||
}
|
||||
volume *= game.settings.get("core", "globalInterfaceVolume");
|
||||
let src = sound.path;
|
||||
|
||||
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
|
||||
if (repeat == false){
|
||||
@@ -260,7 +248,8 @@ export function playTrack(soundNr,play,repeat,volume){
|
||||
activeSounds[soundNr] = howl;
|
||||
}
|
||||
else {
|
||||
activeSounds[soundNr].stop();
|
||||
activeSounds[soundNr].stop();
|
||||
activeSounds[soundNr] = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -271,6 +260,18 @@ Hooks.on('updateToken',(scene,token)=>{
|
||||
tokenControl.update(selectedTokenId);
|
||||
});
|
||||
|
||||
Hooks.on('updateActor',(scene,actor)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
let children = canvas.tokens.children[0].children;
|
||||
for (let i=0; i<children.length; i++){
|
||||
if (children[i].actor.id == actor._id){
|
||||
let tokenId = children[i].id;
|
||||
if (tokenId == selectedTokenId)
|
||||
tokenControl.update(selectedTokenId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Hooks.on('controlToken',(token,controlled)=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
if (controlled) {
|
||||
@@ -329,39 +330,36 @@ Hooks.on('targetToken',(user,token,targeted)=>{
|
||||
if (token.id == selectedTokenId) tokenControl.update(selectedTokenId);
|
||||
});
|
||||
|
||||
Hooks.once('init', ()=>{
|
||||
Hooks.on('sidebarCollapse',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('renderCompendium',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('closeCompendium',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('renderJournalSheet',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.on('closeJournalSheet',()=>{
|
||||
if (enableModule == false || ready == false) return;
|
||||
otherControls.updateAll();
|
||||
});
|
||||
|
||||
Hooks.once('init', ()=>{
|
||||
//CONFIG.debug.hooks = true;
|
||||
registerSettings(); //in ./src/settings.js
|
||||
});
|
||||
|
||||
Hooks.once('canvasReady',()=>{
|
||||
ready = true;
|
||||
});
|
||||
|
||||
export function getFromJSONArray(data,i){
|
||||
if (i>9) return 'nul';
|
||||
let val;
|
||||
if (i == 0) val = data.a;
|
||||
else if (i == 1) val = data.a;
|
||||
else if (i == 2) val = data.c;
|
||||
else if (i == 3) val = data.d;
|
||||
else if (i == 4) val = data.e;
|
||||
else if (i == 5) val = data.f;
|
||||
else if (i == 6) val = data.g;
|
||||
else if (i == 7) val = data.h;
|
||||
else if (i == 8) val = data.i;
|
||||
return val;
|
||||
}
|
||||
|
||||
export function setToJSONArray(data,i,val){
|
||||
if (i>9) return 'nul';
|
||||
if (i == 0) data.a = val;
|
||||
else if (i == 1) data.b = val;
|
||||
else if (i == 2) data.c = val;
|
||||
else if (i == 3) data.d = val;
|
||||
else if (i == 4) data.e = val;
|
||||
else if (i == 5) data.f = val;
|
||||
else if (i == 6) data.g = val;
|
||||
else if (i == 7) data.h = val;
|
||||
else if (i == 8) data.i = val;
|
||||
}
|
||||
});
|
||||
92
README.md
@@ -1,8 +1,67 @@
|
||||
# Stream Deck
|
||||
Material Deck is a Foundry VTT module that allows you to control certain Foundry functions using an Elgato Stream Deck.
|
||||
<b>Note:</b> At the moment Windows and OSX support has been confirmed. Linux support is unknown, there is no official Linux support for the Stream Deck, but there exist a 3rd party <a href="https://timothycrosley.com/project-7-streamdeck_ui">Stream Deck UI</a> that might be compatible.<br>
|
||||
<b>In any case: Proceed at your own risk, I will not take any responsibility if you spent money and the module doesn't work!</b>
|
||||
|
||||
## Instructions
|
||||
Instructions are on the <a href="https://github.com/CDeenen/MaterialDeck/wiki">wiki</a>.
|
||||
<b>Please read the documentation carefully, especially if you want to modify the default profile!</b>
|
||||
|
||||
I created a <a href="https://discord.gg/3hd4G6TkmA">Discord server</a> to discuss this and other hardware-based Foundry modules. Feel free to join if you'd like to join the discussion and be updated on this module.
|
||||
|
||||
[](https://youtu.be/7h5Ew8cJYxg "FoundryVTT Material Deck Demonstration")
|
||||
|
||||
# Material Deck
|
||||
Material Deck is a Foundry VTT module that allows you to control certain Foundry functions using an Elgato Stream Deck. A Stream Deck is a device that has physical buttons with displays behind them. Material Deck uses this to, for example, control playlists, execute macros, display and control the combat tracker.<br><br>
|
||||
The module allows a high degree of customization, where each button on the Stream Deck can be assigned any desired function. Furthermore, it supports folder structures, allowing easy switching between various button configurations so you can easily switch between the combat tracker, soundboard, or any other (custom) configuration.<br><br>
|
||||
The functions are categorized into actions. Here is a list of the available actions and their most important functions:
|
||||
<ul>
|
||||
<li>Playlist Action: Control Foundry's playlists</li>
|
||||
<ul>
|
||||
<li>Play/Stop playlists</li>
|
||||
<li>Play/Stop tracks</li>
|
||||
<li>Stop all tracks & playlists</li>
|
||||
</ul>
|
||||
<li>Soundboard Action: Play sounds</li>
|
||||
<ul>
|
||||
<li>Play/Stop sound</li>
|
||||
<li>Stop all sounds</li>
|
||||
</ul>
|
||||
<li>Token Action: Display token info</li>
|
||||
<ul>
|
||||
<li>Display selected token's name, icon or stats (HP/AC/Movement/etc)</li>
|
||||
<li>Open selected token's character sheet or token config</li>
|
||||
<li>Target token</li>
|
||||
<li>Toggle token visibility, combat state, conditions</li>
|
||||
</ul>
|
||||
<li>Move Action: Move selected token or the canvas</li>
|
||||
<ul>
|
||||
<li>Move token (in a specified direction)</li>
|
||||
<li>Move canvas (in a specified direction)</li>
|
||||
<li>Zoom canvas in/out</li>
|
||||
</ul>
|
||||
<li>Macro Actions: Execute macros</li>
|
||||
<ul>
|
||||
<li>Execute macro from hotbar</li>
|
||||
<li>Execute macro from macro board</li>
|
||||
</ul>
|
||||
<li>Combat Tracker Actions: Control and display the combat tracker</li>
|
||||
<ul>
|
||||
<li>Display combatants</li>
|
||||
<li>Start/Stop combat</li>
|
||||
<li>Next/Previous turn/round</li>
|
||||
</ul>
|
||||
<li>Other Actions: Misc other actions</li>
|
||||
<ul>
|
||||
<li>Pause/Resume game</li>
|
||||
<li>Scene selection/activation</li>
|
||||
<li>Toggle control buttons</li>
|
||||
<li>Control darkness level</li>
|
||||
<li>Open/Roll from a roll table</li>
|
||||
<li>Open sidebar tab</li>
|
||||
<li>Open compendium pack</li>
|
||||
<li>Open journal entry</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
## Instructions and More Info
|
||||
Instructions and more info can be found in the <a href="https://github.com/CDeenen/MaterialDeck/wiki">wiki</a>.
|
||||
|
||||
## Latest releases
|
||||
<a href="https://github.com/CDeenen/MaterialDeck/releases">Module</a><br>
|
||||
@@ -10,3 +69,28 @@ Instructions are on the <a href="https://github.com/CDeenen/MaterialDeck/wiki">w
|
||||
<a href="https://github.com/CDeenen/MaterialServer/releases">Server</a><br>
|
||||
<br>
|
||||
Module manifest: https://raw.githubusercontent.com/CDeenen/MaterialDeck/Master/module.json
|
||||
|
||||
## Software Versions & Module Incompatibilities
|
||||
<b>Foundry VTT:</b> Tested on 0.7.7<br>
|
||||
<b>Module Incompatibilities:</b> None known.<br>
|
||||
|
||||
## Feedback
|
||||
If you have any suggestions or bugs to report, feel free to create an issue, contact me on Discord (Cris#6864), or send me an email: cdeenen@outlook.com.
|
||||
|
||||
## Credits
|
||||
<b>Author:</b> Cristian Deenen (Cris#6864 on Discord)<br>
|
||||
<br>
|
||||
Special thanks to Asmodeus#7588 who made this module possible by generously donating a Stream Deck XL
|
||||
|
||||
## Abandonment
|
||||
Abandoned modules are a (potential) problem for Foundry, because users and/or other modules might rely on abandoned modules, which might break in future Foundry updates.<br>
|
||||
I consider this module abandoned if all of the below cases apply:
|
||||
<ul>
|
||||
<li>This module/github page has not received any updates in at least 3 months</li>
|
||||
<li>I have not posted anything on "the Foundry", "the League of Extraordinary Foundry VTT Developers" or the "Material Foundry" Discord servers in at least 3 months</li>
|
||||
<li>I have not responded to emails or PMs on Discord in at least 1 month</li>
|
||||
<li>I have not announced a temporary break from development, unless the announced end date of this break has been passed by at least 3 months</li>
|
||||
</ul>
|
||||
If the above cases apply (as judged by the "League of Extraordinary Foundry VTT Developers" admins), I give permission to the "League of Extraordinary Foundry VTT Developers" admins to assign one or more developers to take over this module, including requesting the Foundry team to reassign the module to the new developer(s).<br>
|
||||
I require the "League of Extraordinary Foundry VTT Developers" admins to send me an email 2 weeks before the reassignment takes place, to give me one last chance to prevent the reassignment.<br>
|
||||
I require to be credited for my work in all future releases.
|
||||
|
||||
56
changelog.md
@@ -1,4 +1,60 @@
|
||||
# Changelog Material Deck Module
|
||||
### V1.0.1 - 26-11-2020
|
||||
<ul>
|
||||
<li>Fixed issue where macro from macroboard wouldn't execute if furnace arguments were not defined</li>
|
||||
<li>Fixed issue where soundboard wouldn't save if no previous data existed for that sound</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.2 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.0.0 (unchanged): https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v1.0.0 - 24-11-2020
|
||||
Release
|
||||
<ul>
|
||||
<li>Fixed issue where the last column in 'Soundboard Configuration' would not work properly</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.2: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v1.0.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.9.2 - 24-11-2020
|
||||
<ul>
|
||||
<li>Removed unnecessary errors when module is not fully configured</li>
|
||||
<li>Solved issue that soundboard config couldn't be saved on a world that hadn't run Material Deck previously</li>
|
||||
</ul>
|
||||
|
||||
### v0.9.1 - 23-11-2020
|
||||
<ul>
|
||||
<li>Fixed 'Playlist' action issue where 'TrackNr' wouldn't show</li>
|
||||
<li>Fixed 'Soundboard Configuration' issue where changing the playlist would reset everything you've changed since last save</li>
|
||||
<li>'Soundboard Configuration', 'Macro Configuration' and 'Playlist Configuration' now save after each change, and update the SD instantly</li>
|
||||
<li>Save button has been removed from configuration screens, since it is now redundant</li>
|
||||
<li>Added support for DnD3.5e and Pathfinder 2e</li>
|
||||
</ul>
|
||||
|
||||
<b>Note1:</b> In 'Macro Configuration', previously saved Furnace arguments have to be filled in again.<br>
|
||||
<b>Note2:</b> Any settings set in 'Playlist Configuration' have to be set again<br>
|
||||
<br>
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.1 (unchanged): https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.9.1: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.9.0 - 19-11-2020
|
||||
<ul>
|
||||
<li>Added support for more playlists</li>
|
||||
<li>Added playmode setting for each playlist, which overrides the default playmode</li>
|
||||
<li>Added option to use the file picker to select Soundboard sounds, including support for wildcard names</li>
|
||||
<li>Fixed issue where macro config screen would not close if the module was disabled</li>
|
||||
<li>Fixed issue where the layout of the configuration screens would be messed up depending on browser/screen size</li>
|
||||
<li>Added option to open compendia and journal entries</li>
|
||||
</ul>
|
||||
|
||||
<b>Compatible server app and SD plugin:</b><br>
|
||||
Material Server v1.0.1: https://github.com/CDeenen/MaterialServer/releases <br>
|
||||
SD plugin v0.9.0: https://github.com/CDeenen/MaterialDeck_SD/releases<br>
|
||||
|
||||
### v0.8.6 - 18-11-2020
|
||||
<ul>
|
||||
<li>Added support for the new Material Server app</li>
|
||||
|
||||
@@ -12,15 +12,20 @@
|
||||
"MaterialDeck.Sett.PlaylistConfig": "Playlist Configuration",
|
||||
"MaterialDeck.Sett.MacroConfig": "Macro Configuration",
|
||||
"MaterialDeck.Sett.SoundboardConfig": "Soundboard Configuration",
|
||||
"MaterialDeck.Sett.ServerAddr": "Material Server Address",
|
||||
"MaterialDeck.Sett.ServerAddrHint": "Fill in the IP address and port of the Material Server. Must follow the format [ip_address]:[port], for example: 'localhost:3001' or '192.168.1.1:4000'.",
|
||||
|
||||
"MaterialDeck.PL.Unrestricted": "Unrestricted",
|
||||
"MaterialDeck.PL.OneTrackPlaylist": "One track per playlist",
|
||||
"MaterialDeck.PL.OneTrackTotal": "One track in total",
|
||||
"MaterialDeck.PL.Header": "Play Method",
|
||||
"MaterialDeck.PL.Label": "Method",
|
||||
"MaterialDeck.PL.OneTrack": "One track",
|
||||
"MaterialDeck.PL.Settings": "Settings",
|
||||
"MaterialDeck.PL.Mode": "Default Play Mode",
|
||||
"MaterialDeck.PL.Nr": "Number of playlists",
|
||||
|
||||
"MaterialDeck.Playlists": "Playlists",
|
||||
"MaterialDeck.Playlist": "Playlist",
|
||||
"MaterialDeck.FilePicker": "File Picker",
|
||||
"MaterialDeck.FurnaceArgs": "Furnace arguments",
|
||||
"MaterialDeck.Background": "Background",
|
||||
"MaterialDeck.Macro": "Macro",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "MaterialDeck",
|
||||
"title": "Material Deck",
|
||||
"description": "",
|
||||
"version": "0.8.6",
|
||||
"description": "Material Deck allows you to control Foundry using an Elgato Stream Deck",
|
||||
"version": "1.0.1",
|
||||
"author": "CDeenen",
|
||||
"esmodules": [
|
||||
"./MaterialDeck.js"
|
||||
|
||||
@@ -46,8 +46,7 @@ export class CombatTracker{
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
@@ -63,8 +62,6 @@ export class CombatTracker{
|
||||
streamDeck.setIcon(0,context,src,background);
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else if (mode == 2){
|
||||
|
||||
@@ -139,7 +136,8 @@ export class CombatTracker{
|
||||
if (combat != null && combat != undefined && combat.started)
|
||||
tokenId = combat.combatant.tokenId;
|
||||
|
||||
let token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
let token
|
||||
if (canvas.tokens.children[0] != undefined) token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
if (token == undefined) return;
|
||||
if (onClick == 0) //Do nothing
|
||||
return;
|
||||
|
||||
@@ -196,11 +196,11 @@ export class MacroControl{
|
||||
if (macroId != undefined){
|
||||
let macro = game.macros.get(macroId);
|
||||
if (macro != undefined && macro != null) {
|
||||
const args = game.settings.get(MODULE.moduleName,'macroArgs')[macroNumber];
|
||||
const args = game.settings.get(MODULE.moduleName,'macroSettings').args;
|
||||
let furnaceEnabled = false;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active) furnaceEnabled = true;
|
||||
if (args == "") furnaceEnabled = false;
|
||||
if (args == undefined || args[number] == undefined || args[macroNumber] == "") furnaceEnabled = false;
|
||||
if (furnaceEnabled == false) macro.execute();
|
||||
else {
|
||||
let chatData = {
|
||||
|
||||
465
src/misc.js
@@ -1,10 +1,12 @@
|
||||
import * as MODULE from "../MaterialDeck.js";
|
||||
import {macroControl} from "../MaterialDeck.js";
|
||||
import {macroControl,soundboard,playlistControl} from "../MaterialDeck.js";
|
||||
|
||||
export class playlistConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = data;
|
||||
this.playlistNr;
|
||||
this.updatePlaylistNr = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,28 +26,43 @@ export class playlistConfigForm extends FormApplication {
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
const selectedPlaylists = game.settings.get(MODULE.moduleName,'selectedPlaylists');
|
||||
let playlistData = {};
|
||||
|
||||
for (let i=0; i<9; i++){
|
||||
let playlist;
|
||||
playlist = MODULE.getFromJSONArray(selectedPlaylists,i);
|
||||
|
||||
let settings = game.settings.get(MODULE.moduleName,'playlists');
|
||||
let selectedPlaylists = settings.selectedPlaylist;
|
||||
if (selectedPlaylists == undefined) selectedPlaylists = [];
|
||||
let selectedPlaylistMode = settings.playlistMode;
|
||||
if (selectedPlaylistMode == undefined) selectedPlaylistMode = [];
|
||||
let numberOfPlaylists = settings.playlistNumber;
|
||||
if (this.updatePlaylistNr) numberOfPlaylists = this.playlistNr;
|
||||
if (numberOfPlaylists == undefined) numberOfPlaylists = 9;
|
||||
let playMode = settings.playMode;
|
||||
if (playMode == undefined) playMode = 0;
|
||||
let playlistData = [];
|
||||
|
||||
this.updatePlaylistNr = false;
|
||||
for (let i=0; i<numberOfPlaylists; i++){
|
||||
if (selectedPlaylists[i] == undefined) selectedPlaylists[i] = 'none';
|
||||
if (selectedPlaylistMode[i] == undefined) selectedPlaylistMode[i] = 0;
|
||||
let dataThis = {
|
||||
iteration: i+1,
|
||||
playlist: selectedPlaylists[i],
|
||||
playlistMode: selectedPlaylistMode[i],
|
||||
playlists: game.playlists.entities
|
||||
}
|
||||
MODULE.setToJSONArray(playlistData,i,dataThis);
|
||||
playlistData.push(dataThis);
|
||||
}
|
||||
|
||||
if (!this.data && selectedPlaylists) {
|
||||
this.data = selectedPlaylists;
|
||||
this.data = {
|
||||
playMode: playMode,
|
||||
playlistNumber: numberOfPlaylists,
|
||||
selectedPlaylist: selectedPlaylists,
|
||||
playlistMode: selectedPlaylistMode
|
||||
}
|
||||
|
||||
return {
|
||||
playlists: game.playlists.entities,
|
||||
numberOfPlaylists: numberOfPlaylists,
|
||||
playlistData: playlistData,
|
||||
playMethod: game.settings.get(MODULE.moduleName,'playlistMethod')
|
||||
playMode: playMode
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,16 +72,44 @@ export class playlistConfigForm extends FormApplication {
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
await game.settings.set(MODULE.moduleName,'selectedPlaylists', formData["selectedPlaylist"]);
|
||||
await game.settings.set(MODULE.moduleName,'playlistMethod',formData["playMethod"]);
|
||||
|
||||
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
const playMode = html.find("select[name='playMode']");
|
||||
const numberOfPlaylists = html.find("input[name='plNum']");
|
||||
const selectedPlaylist = html.find("select[name='selectedPlaylist']");
|
||||
const playlistMode = html.find("select[name='playlistMode']");
|
||||
|
||||
|
||||
playMode.on("change", event => {
|
||||
this.data.playMode=event.target.value;
|
||||
this.updateSettings(this.data);
|
||||
});
|
||||
|
||||
numberOfPlaylists.on("change", event => {
|
||||
this.playlistNr = event.target.value;
|
||||
this.updatePlaylistNr = true;
|
||||
this.data.playlistNumber=event.target.value;
|
||||
this.updateSettings(this.data);
|
||||
});
|
||||
|
||||
selectedPlaylist.on("change", event => {
|
||||
let id = event.target.id.replace('playlist','');
|
||||
this.data.selectedPlaylist[id-1]=event.target.value;
|
||||
this.updateSettings(this.data);
|
||||
});
|
||||
|
||||
playlistMode.on("change", event => {
|
||||
let id = event.target.id.replace('playlistMode','');
|
||||
this.data.playlistMode[id-1]=event.target.value;
|
||||
this.updateSettings(this.data);
|
||||
});
|
||||
}
|
||||
async updateSettings(settings){
|
||||
await game.settings.set(MODULE.moduleName,'playlists', settings);
|
||||
if (MODULE.enableModule) playlistControl.updateAll();
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,21 +125,21 @@ export class macroConfigForm extends FormApplication {
|
||||
* Default Options for this FormApplication
|
||||
*/
|
||||
static get defaultOptions() {
|
||||
/*
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
let width;
|
||||
if (streamDeckModel == 0)
|
||||
width = 500;
|
||||
width = 550;
|
||||
else if (streamDeckModel == 1)
|
||||
width= 800;
|
||||
width= 1500;
|
||||
else
|
||||
width = 1400;
|
||||
|
||||
*/
|
||||
return mergeObject(super.defaultOptions, {
|
||||
id: "macro-config",
|
||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.MacroConfig"),
|
||||
template: "./modules/MaterialDeck/templates/macroConfig.html",
|
||||
classes: ["sheet"],
|
||||
width: width
|
||||
classes: ["sheet"]
|
||||
});
|
||||
}
|
||||
|
||||
@@ -104,11 +149,11 @@ export class macroConfigForm extends FormApplication {
|
||||
getData() {
|
||||
var selectedMacros = game.settings.get(MODULE.moduleName,'macroSettings').macros;
|
||||
var color = game.settings.get(MODULE.moduleName,'macroSettings').color;
|
||||
var args = game.settings.get(MODULE.moduleName,'macroArgs');
|
||||
var args = game.settings.get(MODULE.moduleName,'macroSettings').args;
|
||||
if (selectedMacros == undefined) selectedMacros = [];
|
||||
if (color == undefined) color = [];
|
||||
if (args == undefined) args = [];
|
||||
let macroData = {};
|
||||
let macroData = [];
|
||||
let furnaceEnabled = false;
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active) furnaceEnabled = true;
|
||||
@@ -132,7 +177,7 @@ export class macroConfigForm extends FormApplication {
|
||||
|
||||
let iteration = 0;
|
||||
for (let j=0; j<jMax; j++){
|
||||
let macroThis = {};
|
||||
let macroThis = [];
|
||||
|
||||
for (let i=0; i<iMax; i++){
|
||||
let colorThis = color[iteration];
|
||||
@@ -156,13 +201,13 @@ export class macroConfigForm extends FormApplication {
|
||||
args: args[iteration],
|
||||
furnace: furnaceEnabled
|
||||
}
|
||||
MODULE.setToJSONArray(macroThis,i,dataThis);
|
||||
macroThis.push(dataThis);
|
||||
iteration++;
|
||||
}
|
||||
let data = {
|
||||
dataThis: macroThis,
|
||||
};
|
||||
MODULE.setToJSONArray(macroData,j,data);
|
||||
macroData.push(data);
|
||||
}
|
||||
|
||||
return {
|
||||
@@ -179,19 +224,41 @@ export class macroConfigForm extends FormApplication {
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
await game.settings.set(MODULE.moduleName,'macroSettings',{
|
||||
macros: formData["macros"],
|
||||
color: formData["colorPicker"]
|
||||
});
|
||||
|
||||
let furnace = game.modules.get("furnace");
|
||||
if (furnace != undefined && furnace.active)
|
||||
await game.settings.set(MODULE.moduleName,'macroArgs', formData["args"]);
|
||||
macroControl.updateAll();
|
||||
}
|
||||
|
||||
activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
const macro = html.find("select[name='macros']");
|
||||
const args = html.find("input[name='args']");
|
||||
const color = html.find("input[name='colorPicker']");
|
||||
|
||||
macro.on("change", event => {
|
||||
let id = event.target.id.replace('macros','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
settings.macros[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
args.on("change", event => {
|
||||
let id = event.target.id.replace('args','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
settings.args[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
|
||||
color.on("change", event => {
|
||||
let id = event.target.id.replace('colorpicker','');
|
||||
let settings = game.settings.get(MODULE.moduleName,'macroSettings');
|
||||
settings.color[id-1]=event.target.value;
|
||||
this.updateSettings(settings);
|
||||
});
|
||||
}
|
||||
|
||||
async updateSettings(settings){
|
||||
await game.settings.set(MODULE.moduleName,'macroSettings',settings);
|
||||
if (MODULE.enableModule) macroControl.updateAll();
|
||||
this.render();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,30 +268,33 @@ export class soundboardConfigForm extends FormApplication {
|
||||
constructor(data, options) {
|
||||
super(data, options);
|
||||
this.data = data;
|
||||
//this.soundData = {};
|
||||
this.playlist;
|
||||
this.playlists = [];
|
||||
this.updatePlaylist = false;
|
||||
this.update = false;
|
||||
this.iMax;
|
||||
this.jMax;
|
||||
this.settings = {};
|
||||
}
|
||||
|
||||
/**
|
||||
* Default Options for this FormApplication
|
||||
*/
|
||||
static get defaultOptions() {
|
||||
/*
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
let width;
|
||||
if (streamDeckModel == 0)
|
||||
width = 500;
|
||||
width = 550;
|
||||
else if (streamDeckModel == 1)
|
||||
width= 800;
|
||||
width= 885;
|
||||
else
|
||||
width = 1400;
|
||||
|
||||
*/
|
||||
return mergeObject(super.defaultOptions, {
|
||||
id: "soundboard-config",
|
||||
title: "Material Deck: "+game.i18n.localize("MaterialDeck.Sett.SoundboardConfig"),
|
||||
template: "./modules/MaterialDeck/templates/soundboardConfig.html",
|
||||
classes: ["sheet"],
|
||||
width: width,
|
||||
height: 720
|
||||
});
|
||||
}
|
||||
@@ -237,82 +307,95 @@ export class soundboardConfigForm extends FormApplication {
|
||||
/**
|
||||
* Provide data to the template
|
||||
*/
|
||||
getData() {
|
||||
let playlistId = game.settings.get(MODULE.moduleName,'soundboardSettings').playlist;
|
||||
if (this.updatePlaylist) playlistId = this.playlist;
|
||||
this.updatePlaylist = false;
|
||||
let playlist = 'none';
|
||||
let sounds = [];
|
||||
if (playlistId != undefined){
|
||||
playlist = game.playlists.entities.find(p => p._id == playlistId);
|
||||
if (playlist != undefined) sounds = playlist.sounds;
|
||||
else playlist = 'none';
|
||||
getData() {
|
||||
if (this.update) {
|
||||
this.update=false;
|
||||
return {soundData: this.data};
|
||||
}
|
||||
this.settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
let playlists = [];
|
||||
playlists.push({id:"none",name:game.i18n.localize("MaterialDeck.None")});
|
||||
playlists.push({id:"FP",name:game.i18n.localize("MaterialDeck.FilePicker")})
|
||||
for (let i=0; i<game.playlists.entities.length; i++){
|
||||
playlists.push({id:game.playlists.entities[i]._id,name:game.playlists.entities[i].name});
|
||||
}
|
||||
let selectedSounds = game.settings.get(MODULE.moduleName,'soundboardSettings').sounds;
|
||||
let colorOn = game.settings.get(MODULE.moduleName,'soundboardSettings').colorOn;
|
||||
let colorOff = game.settings.get(MODULE.moduleName,'soundboardSettings').colorOff;
|
||||
let mode = game.settings.get(MODULE.moduleName,'soundboardSettings').mode;
|
||||
let volume = game.settings.get(MODULE.moduleName,'soundboardSettings').volume;
|
||||
let img = game.settings.get(MODULE.moduleName,'soundboardSettings').img;
|
||||
let name = game.settings.get(MODULE.moduleName,'soundboardSettings').name;
|
||||
|
||||
if (selectedSounds == undefined) selectedSounds = [];
|
||||
if (colorOn == undefined) colorOn = [];
|
||||
if (colorOff == undefined) colorOff = [];
|
||||
if (mode == undefined) mode = [];
|
||||
if (img == undefined) img = [];
|
||||
if (name == undefined) name = [];
|
||||
let soundData = {};
|
||||
if (this.settings.sounds == undefined) this.settings.sounds = [];
|
||||
if (this.settings.colorOn == undefined) this.settings.colorOn = [];
|
||||
if (this.settings.colorOff == undefined) this.settings.colorOff = [];
|
||||
if (this.settings.mode == undefined) this.settings.mode = [];
|
||||
if (this.settings.img == undefined) this.settings.img = [];
|
||||
if (this.settings.volume == undefined) this.settings.volume = [];
|
||||
if (this.settings.name == undefined) this.settings.name = [];
|
||||
if (this.settings.selectedPlaylists == undefined) this.settings.selectedPlaylists = [];
|
||||
if (this.settings.src == undefined) this.settings.src = [];
|
||||
let soundData = [];
|
||||
|
||||
let streamDeckModel = game.settings.get(MODULE.moduleName,'streamDeckModel');
|
||||
let iMax,jMax;
|
||||
|
||||
if (streamDeckModel == 0){
|
||||
jMax = 6;
|
||||
iMax = 3;
|
||||
this.jMax = 6;
|
||||
this.iMax = 3;
|
||||
}
|
||||
else if (streamDeckModel == 1){
|
||||
jMax = 6;
|
||||
iMax = 5;
|
||||
this.jMax = 6;
|
||||
this.iMax = 5;
|
||||
}
|
||||
else {
|
||||
jMax = 8;
|
||||
iMax = 8;
|
||||
this.jMax = 8;
|
||||
this.iMax = 8;
|
||||
}
|
||||
|
||||
let iteration = 0;
|
||||
|
||||
for (let j=0; j<jMax; j++){
|
||||
let soundsThis = {};
|
||||
for (let i=0; i<iMax; i++){
|
||||
if (volume == undefined) volume = 50;
|
||||
|
||||
|
||||
for (let j=0; j<this.jMax; j++){
|
||||
let soundsThis = [];
|
||||
for (let i=0; i<this.iMax; i++){
|
||||
let selectedPlaylist;
|
||||
let sounds = [];
|
||||
if (this.settings.volume[iteration] == undefined) this.settings.volume[iteration] = 50;
|
||||
if (this.settings.selectedPlaylists[iteration]==undefined) selectedPlaylist = 'none';
|
||||
else if (this.settings.selectedPlaylists[iteration] == 'none') selectedPlaylist = 'none';
|
||||
else if (this.settings.selectedPlaylists[iteration] == 'FP') selectedPlaylist = 'FP';
|
||||
else {
|
||||
const pl = game.playlists.entities.find(p => p._id == this.settings.selectedPlaylists[iteration]);
|
||||
selectedPlaylist = pl._id;
|
||||
sounds = pl.sounds;
|
||||
}
|
||||
let styleSS = "";
|
||||
let styleFP ="display:none";
|
||||
if (selectedPlaylist == 'FP') {
|
||||
styleSS = 'display:none';
|
||||
styleFP = ''
|
||||
}
|
||||
let dataThis = {
|
||||
iteration: iteration+1,
|
||||
sound: selectedSounds[iteration],
|
||||
playlists: playlists,
|
||||
selectedPlaylist: selectedPlaylist,
|
||||
sound: this.settings.sounds[iteration],
|
||||
sounds: sounds,
|
||||
colorOn: colorOn[iteration],
|
||||
colorOff: colorOff[iteration],
|
||||
mode: mode[iteration],
|
||||
volume: volume[iteration],
|
||||
imgPath: img[iteration],
|
||||
name: name[iteration]
|
||||
srcPath: this.settings.src[iteration],
|
||||
colorOn: this.settings.colorOn[iteration],
|
||||
colorOff: this.settings.colorOff[iteration],
|
||||
mode: this.settings.mode[iteration],
|
||||
volume: this.settings.volume[iteration],
|
||||
imgPath: this.settings.img[iteration],
|
||||
name: this.settings.name[iteration],
|
||||
styleSS: styleSS,
|
||||
styleFP: styleFP
|
||||
}
|
||||
MODULE.setToJSONArray(soundsThis,i,dataThis);
|
||||
soundsThis.push(dataThis);
|
||||
iteration++;
|
||||
}
|
||||
let data = {
|
||||
dataThis: soundsThis,
|
||||
};
|
||||
MODULE.setToJSONArray(soundData,j,data);
|
||||
|
||||
soundData.push(data);
|
||||
}
|
||||
this.data = soundData;
|
||||
|
||||
return {
|
||||
playlists: game.playlists.entities,
|
||||
playlist: playlistId,
|
||||
sounds: sounds,
|
||||
selectedSound81: selectedSounds.a,
|
||||
soundData: soundData,
|
||||
soundData: this.data
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,88 +405,148 @@ export class soundboardConfigForm extends FormApplication {
|
||||
* @param {*} formData
|
||||
*/
|
||||
async _updateObject(event, formData) {
|
||||
let length = formData["sounds"].length;
|
||||
let img = [];
|
||||
for (let i=0; i<length; i++){
|
||||
let name = "img"+(i+1);
|
||||
let src = formData[name];
|
||||
img[i] = src;
|
||||
}
|
||||
|
||||
await game.settings.set(MODULE.moduleName,'soundboardSettings',{
|
||||
playlist: formData["playlist"],
|
||||
sounds: formData["sounds"],
|
||||
colorOn: formData["colorOn"],
|
||||
colorOff: formData["colorOff"],
|
||||
mode: formData["mode"],
|
||||
img: img,
|
||||
volume: formData["volume"],
|
||||
name: formData["name"]
|
||||
});
|
||||
//MODULE.launchpad.audioSoundboardUpdate();
|
||||
|
||||
}
|
||||
|
||||
async activateListeners(html) {
|
||||
super.activateListeners(html);
|
||||
const colorPickerOn = html.find("button[name='colorPickerOn']");
|
||||
const colorPickerOff = html.find("button[name='colorPickerOff']");
|
||||
const nameField = html.find("input[name='namebox']");
|
||||
const playlistSelect = html.find("select[name='playlist']");
|
||||
const volumeSlider = html.find("input[name='volume']");
|
||||
const soundSelect = html.find("select[name='sounds']");
|
||||
const soundFP = html.find("input[name2='soundSrc']");
|
||||
const imgFP = html.find("input[name2='imgSrc']");
|
||||
const onCP = html.find("input[name='colorOn']");
|
||||
const offCP = html.find("input[name='colorOff']");
|
||||
const playMode = html.find("select[name='mode']");
|
||||
const volume = html.find("input[name='volume']");
|
||||
|
||||
/*
|
||||
colorPickerOn.on('click',(event) => {
|
||||
let target = event.currentTarget.value;
|
||||
let color = document.getElementById("colorOn"+target).value;
|
||||
if ((color < 0 && color > 127) || color == "") color = 0;
|
||||
MODULE.launchpad.colorPicker(target,1,color);
|
||||
|
||||
});
|
||||
colorPickerOff.on('click',(event) => {
|
||||
let target = event.currentTarget.value;
|
||||
let color = document.getElementById("colorOff"+target).value;
|
||||
if ((color < 0 && color > 127) || color == "") color = 0;
|
||||
MODULE.launchpad.colorPicker(target,0,color);
|
||||
|
||||
nameField.on("change",event => {
|
||||
let id = event.target.id.replace('name','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].name=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.name[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
if (playlistSelect.length > 0) {
|
||||
playlistSelect.on("change", event => {
|
||||
this.playlist = event.target.value;
|
||||
this.updatePlaylist = true;
|
||||
this.render();
|
||||
});
|
||||
}
|
||||
volumeSlider.on('change', event => {
|
||||
let id = event.target.id.replace('volume','');
|
||||
let column = id%10-1;
|
||||
let row = 8-Math.floor(id/10);
|
||||
id = row*8+column;
|
||||
let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
settings.volume[id] = event.target.value;
|
||||
game.settings.set(MODULE.moduleName,'soundboardSettings',settings);
|
||||
if (MODULE.launchpad.activeSounds[id] != false){
|
||||
let volume = AudioHelper.inputToVolume(event.target.value/100) * game.settings.get("core", "globalInterfaceVolume");
|
||||
MODULE.launchpad.activeSounds[id].volume(volume);
|
||||
}
|
||||
});
|
||||
if (soundSelect.length > 0) {
|
||||
soundSelect.on("change",event => {
|
||||
let id = event.target.id.replace('soundSelect','');
|
||||
let column = id%10-1;
|
||||
let row = 8-Math.floor(id/10);
|
||||
id = row*8+column;
|
||||
let settings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
settings.sounds[id] = event.target.value;
|
||||
game.settings.set(MODULE.moduleName,'soundboardSettings',settings);
|
||||
if (MODULE.launchpad.activeSounds[id] != false){
|
||||
let mode = settings.mode[id];
|
||||
let repeat = false;
|
||||
if (mode == 1) repeat = true;
|
||||
MODULE.launchpad.playSound(id,repeat,false);
|
||||
let id = event.target.id.replace('playlists','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].selectedPlaylist=event.target.value;
|
||||
|
||||
let selectedPlaylist;
|
||||
let sounds = [];
|
||||
if (event.target.value==undefined) selectedPlaylist = 'none';
|
||||
else if (event.target.value == 'none') selectedPlaylist = 'none';
|
||||
else if (event.target.value == 'FP') selectedPlaylist = 'FP';
|
||||
else {
|
||||
const pl = game.playlists.entities.find(p => p._id == event.target.value);
|
||||
selectedPlaylist = pl._id;
|
||||
sounds = pl.sounds;
|
||||
}
|
||||
this.data[j].dataThis[i].sounds=sounds;
|
||||
|
||||
let styleSS = "";
|
||||
let styleFP ="display:none";
|
||||
if (selectedPlaylist == 'FP') {
|
||||
styleSS = 'display:none';
|
||||
styleFP = ''
|
||||
}
|
||||
this.data[j].dataThis[i].styleSS=styleSS;
|
||||
this.data[j].dataThis[i].styleFP=styleFP;
|
||||
this.update = true;
|
||||
|
||||
this.settings.selectedPlaylists[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
soundSelect.on("change", event => {
|
||||
let id = event.target.id.replace('soundSelect','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].sound=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.sounds[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
soundFP.on("change",event => {
|
||||
let id = event.target.id.replace('srcPath','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].srcPath=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.src[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
imgFP.on("change",event => {
|
||||
let id = event.target.id.replace('imgPath','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].imgPath=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.img[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
onCP.on("change",event => {
|
||||
let id = event.target.id.replace('colorOn','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].colorOn=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.colorOn[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
offCP.on("change",event => {
|
||||
let id = event.target.id.replace('colorOff','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].colorOff=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.colorOff[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
playMode.on("change",event => {
|
||||
let id = event.target.id.replace('playmode','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].mode=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.mode[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
|
||||
volume.on("change",event => {
|
||||
let id = event.target.id.replace('volume','')-1;
|
||||
let j = Math.floor(id/this.jMax);
|
||||
let i = id % this.jMax;
|
||||
this.data[j].dataThis[i].volume=event.target.value;
|
||||
this.update = true;
|
||||
|
||||
this.settings.volume[id]=event.target.value;
|
||||
this.updateSettings(this.settings);
|
||||
});
|
||||
}
|
||||
|
||||
async updateSettings(settings){
|
||||
await game.settings.set(MODULE.moduleName,'soundboardSettings',settings);
|
||||
if (MODULE.enableModule) soundboard.updateAll();
|
||||
this.render();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,7 +6,7 @@ export class Move{
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
console.log('move',settings)
|
||||
if (canvas.scene == null) return;
|
||||
let dir = settings.dir;
|
||||
let mode = settings.mode;
|
||||
if (mode == undefined) mode = 0;
|
||||
|
||||
@@ -36,6 +36,15 @@ export class OtherControls{
|
||||
else if (mode == 4){ //roll tables
|
||||
this.updateRollTable(settings,context);
|
||||
}
|
||||
else if (mode == 5) { //open sidebar tab
|
||||
this.updateSidebar(settings,context);
|
||||
}
|
||||
else if (mode == 6) { //open compendium
|
||||
this.updateCompendium(settings,context);
|
||||
}
|
||||
else if (mode == 7) { //open journal
|
||||
this.updateJournal(settings,context);
|
||||
}
|
||||
}
|
||||
|
||||
keyPress(settings){
|
||||
@@ -57,6 +66,15 @@ export class OtherControls{
|
||||
else if (mode == 4) { //roll tables
|
||||
this.keyPressRollTable(settings);
|
||||
}
|
||||
else if (mode == 5) { //sidebar
|
||||
this.keyPressSidebar(settings);
|
||||
}
|
||||
else if (mode == 6) { //open compendium
|
||||
this.keyPressCompendium(settings);
|
||||
}
|
||||
else if (mode == 7) { //open journal
|
||||
this.keyPressJournal(settings);
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -115,6 +133,7 @@ export class OtherControls{
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateScene(settings,context){
|
||||
if (canvas.scene == null) return;
|
||||
let func = settings.sceneFunction;
|
||||
if (func == undefined) func = 0;
|
||||
|
||||
@@ -150,7 +169,6 @@ export class OtherControls{
|
||||
if (settings.displaySceneIcon) src = scene.img;
|
||||
if (scene.active) name += "\n(Active)";
|
||||
}
|
||||
|
||||
}
|
||||
else if (func == 1) { //all scenes
|
||||
let scene = game.scenes.apps[1].entities.find(p=>p.data.name == name);
|
||||
@@ -287,6 +305,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressControl(settings){
|
||||
if (canvas.scene == null) return;
|
||||
let control = settings.control;
|
||||
if (control == undefined) control = 0;
|
||||
|
||||
@@ -456,7 +475,8 @@ export class OtherControls{
|
||||
}
|
||||
else if (func == 2){ //display darkness
|
||||
src = 'action/images/other/darkness/darkness.png';
|
||||
let darkness = Math.floor(canvas.scene.data.darkness*100)/100;
|
||||
let darkness = '';
|
||||
if (canvas.scene != null) darkness = Math.floor(canvas.scene.data.darkness*100)/100;
|
||||
txt += darkness;
|
||||
}
|
||||
streamDeck.setTitle(txt,context);
|
||||
@@ -464,6 +484,7 @@ export class OtherControls{
|
||||
}
|
||||
|
||||
keyPressDarkness(settings) {
|
||||
if (canvas.scene == null) return;
|
||||
let func = settings.darknessFunction;
|
||||
if (func == undefined) func = 0;
|
||||
|
||||
@@ -528,4 +549,172 @@ export class OtherControls{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
getSidebarId(nr){
|
||||
let id;
|
||||
if (nr == 0) id = 'chat';
|
||||
else if (nr == 1) id = 'combat';
|
||||
else if (nr == 2) id = 'scenes';
|
||||
else if (nr == 3) id = 'actors';
|
||||
else if (nr == 4) id = 'items';
|
||||
else if (nr == 5) id = 'journal';
|
||||
else if (nr == 6) id = 'tables';
|
||||
else if (nr == 7) id = 'playlists';
|
||||
else if (nr == 8) id = 'compendium';
|
||||
else if (nr == 9) id = 'settings';
|
||||
else id = '';
|
||||
return id;
|
||||
}
|
||||
|
||||
getSidebarName(nr){
|
||||
let name;
|
||||
if (nr == 0) name = game.i18n.localize("SIDEBAR.TabChat");
|
||||
else if (nr == 1) name = game.i18n.localize("SIDEBAR.TabCombat");
|
||||
else if (nr == 2) name = game.i18n.localize("SIDEBAR.TabScenes");
|
||||
else if (nr == 3) name = game.i18n.localize("SIDEBAR.TabActors");
|
||||
else if (nr == 4) name = game.i18n.localize("SIDEBAR.TabItems");
|
||||
else if (nr == 5) name = game.i18n.localize("SIDEBAR.TabJournal");
|
||||
else if (nr == 6) name = game.i18n.localize("SIDEBAR.TabTables");
|
||||
else if (nr == 7) name = game.i18n.localize("SIDEBAR.TabPlaylists");
|
||||
else if (nr == 8) name = game.i18n.localize("SIDEBAR.TabCompendium");
|
||||
else if (nr == 9) name = game.i18n.localize("SIDEBAR.TabSettings");
|
||||
else if (nr == 10) name = game.i18n.localize("SIDEBAR.CollapseToggle");
|
||||
return name;
|
||||
}
|
||||
|
||||
getSidebarIcon(nr){
|
||||
let icon;
|
||||
if (nr == 0) icon = window.CONFIG.ChatMessage.sidebarIcon;
|
||||
else if (nr == 1) icon = window.CONFIG.Combat.sidebarIcon;
|
||||
else if (nr == 2) icon = window.CONFIG.Scene.sidebarIcon;
|
||||
else if (nr == 3) icon = window.CONFIG.Actor.sidebarIcon;
|
||||
else if (nr == 4) icon = window.CONFIG.Item.sidebarIcon;
|
||||
else if (nr == 5) icon = window.CONFIG.JournalEntry.sidebarIcon;
|
||||
else if (nr == 6) icon = window.CONFIG.RollTable.sidebarIcon;
|
||||
else if (nr == 7) icon = window.CONFIG.Playlist.sidebarIcon;
|
||||
else if (nr == 8) icon = "fas fa-atlas";
|
||||
else if (nr == 9) icon = "fas fa-cogs";
|
||||
else if (nr == 10) icon = "fas fa-caret-right";
|
||||
return icon;
|
||||
}
|
||||
|
||||
updateSidebar(settings,context){
|
||||
let sidebarTab = settings.sidebarTab;
|
||||
if (sidebarTab == undefined) sidebarTab = 0;
|
||||
|
||||
let activeTab = ui.sidebar.activeTab;
|
||||
let collapsed = ui.sidebar._collapsed;
|
||||
|
||||
let name = "";
|
||||
let icon = "";
|
||||
|
||||
let background = settings.background;
|
||||
if(background == undefined) background = '#000000';
|
||||
|
||||
let ringColor = "#000000";
|
||||
|
||||
let ringOffColor = settings.offRing;
|
||||
if (ringOffColor == undefined) ringOffColor = '#000000';
|
||||
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
if (settings.displaySidebarName) name = this.getSidebarName(sidebarTab);
|
||||
if (settings.displaySidebarIcon) icon = this.getSidebarIcon(sidebarTab);
|
||||
|
||||
if ((sidebarTab == 10 && collapsed))
|
||||
ringColor = ringOnColor;
|
||||
else
|
||||
ringColor = ringOffColor;
|
||||
streamDeck.setTitle(name,context);
|
||||
streamDeck.setIcon(1,context,icon,background,2,ringColor);
|
||||
}
|
||||
|
||||
keyPressSidebar(settings){
|
||||
let sidebarTab = settings.sidebarTab;
|
||||
if (sidebarTab == undefined) sidebarTab = 0;
|
||||
let collapsed = ui.sidebar._collapsed;
|
||||
|
||||
if (sidebarTab < 10) ui.sidebar.activateTab(this.getSidebarId(sidebarTab));
|
||||
else if (collapsed) ui.sidebar.expand();
|
||||
else if (collapsed == false) ui.sidebar.collapse();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
updateCompendium(settings,context){
|
||||
let background = settings.background;
|
||||
if(background == undefined) background = '#000000';
|
||||
|
||||
let name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
|
||||
const compendium = game.packs.entries.find(p=>p.metadata.label == name);
|
||||
if (compendium == undefined) return;
|
||||
|
||||
let ringColor = "#000000";
|
||||
|
||||
let ringOffColor = settings.offRing;
|
||||
if (ringOffColor == undefined) ringOffColor = '#000000';
|
||||
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
if (compendium.rendered) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
if (settings.displayCompendiumName) streamDeck.setTitle(name,context);
|
||||
streamDeck.setIcon(0,context,"",background,2,ringColor);
|
||||
}
|
||||
|
||||
keyPressCompendium(settings){
|
||||
let name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
|
||||
const compendium = game.packs.entries.find(p=>p.metadata.label == name);
|
||||
if (compendium == undefined) return;
|
||||
if (compendium.rendered) compendium.close();
|
||||
else compendium.render(true);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Journals
|
||||
//game.journal.entries[0].render(true)
|
||||
|
||||
updateJournal(settings,context){
|
||||
let background = settings.background;
|
||||
if(background == undefined) background = '#000000';
|
||||
|
||||
let name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
const journal = game.journal.entries.find(p=>p.name == name);
|
||||
if (journal == undefined) return;
|
||||
|
||||
let ringColor = "#000000";
|
||||
|
||||
let ringOffColor = settings.offRing;
|
||||
if (ringOffColor == undefined) ringOffColor = '#000000';
|
||||
|
||||
let ringOnColor = settings.onRing;
|
||||
if (ringOnColor == undefined) ringOnColor = '#00FF00';
|
||||
|
||||
if (journal.sheet.rendered) ringColor = ringOnColor;
|
||||
else ringColor = ringOffColor;
|
||||
|
||||
if (settings.displayCompendiumName) streamDeck.setTitle(name,context);
|
||||
streamDeck.setIcon(0,context,"",background,2,ringColor);
|
||||
}
|
||||
|
||||
keyPressJournal(settings){
|
||||
let name = settings.compendiumName;
|
||||
if (name == undefined) return;
|
||||
|
||||
const journal = game.journal.entries.find(p=>p.name == name);
|
||||
if (journal == undefined) return;
|
||||
|
||||
journal.render(true);
|
||||
}
|
||||
}
|
||||
@@ -127,16 +127,30 @@ export class PlaylistControl{
|
||||
streamDeck.setTitle(name,context);
|
||||
}
|
||||
|
||||
stopAll(){
|
||||
let playing = game.playlists.playing;
|
||||
for (let i=0; i<playing.length; i++){
|
||||
playing[i].stopAll();
|
||||
stopAll(force=false){
|
||||
if (force){
|
||||
let playing = game.playlists.playing;
|
||||
for (let i=0; i<playing.length; i++){
|
||||
playing[i].stopAll();
|
||||
}
|
||||
}
|
||||
else {
|
||||
let playing = game.playlists.playing;
|
||||
let settings = game.settings.get(MODULE.moduleName,'playlists');
|
||||
let selectedPlaylists = settings.selectedPlaylist;
|
||||
for (let i=0; i<playing.length; i++){
|
||||
const playlistNr = selectedPlaylists.findIndex(p => p == playing[i]._id);
|
||||
const mode = settings.playlistMode[playlistNr];
|
||||
if (mode == 0) playing[i].stopAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
getPlaylist(num){
|
||||
let playlistId = game.settings.get(MODULE.moduleName,'selectedPlaylists')[num];
|
||||
return game.playlists.entities.find(p => p._id == playlistId);
|
||||
let selectedPlaylists = game.settings.get(MODULE.moduleName,'playlists').selectedPlaylist;
|
||||
if (selectedPlaylists != undefined)
|
||||
return game.playlists.entities.find(p => p._id == selectedPlaylists[num]);
|
||||
else return undefined;
|
||||
}
|
||||
|
||||
keyPress(settings,context){
|
||||
@@ -156,11 +170,11 @@ export class PlaylistControl{
|
||||
let playlist = this.getPlaylist(playlistNr);
|
||||
if (playlist != undefined){
|
||||
if (settings.playlistMode == 0)
|
||||
this.playPlaylist(playlist);
|
||||
this.playPlaylist(playlist,playlistNr);
|
||||
else {
|
||||
let track = playlist.data.sounds[trackNr];
|
||||
if (track != undefined){
|
||||
this.playTrack(track,playlist);
|
||||
this.playTrack(track,playlist,playlistNr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,34 +192,38 @@ export class PlaylistControl{
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.stopAll();
|
||||
this.stopAll(true);
|
||||
}
|
||||
}
|
||||
|
||||
async playPlaylist(playlist){
|
||||
async playPlaylist(playlist,playlistNr){
|
||||
if (playlist.playing) {
|
||||
playlist.stopAll();
|
||||
return;
|
||||
}
|
||||
let mode = game.settings.get(MODULE.moduleName,'playlistMethod');
|
||||
if (mode == 2) await this.stopAll();
|
||||
let mode = game.settings.get(MODULE.moduleName,'playlists').playlistMode[playlistNr];
|
||||
if (mode == 0) {
|
||||
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
|
||||
if (mode == 2) await this.stopAll();
|
||||
}
|
||||
playlist.playAll();
|
||||
}
|
||||
|
||||
async playTrack(track,playlist){
|
||||
async playTrack(track,playlist,playlistNr){
|
||||
let play;
|
||||
if (track.playing)
|
||||
play = false;
|
||||
else {
|
||||
play = true;
|
||||
let mode = game.settings.get(MODULE.moduleName,'playlistMethod');
|
||||
if (mode == 1) await playlist.stopAll();
|
||||
else if (mode == 2) await this.stopAll();
|
||||
let mode = game.settings.get(MODULE.moduleName,'playlists').playlistMode[playlistNr];
|
||||
if (mode == 0) {
|
||||
mode = game.settings.get(MODULE.moduleName,'playlists').playMode;
|
||||
if (mode == 1) await playlist.stopAll();
|
||||
else if (mode == 2) await this.stopAll();
|
||||
}
|
||||
else if (mode == 2) await playlist.stopAll();
|
||||
}
|
||||
await playlist.updateEmbeddedEntity("PlaylistSound", {_id: track._id, playing: play});
|
||||
playlist.update({playing: play});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -9,9 +9,9 @@ export const registerSettings = function() {
|
||||
//Enabled the module
|
||||
game.settings.register(MODULE.moduleName,'Enable', {
|
||||
name: "MaterialDeck.Sett.Enable",
|
||||
scope: "world",
|
||||
scope: "global",
|
||||
config: true,
|
||||
default: true,
|
||||
default: false,
|
||||
type: Boolean,
|
||||
onChange: x => window.location.reload()
|
||||
});
|
||||
@@ -27,17 +27,21 @@ export const registerSettings = function() {
|
||||
});
|
||||
|
||||
/**
|
||||
* Playlist soundboard
|
||||
* Sets the ip address of the server
|
||||
*/
|
||||
game.settings.register(MODULE.moduleName,'playlistMethod', {
|
||||
name: "Playlist play method",
|
||||
game.settings.register(MODULE.moduleName,'address', {
|
||||
name: "MaterialDeck.Sett.ServerAddr",
|
||||
hint: "MaterialDeck.Sett.ServerAddrHint",
|
||||
scope: "world",
|
||||
config: false,
|
||||
type:Number,
|
||||
default:0,
|
||||
choices:["MaterialDeck.Playlist.Playmethod.Unrestricted","MaterialDeck.Playlist.Playmethod.OneTrackPlaylist","MaterialDeck.Playlist.Playmethod.OneTrackTotal"],
|
||||
config: true,
|
||||
default: "localhost:3001",
|
||||
type: String,
|
||||
onChange: x => window.location.reload()
|
||||
});
|
||||
|
||||
/**
|
||||
* Playlist soundboard
|
||||
*/
|
||||
game.settings.registerMenu(MODULE.moduleName, 'playlistConfigMenu',{
|
||||
name: "MaterialDeck.Sett.PlaylistConfig",
|
||||
label: "MaterialDeck.Sett.PlaylistConfig",
|
||||
@@ -45,11 +49,11 @@ export const registerSettings = function() {
|
||||
restricted: true
|
||||
});
|
||||
|
||||
game.settings.register(MODULE.moduleName, 'selectedPlaylists', {
|
||||
game.settings.register(MODULE.moduleName, 'playlists', {
|
||||
name: "selectedPlaylists",
|
||||
scope: "world",
|
||||
type: Object,
|
||||
default: {a: "None",b: "None",c: "none",d: "none",e: "none",f: "none",g: "none",h: "none",i: "none"},
|
||||
default: {},
|
||||
config: false
|
||||
});
|
||||
|
||||
|
||||
@@ -45,8 +45,8 @@ export class SoundboardControl{
|
||||
else
|
||||
ringColor = soundboardSettings.colorOn[soundNr];
|
||||
|
||||
if (settings.displayName) txt = soundboardSettings.name[soundNr];
|
||||
if (settings.displayIcon) src = soundboardSettings.img[soundNr];
|
||||
if (settings.displayName && soundboardSettings.name != undefined) txt = soundboardSettings.name[soundNr];
|
||||
if (settings.displayIcon && soundboardSettings.img != undefined) src = soundboardSettings.img[soundNr];
|
||||
streamDeck.setTitle(txt,context);
|
||||
streamDeck.setIcon(1,context,src,background,2,ringColor);
|
||||
}
|
||||
@@ -117,30 +117,47 @@ export class SoundboardControl{
|
||||
this.playSound(soundNr,false,false);
|
||||
}
|
||||
|
||||
playSound(soundNr,repeat,play){
|
||||
let trackId = game.settings.get(MODULE.moduleName,'soundboardSettings').sounds[soundNr];
|
||||
async playSound(soundNr,repeat,play){
|
||||
const soundBoardSettings = game.settings.get(MODULE.moduleName,'soundboardSettings');
|
||||
let playlistId;
|
||||
if (soundBoardSettings.selectedPlaylists != undefined) playlistId = soundBoardSettings.selectedPlaylists[soundNr];
|
||||
let src;
|
||||
if (playlistId == "" || playlistId == undefined) return;
|
||||
if (playlistId == 'none') return;
|
||||
else if (playlistId == 'FP') {
|
||||
src = soundBoardSettings.src[soundNr];
|
||||
const ret = await FilePicker.browse("data", src, {wildcard:true});
|
||||
const files = ret.files;
|
||||
if (files.length == 1) src = files;
|
||||
else {
|
||||
let value = Math.floor(Math.random() * Math.floor(files.length));
|
||||
src = files[value];
|
||||
}
|
||||
}
|
||||
else {
|
||||
const soundId = soundBoardSettings.sounds[soundNr];
|
||||
const sounds = game.playlists.entities.find(p => p._id == playlistId).data.sounds;
|
||||
if (sounds == undefined) return;
|
||||
const sound = sounds.find(p => p._id == soundId);
|
||||
if (sound == undefined) return;
|
||||
src = sound.path;
|
||||
}
|
||||
|
||||
let volume = game.settings.get(MODULE.moduleName,'soundboardSettings').volume[soundNr]/100;
|
||||
volume = AudioHelper.inputToVolume(volume);
|
||||
if (trackId == "" || trackId == undefined) return;
|
||||
|
||||
let payload = {
|
||||
"msgType": "playSound",
|
||||
"trackNr": soundNr,
|
||||
"src": src,
|
||||
"repeat": repeat,
|
||||
"play": play,
|
||||
"volume": volume
|
||||
};
|
||||
game.socket.emit(`module.MaterialDeck`, payload);
|
||||
|
||||
if (play){
|
||||
let trackId = game.settings.get(MODULE.moduleName,'soundboardSettings').sounds[soundNr];
|
||||
let playlistId = game.settings.get(MODULE.moduleName,'soundboardSettings').playlist;
|
||||
let sounds = game.playlists.entities.find(p => p._id == playlistId).data.sounds;
|
||||
let sound = sounds.find(p => p._id == trackId);
|
||||
if (sound == undefined){
|
||||
this.activeSounds[soundNr] = false;
|
||||
return;
|
||||
}
|
||||
volume *= game.settings.get("core", "globalInterfaceVolume");
|
||||
let src = sound.path;
|
||||
|
||||
let howl = new Howl({src, volume, loop: repeat, onend: (id)=>{
|
||||
if (repeat == false){
|
||||
|
||||
@@ -61,7 +61,6 @@ export class StreamDeck{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Get syllables of a word. Taken from: https://stackoverflow.com/a/49407494
|
||||
@@ -70,12 +69,15 @@ export class StreamDeck{
|
||||
return words.match(this.syllableRegex);
|
||||
}
|
||||
|
||||
formatTitle(txt){
|
||||
formatTitle(txt=''){
|
||||
let txtArrayOriginal = txt.split("\n");
|
||||
let txtArray = [];
|
||||
let counter = 0;
|
||||
for (let i=0; i<txtArrayOriginal.length; i++){
|
||||
|
||||
if (i>0){
|
||||
txtArray[counter] = '';
|
||||
counter++;
|
||||
}
|
||||
let txtArrayTemp = txtArrayOriginal[i].split(" ");
|
||||
for (let j=0; j<txtArrayTemp.length; j++){
|
||||
txtArray[counter] = txtArrayTemp[j];
|
||||
@@ -133,6 +135,7 @@ export class StreamDeck{
|
||||
}
|
||||
|
||||
setTitle(txt,context){
|
||||
if (txt == null || txt == undefined) txt = '';
|
||||
txt = this.formatTitle(txt);
|
||||
for (let i=0; i<32; i++){
|
||||
if (this.buttonContext[i] == undefined) continue;
|
||||
@@ -168,8 +171,6 @@ export class StreamDeck{
|
||||
}
|
||||
|
||||
setImage(image,context){
|
||||
//var image = "data:image/svg+xml;charset=utf8,<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --><svg version=\"1.1\" id=\"Capa_1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\" viewBox=\"0 0 288 288\" style=\"enable-background:new 0 0 288 288;\" xml:space=\"preserve\"> <style> .text { font-family: sans-serif; fill: red; font-size: 10em; } </style><g> <text x=\"0px\" y=\"100px\" class=\"text\">GPUUTILIZATION</text></g></svg>";
|
||||
|
||||
var json = {
|
||||
target: "SD",
|
||||
event: "setImage",
|
||||
@@ -182,7 +183,8 @@ export class StreamDeck{
|
||||
MODULE.sendWS(JSON.stringify(json));
|
||||
}
|
||||
|
||||
setIcon(iconLocation, context,src,background = '#000000',ring=0,ringColor = "#000000",overlay=false){
|
||||
setIcon(iconLocation, context,src='',background = '#000000',ring=0,ringColor = "#000000",overlay=false){
|
||||
if (src == null || src == undefined) src = '';
|
||||
for (let i=0; i<32; i++){
|
||||
if (this.buttonContext[i] == undefined) continue;
|
||||
if (this.buttonContext[i].context == context) {
|
||||
@@ -266,7 +268,6 @@ export class StreamDeck{
|
||||
getImage(data){
|
||||
if (data == undefined)
|
||||
return;
|
||||
//console.log('image',data)
|
||||
const context = data.context;
|
||||
var url = data.url;
|
||||
const format = data.format;
|
||||
@@ -288,7 +289,7 @@ export class StreamDeck{
|
||||
canvas.id = canvasId;
|
||||
canvas.width="144";
|
||||
canvas.height="144";
|
||||
canvas.style="background-color:transparent";
|
||||
canvas.style="background-color:transparent;visibility:hidden";
|
||||
document.getElementById('sdCanvasBox').appendChild(canvas); // adds the canvas to #someBox
|
||||
}
|
||||
this.counter++;
|
||||
|
||||
199
src/token.js
@@ -18,62 +18,125 @@ export class TokenControl{
|
||||
pushData(tokenId,settings,context,ring=0,ringColor='#000000'){
|
||||
let name = false;
|
||||
let icon = false;
|
||||
let type = 0;
|
||||
let stats = settings.stats;
|
||||
let background = "#000000";
|
||||
|
||||
if (settings.displayIcon) icon = true;
|
||||
if (settings.displayName) name = true;
|
||||
if (settings.stats != undefined) type = settings.stats;
|
||||
if (stats == undefined) stats = 0;
|
||||
if (settings.background) background = settings.background;
|
||||
|
||||
|
||||
let system = settings.system;
|
||||
if (system == undefined) system = 'dnd5e';
|
||||
|
||||
let tokenName = "";
|
||||
let hp = "";
|
||||
let AC = "";
|
||||
let speed = "";
|
||||
let initiative = "";
|
||||
let txt = "";
|
||||
let iconSrc = "";
|
||||
if (tokenId != undefined) {
|
||||
let token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
tokenName = token.data.name;
|
||||
if (name) txt += tokenName;
|
||||
if (name && stats != 0) txt += "\n";
|
||||
iconSrc += token.data.img;
|
||||
let actor = canvas.tokens.children[0].children.find(p => p.id == tokenId).actor;
|
||||
let system = game.system.id;
|
||||
if (system == 'dnd5e'){
|
||||
if (system == 'dnd5e' && game.system.id == 'dnd5e'){
|
||||
let attributes = actor.data.data.attributes;
|
||||
let hpCurrent = attributes.hp.value;
|
||||
let hpMax = attributes.hp.max;
|
||||
hp = hpCurrent + "/" + hpMax;
|
||||
AC = attributes.ac.value;
|
||||
|
||||
if (attributes.speed._deprecated){
|
||||
if (attributes.movement.burrow > 0) speed += attributes.movement.burrow + attributes.movement.units + " burrow";
|
||||
if (attributes.movement.climb > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += attributes.movement.climb + attributes.movement.units + " climb";
|
||||
}
|
||||
if (attributes.movement.fly > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += attributes.movement.fly + attributes.movement.units + " fly";
|
||||
}
|
||||
if (attributes.movement.hover > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += attributes.movement.hover + attributes.movement.units + " hover";
|
||||
}
|
||||
if (attributes.movement.swim > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += attributes.movement.swim + attributes.movement.units + " swim";
|
||||
}
|
||||
if (attributes.movement.walk > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += attributes.movement.walk + attributes.movement.units + " walk";
|
||||
}
|
||||
if (stats == 'HP') txt += attributes.hp.value + "/" + attributes.hp.max;
|
||||
else if (stats == 'TempHP') {
|
||||
txt += attributes.hp.temp;
|
||||
if (attributes.hp.tempmax != null)
|
||||
txt += "/" + attributes.hp.tempmax;
|
||||
}
|
||||
else {
|
||||
speed = attributes.speed.value;
|
||||
if (attributes.speed.special.length > 0) speed + "\n" + attributes.speed.special;
|
||||
else if (stats == 'AC') txt += attributes.ac.value;
|
||||
else if (stats == 'Speed'){
|
||||
let speed = "";
|
||||
if (attributes.speed._deprecated){
|
||||
if (attributes.movement.burrow > 0) speed += game.i18n.localize("DND5E.MovementBurrow") + ': ' + attributes.movement.burrow + attributes.movement.units;
|
||||
if (attributes.movement.climb > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += game.i18n.localize("DND5E.MovementClimb") + ': ' + attributes.movement.climb + attributes.movement.units;
|
||||
}
|
||||
if (attributes.movement.fly > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += game.i18n.localize("DND5E.MovementFly") + ': ' + attributes.movement.fly + attributes.movement.units;
|
||||
}
|
||||
if (attributes.movement.hover > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += game.i18n.localize("DND5E.MovementHover") + ': ' + attributes.movement.hover + attributes.movement.units;
|
||||
}
|
||||
if (attributes.movement.swim > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += game.i18n.localize("DND5E.MovementSwim") + ': ' + attributes.movement.swim + attributes.movement.units;
|
||||
}
|
||||
if (attributes.movement.walk > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += game.i18n.localize("DND5E.MovementWalk") + ': ' + attributes.movement.walk + attributes.movement.units;
|
||||
}
|
||||
}
|
||||
else {
|
||||
speed = attributes.speed.value;
|
||||
if (attributes.speed.special.length > 0) speed + "\n" + attributes.speed.special;
|
||||
}
|
||||
txt += speed;
|
||||
}
|
||||
else if (stats == 'Init') txt += attributes.init.total;
|
||||
else if (stats == 'PassivePerception') txt += actor.data.data.skills.prc.passive;
|
||||
else if (stats == 'PassiveInvestigation') txt += actor.data.data.skills.inv.passive;
|
||||
}
|
||||
else if (system == 'dnd3.5e' && game.system.id == 'D35E'){
|
||||
let attributes = actor.data.data.attributes;
|
||||
if (stats == 'HP') txt += attributes.hp.value + "/" + attributes.hp.max;
|
||||
else if (stats == 'TempHP') {
|
||||
if (attributes.hp.temp == null) txt += '0';
|
||||
else txt += attributes.hp.temp;
|
||||
}
|
||||
else if (stats == 'AC') txt += attributes.ac.normal.total;
|
||||
else if (stats == 'Speed'){
|
||||
let speed = "";
|
||||
if (attributes.speed.burrow.total > 0) speed += 'Burrow: ' + attributes.speed.burrow.total + 'Ft';
|
||||
if (attributes.speed.climb.total > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += 'Climb: ' + attributes.speed.climb.total + 'Ft';
|
||||
}
|
||||
if (attributes.speed.fly.total > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += 'Fly: ' + attributes.speed.fly.total + 'Ft';
|
||||
}
|
||||
if (attributes.speed.land.total > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += 'Land: ' + attributes.speed.land.total + 'Ft';
|
||||
}
|
||||
if (attributes.speed.swim.total > 0) {
|
||||
if (speed.length > 0) speed += '\n';
|
||||
speed += 'Swim: ' + attributes.speed.swim.total + 'Ft';
|
||||
}
|
||||
txt += speed;
|
||||
}
|
||||
else if (stats == 'Init') txt += attributes.init.total;
|
||||
}
|
||||
else if (system == 'pf2e' && game.system.id == 'pf2e'){
|
||||
let attributes = actor.data.data.attributes;
|
||||
if (stats == 'HP') txt += attributes.hp.value + "/" + attributes.hp.max;
|
||||
else if (stats == 'TempHP') {
|
||||
if (attributes.hp.temp == null) txt += '0';
|
||||
else {
|
||||
txt += attributes.hp.temp;
|
||||
if (attributes.hp.tempmax > 0) txt += '/' + attributes.hp.tempmax;
|
||||
}
|
||||
}
|
||||
else if (stats == 'AC') txt += attributes.ac.value;
|
||||
else if (stats == 'Speed'){
|
||||
let speed = "Land: " + attributes.speed.value.replace('feet','') + ' feet';
|
||||
const otherSpeeds = attributes.speed.otherSpeeds;
|
||||
if (otherSpeeds.length > 0)
|
||||
for (let i=0; i<otherSpeeds.length; i++)
|
||||
speed += '\n' + otherSpeeds[i].type + ": " + otherSpeeds[i].value;
|
||||
txt += speed;
|
||||
}
|
||||
else if (stats == 'Init') {
|
||||
let init = attributes.initiative.totalModifier;
|
||||
if (init != undefined) txt += init;
|
||||
}
|
||||
initiative = attributes.init.total;
|
||||
}
|
||||
else {
|
||||
//Other systems
|
||||
@@ -82,6 +145,7 @@ export class TokenControl{
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (settings.onClick == 4) { //toggle visibility
|
||||
ring = 1;
|
||||
if (token.data.hidden){
|
||||
@@ -119,18 +183,29 @@ export class TokenControl{
|
||||
ring = 1;
|
||||
let condition = settings.condition;
|
||||
if (condition == undefined) condition = 0;
|
||||
|
||||
if (condition == 0 && icon == false){
|
||||
iconSrc = window.CONFIG.controlIcons.effects;
|
||||
}
|
||||
else if (icon == false) {
|
||||
let effect = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition));
|
||||
iconSrc = effect.icon;
|
||||
let effects = token.actor.effects.entries;
|
||||
let active = effects.find(e => e.isTemporary === this.getStatusId(condition));
|
||||
if (active != undefined){
|
||||
ring = 2;
|
||||
ringColor = "#FF7B00";
|
||||
if ((system == 'dnd5e' && game.system.id == 'dnd5e') || (system == 'dnd3.5e' && game.system.id == 'D35E')){
|
||||
let effect = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition));
|
||||
iconSrc = effect.icon;
|
||||
let effects = token.actor.effects.entries;
|
||||
let active = effects.find(e => e.isTemporary === this.getStatusId(condition));
|
||||
if (active != undefined){
|
||||
ring = 2;
|
||||
ringColor = "#FF7B00";
|
||||
}
|
||||
}
|
||||
else if (system == 'pf2e' && game.system.id == 'pf2e') {
|
||||
let effects = token.data.effects;
|
||||
for (let i=0; i<effects.length; i++){
|
||||
if (CONFIG.statusEffects[condition-1] == effects[i]){
|
||||
ring = 2;
|
||||
ringColor = "#FF7B00";
|
||||
}
|
||||
}
|
||||
iconSrc = CONFIG.statusEffects[condition-1];
|
||||
}
|
||||
}
|
||||
streamDeck.setIcon(1,context,iconSrc,background,ring,ringColor,true);
|
||||
@@ -164,19 +239,16 @@ export class TokenControl{
|
||||
iconSrc = window.CONFIG.controlIcons.effects;
|
||||
}
|
||||
else if (icon == false) {
|
||||
iconSrc = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition)).icon;
|
||||
if ((system == 'dnd5e' && game.system.id == 'dnd5e') || (system == 'dnd3.5e' && game.system.id == 'D35E'))
|
||||
iconSrc = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition)).icon;
|
||||
else if (system == 'pf2e' && game.system.id == 'pf2e')
|
||||
iconSrc = CONFIG.statusEffects[condition-1];
|
||||
}
|
||||
streamDeck.setIcon(1,context,iconSrc,background,1,'#000000',true);
|
||||
}
|
||||
}
|
||||
if (icon) streamDeck.setIcon(1,context,iconSrc,background,ring,ringColor);
|
||||
|
||||
if (name) txt += tokenName;
|
||||
if (name && type > 0) txt += "\n";
|
||||
if (type == 1) txt += hp;
|
||||
else if (type == 2) txt += AC;
|
||||
else if (type == 3) txt += speed;
|
||||
else if (type == 4) txt += initiative;
|
||||
streamDeck.setTitle(txt,context);
|
||||
}
|
||||
|
||||
@@ -185,11 +257,14 @@ export class TokenControl{
|
||||
const tokenId = MODULE.selectedTokenId;
|
||||
|
||||
let onClick = settings.onClick;
|
||||
if (onClick == undefined) conClick = 0;
|
||||
if (onClick == undefined) onClick = 0;
|
||||
|
||||
const token = canvas.tokens.children[0].children.find(p => p.id == tokenId);
|
||||
if (token == undefined) return;
|
||||
|
||||
let system = settings.system;
|
||||
if (system == undefined) system = 'dnd5e';
|
||||
|
||||
if (onClick == 0) //Do nothing
|
||||
return;
|
||||
else if (onClick == 1){ //center on token
|
||||
@@ -218,12 +293,20 @@ export class TokenControl{
|
||||
if (condition == 0){
|
||||
const effects = token.actor.effects.entries;
|
||||
for (let i=0; i<effects.length; i++){
|
||||
const effect = CONFIG.statusEffects.find(e => e.icon === effects[i].data.icon);
|
||||
let effect;
|
||||
if ((system == 'dnd5e' && game.system.id == 'dnd5e') || (system == 'dnd3.5e' && game.system.id == 'D35E'))
|
||||
effect = CONFIG.statusEffects.find(e => e.icon === effects[i].data.icon);
|
||||
else if (system == 'pf2e' && game.system.id == 'pf2e')
|
||||
effect = CONFIG.statusEffects[condition-1];
|
||||
await token.toggleEffect(effect)
|
||||
}
|
||||
}
|
||||
else {
|
||||
const effect = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition));
|
||||
let effect;
|
||||
if ((system == 'dnd5e' && game.system.id == 'dnd5e') || (system == 'dnd3.5e' && game.system.id == 'D35E'))
|
||||
effect = CONFIG.statusEffects.find(e => e.id === this.getStatusId(condition));
|
||||
else if (system == 'pf2e' && game.system.id == 'pf2e')
|
||||
effect = CONFIG.statusEffects[condition-1];
|
||||
token.toggleEffect(effect);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
.boxed {
|
||||
border: 1px solid black ;
|
||||
border-radius: 5px ;
|
||||
width: 100px;
|
||||
max-width: 166px;
|
||||
height: {{height}}px;
|
||||
}
|
||||
</style>
|
||||
@@ -16,7 +16,7 @@
|
||||
{{localize "MaterialDeck.Macro"}} {{this.iteration}}
|
||||
</div>
|
||||
<div>
|
||||
<select name="macros" class="macros-select" default="" style="max-width:140px;">
|
||||
<select name="macros" class="macros-select" id="macros{{this.iteration}}" default="" style="max-width:140px;">
|
||||
{{#select this.macro}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each macros}}
|
||||
@@ -27,19 +27,15 @@
|
||||
</div>
|
||||
{{#if this.furnace}}
|
||||
<label>{{localize "MaterialDeck.FurnaceArgs"}}</label>
|
||||
<input type="text" name="args" value="{{this.args}}">
|
||||
<input type="text" name="args" id="args{{this.iteration}}" value="{{this.args}}">
|
||||
{{/if}}
|
||||
|
||||
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:10px">
|
||||
<label style="flex:1">{{localize "MaterialDeck.Background"}}</label>
|
||||
<input style="flex:1" type="color" name="colorPicker" data-dtype="String" value="{{this.color}}">
|
||||
<input style="flex:1" type="color" name="colorPicker" id="colorpicker{{this.iteration}}" data-dtype="String" value="{{this.color}}">
|
||||
</div>
|
||||
</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
<button type="submit" name="submit">
|
||||
<i class="far fa-save"></i> {{localize "MaterialDeck.Save"}}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
@@ -1,24 +1,28 @@
|
||||
<form autocomplete="off" onsubmit="event.preventDefault()">
|
||||
<div >
|
||||
<h2>{{localize "MaterialDeck.PL.Header"}}</h2>
|
||||
<h2>{{localize "MaterialDeck.PL.Settings"}}</h2>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{localize "MaterialDeck.PL.Label"}}</label>
|
||||
<select name="playMethod" class="playMethod" default="">
|
||||
{{#select playMethod}}
|
||||
<label>{{localize "MaterialDeck.PL.Mode"}}</label>
|
||||
<select name="playMode" class="playMode" default="">
|
||||
{{#select playMode}}
|
||||
<option value="0">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
||||
<option value="1">{{localize "MaterialDeck.PL.OneTrackPlaylist"}}</option>
|
||||
<option value="2">{{localize "MaterialDeck.PL.OneTrackTotal"}}</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label>{{localize "MaterialDeck.PL.Nr"}}</label>
|
||||
<input type="number" id="numberOfPlaylists" name="plNum" min="0" max="127" value={{numberOfPlaylists}}>
|
||||
</div>
|
||||
<div>
|
||||
<h2>{{localize "MaterialDeck.Playlists"}}</h2>
|
||||
</div>
|
||||
{{#each playlistData}}
|
||||
<div class="form-group">
|
||||
<label>{{localize "MaterialDeck.Playlist"}} {{this.iteration}}</label>
|
||||
<select name="selectedPlaylist" class="playlist-select" default="">
|
||||
<select name="selectedPlaylist" class="playlist-select" id="playlist{{this.iteration}}" default="">
|
||||
{{#select this.playlist}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each this.playlists}}
|
||||
@@ -26,11 +30,14 @@
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
|
||||
<select name="playlistMode" class="playlistMode" id="playlistMode{{this.iteration}}" default="">
|
||||
{{#select this.playlistMode}}
|
||||
<option value="0">{{localize "MaterialDeck.PL.Mode"}}</option>
|
||||
<option value="1">{{localize "MaterialDeck.PL.Unrestricted"}}</option>
|
||||
<option value="2">{{localize "MaterialDeck.PL.OneTrack"}}</option>
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
{{/each}}
|
||||
|
||||
<button type="submit" name="submit">
|
||||
<i class="far fa-save"></i> {{localize "MaterialDeck.Save"}}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
@@ -3,21 +3,11 @@
|
||||
.boxed {
|
||||
border: 1px solid black ;
|
||||
border-radius: 5px ;
|
||||
width: 100px;
|
||||
height: 255px;
|
||||
max-width: 166px;
|
||||
height: 300px;
|
||||
}
|
||||
</style>
|
||||
<div class="form-group">
|
||||
<label>{{localize "MaterialDeck.Playlist"}} </label>
|
||||
<select name="playlist" class="playlist-select" default="" style="max-width:200px;">
|
||||
{{#select playlist}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each playlists}}
|
||||
<option value="{{this._id}}">{{this.name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
{{#each soundData}}
|
||||
<div class="form-group">
|
||||
{{#each this.dataThis}}
|
||||
@@ -28,12 +18,26 @@
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Name"}}
|
||||
</div>
|
||||
<input type="text" name="name" value="{{this.name}}">
|
||||
<input type="text" name="namebox" value="{{this.name}}" id="name{{this.iteration}}" style="width:100%;" >
|
||||
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Playlist"}}
|
||||
</div>
|
||||
<div>
|
||||
<select name="playlist" class="playlist-select" default="" style="width:100%;" id="playlists{{this.iteration}}">
|
||||
{{#select this.selectedPlaylist}}
|
||||
{{#each playlists}}
|
||||
<option value="{{this.id}}">{{this.name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Sound"}}
|
||||
</div>
|
||||
<div>
|
||||
<select name="sounds" class="sounds-select" default="" style="width:132px;" id="soundSelect{{this.iteration}}">
|
||||
<div class="form-fields" style={{this.styleSS}}>
|
||||
<select name="sounds" class="sounds-select" default="" style="width:100%;" id="soundSelect{{this.iteration}}">
|
||||
{{#select this.sound}}
|
||||
<option value="">{{localize "MaterialDeck.None"}}</option>
|
||||
{{#each sounds}}
|
||||
@@ -42,6 +46,12 @@
|
||||
{{/select}}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-fields" style={{this.styleFP}}>
|
||||
<button type="button" class="file-picker" data-type="audio" data-target="src{{this.iteration}}" title="Browse Files" tabindex="-1">
|
||||
<i class="fas fa-file-import fa-fw"></i>
|
||||
</button>
|
||||
<input class="image" type="text" name="src{{this.iteration}}" name2="soundSrc" id="srcPath{{this.iteration}}" placeholder="path/audio.mp3" value={{this.srcPath}}>
|
||||
</div>
|
||||
<div style="text-align:center;">
|
||||
{{localize "MaterialDeck.Icon"}}
|
||||
</div>
|
||||
@@ -49,7 +59,7 @@
|
||||
<button type="button" class="file-picker" data-type="image" data-target="img{{this.iteration}}" title="Browse Files" tabindex="-1">
|
||||
<i class="fas fa-file-import fa-fw"></i>
|
||||
</button>
|
||||
<input class="image" type="text" name="img{{this.iteration}}" id="imgPath{{this.iteration}}" placeholder="path/image.png" value={{this.imgPath}}>
|
||||
<input class="image" type="text" name="img{{this.iteration}}" name2="imgSrc" id="imgPath{{this.iteration}}" placeholder="path/image.png" value={{this.imgPath}}>
|
||||
</div>
|
||||
<div class="flex-container" style="display:flex;flex-direction:row;padding-top:5px">
|
||||
<label style="flex:1">{{localize "MaterialDeck.On"}} </label>
|
||||
@@ -60,7 +70,7 @@
|
||||
|
||||
<div class="form-group options">
|
||||
<label>{{localize "MaterialDeck.Playback"}}</label>
|
||||
<select name="mode" style="flex:1">
|
||||
<select name="mode" id="playmode{{this.iteration}}" style="flex:1">
|
||||
{{#select this.mode}}
|
||||
<option value="0">{{localize "MaterialDeck.Once"}}</option>
|
||||
<option value="1">{{localize "MaterialDeck.Repeat"}}</option>
|
||||
@@ -77,8 +87,4 @@
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
<button type="submit" name="submit">
|
||||
<i class="far fa-save"></i> {{localize "MaterialDeck.Save"}}
|
||||
</button>
|
||||
|
||||
</form>
|
||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 21 KiB |
BIN
wiki/img/.thumb/Youtube.png.jpg
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 175 KiB |
|
Before Width: | Height: | Size: 194 KiB After Width: | Height: | Size: 204 KiB |
BIN
wiki/img/Youtube.png
Normal file
|
After Width: | Height: | Size: 96 KiB |