diff --git a/app/css/app.css b/app/css/app.css index 6ecc8a0..3ba287d 100644 --- a/app/css/app.css +++ b/app/css/app.css @@ -176,10 +176,13 @@ input[type='submit'] { .p0, .p1 { float: left; } +.settings_assets .buttons, .settings_replay .buttons { padding-top: 16px; text-align: right; } +.settings_assets .buttons .reveal, +.settings_assets .buttons .change, .settings_replay .buttons .reveal, .settings_replay .buttons .change{ margin-right: 8px; diff --git a/src/common/external_assets.ts b/src/common/external_assets.ts index 3b36601..246b404 100644 --- a/src/common/external_assets.ts +++ b/src/common/external_assets.ts @@ -16,35 +16,23 @@ export default class ExternalAssets { // dir is reset to code defined path case 'reset': - dir = path.join(app.getPath('appData'), 'swap-n-pop', 'external-assets') + dir = null break; // dir is set to last known if exists, otherwhise it resets case '': - dir = store.has('asset-dir') ? store.get('asset-dir') : path.join(app.getPath('appData'), 'swap-n-pop', 'external-assets') + dir = store.has('asset-dir') ? store.get('asset-dir') : null break; } + console.log('reset',dir) // set dir to newest defined - store.set('asset-dir', dir) + store.set('asset-dir', dir) // create actual folder through dir if it doesnt exist - if (!fs.existsSync(dir)) - fx.mkdirSync(dir); + if (dir !== null && !fs.existsSync(dir)) + fx.mkdirSync(dir) return dir; } - - public static list(callback) { - let dir = path.join(store.get('asset-dir'), '*.png') - - glob(dir, {}, (err, files) => { - let filenames = [] - - for (let file of files) - filenames.push(path.basename(file, '.png')) - - callback(err,filenames) - }) - } -} \ No newline at end of file +} diff --git a/src/main/index.ts b/src/main/index.ts index d538f76..a12ca6b 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -226,12 +226,6 @@ ipc.on('asset-dir-change', e => { }) }) -ipc.on('asset-list', e => { - ExternalAssets.list((err, files) => { - win.webContents.send('asset-list', files) - }) -}) - ipc.on('play-single', (event,data) => { const seed = Replay.random_seed(16,undefined) win.webContents.send('play-single',{ diff --git a/src/renderer/states/load.ts b/src/renderer/states/load.ts index 419afc4..0d7ef0c 100644 --- a/src/renderer/states/load.ts +++ b/src/renderer/states/load.ts @@ -8,10 +8,6 @@ import Store from 'common/store' const store = new Store() -// load any external assets and store them in an scoped array -let external_assets = [] -ipc.on('asset-list', (e, files) => external_assets = files) - /** Loads all sprites, spritesheets, sound effects, etc to the phaser game * Uses signals to detect once everything has been loaded correctly */ diff --git a/src/renderer/ui/external_assets.ts b/src/renderer/ui/external_assets.ts index c097a4d..cb97572 100644 --- a/src/renderer/ui/external_assets.ts +++ b/src/renderer/ui/external_assets.ts @@ -20,7 +20,7 @@ export default function render() { m('label', 'Asset Folder Location:'), m('.input', asset_dir), m('.buttons', [ - m('.button.reveal', {onclick: () => ipc.send('asset-dir-reveal')}, 'Reveal'), + //m('.button.reveal', {onclick: () => ipc.send('asset-dir-reveal')}, 'Reveal'), m('.button.change', {onclick: () => ipc.send('asset-dir-change')}, 'Change'), m('.button.reset' , {onclick: () => ipc.send('asset-dir-reset')}, 'Reset'), ]),