Add initial implementation for AscAssetManager module
This commit introduces the following key features: - **New `.gitignore`**: - Ignores `.vscode`, `.eslintrc.js`, and `dist/module.zip`. - **Core functionality**: - Created `src/main.js` to implement the `AscAssetManager` class with methods to manage file uploads, categories, tags, and settings registration. - Introduced hooks for rendering and managing custom upload dialogs and forms. - **Configuration and settings**: - Added `src/settings.js` to register settings for features like enabling/disabling, root directory configuration, and theme selection. - **Templates**: - Added `upload-choose.hbs` for the file selection dialog. - Added `upload-form.hbs` for the file metadata customization dialog. - **Utilities**: - Added `src/utils.js` with helper functions for file parsing, metadata handling, and filename creation. - **Styling**: - Added `style.css` for styling upload areas. - **Module metadata**: - Added `module.json` with module details, compatibility, and dependencies. This commit establishes the foundational structure and functionality for the AscAssetManager module.
This commit is contained in:
48
src/settings.js
Normal file
48
src/settings.js
Normal file
@@ -0,0 +1,48 @@
|
||||
export function registerSettings(ID) {
|
||||
console.log("Registering settings for My Module...");
|
||||
|
||||
// Register the "enableFeature" setting
|
||||
game.settings.register(ID, "enableFeature", {
|
||||
name: "Enable Feature",
|
||||
hint: "Enable or disable the special feature of this module.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
type: Boolean,
|
||||
default: true,
|
||||
onChange: value => {
|
||||
console.log(`Enable Feature setting changed to: ${value}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Register the "customMessage" setting
|
||||
game.settings.register(ID, "rootDirectory", {
|
||||
name: "Root Directory",
|
||||
hint: "Root Directory to save files",
|
||||
scope: "client",
|
||||
config: true,
|
||||
type: String,
|
||||
default: `worlds/${game.data.world.id}/`,
|
||||
filePicker: "folder",
|
||||
onChange: value => {
|
||||
console.log(`Custom Message changed to: ${value}`);
|
||||
}
|
||||
});
|
||||
|
||||
// Register a dropdown setting
|
||||
game.settings.register(ID, "theme", {
|
||||
name: "Select Theme",
|
||||
hint: "Choose a theme for the module.",
|
||||
scope: "world",
|
||||
config: true,
|
||||
type: String,
|
||||
choices: {
|
||||
light: "Light Theme",
|
||||
dark: "Dark Theme",
|
||||
system: "Use System Default"
|
||||
},
|
||||
default: "system",
|
||||
onChange: value => {
|
||||
console.log(`Theme changed to: ${value}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user