diff --git a/build/additional/FreeAssets/Kenny-audio.zip b/build/additional/FreeAssets/Kenny-audio.zip new file mode 100644 index 0000000..b3485ea Binary files /dev/null and b/build/additional/FreeAssets/Kenny-audio.zip differ diff --git a/build/additional/FreeAssets/Kenny.zip b/build/additional/FreeAssets/Kenny-isometric.zip similarity index 100% rename from build/additional/FreeAssets/Kenny.zip rename to build/additional/FreeAssets/Kenny-isometric.zip diff --git a/src/Renderer/components/Manager/FileGenerator.vue b/src/Renderer/components/Manager/FileGenerator.vue index e714483..40e2c0e 100644 --- a/src/Renderer/components/Manager/FileGenerator.vue +++ b/src/Renderer/components/Manager/FileGenerator.vue @@ -29,15 +29,17 @@ 이름을 입력하세요 이름을 변경하면 이 파일을 참조하는 다른 파일에서도 수정해야합니다 - + + + diff --git a/src/Renderer/components/Manager/Tool/AssetAppender.vue b/src/Renderer/components/Manager/Tool/AssetAppender.vue index d6f4817..1430785 100644 --- a/src/Renderer/components/Manager/Tool/AssetAppender.vue +++ b/src/Renderer/components/Manager/Tool/AssetAppender.vue @@ -46,15 +46,23 @@ export default defineComponent({ setup() { const isProduction = process.env.NODE_ENV === 'production' const resourcesPath = isProduction ? process.resourcesPath : path.resolve(process.cwd(), 'build') - console.log(resourcesPath) const list = ref([ { logo: 'https://www.kenney.nl/data/img/logo.png', title: 'Kenny Isometric Tiles', - subtitle: 'Kenny.nl에서 제공한 무료 에셋을 프로젝트에 추가합니다.', - source: path.resolve(resourcesPath, 'additional', 'FreeAssets', 'Kenny.zip'), - namespace: 'Kenny-isometric-tiles', + subtitle: 'Kenny.nl에서 제공한 아이소메트릭 타일 에셋을 프로젝트에 추가합니다.', + source: path.resolve(resourcesPath, 'additional', 'FreeAssets', 'Kenny-isometric.zip'), + namespace: 'Kenny', + url: 'https://www.kenney.nl/', + color: '#2ECC92', + }, + { + logo: 'https://www.kenney.nl/data/img/logo.png', + title: 'Kenny Audio', + subtitle: 'Kenny.nl에서 제공한 오디오 에셋을 프로젝트에 추가합니다.', + source: path.resolve(resourcesPath, 'additional', 'FreeAssets', 'Kenny-audio.zip'), + namespace: 'Kenny', url: 'https://www.kenney.nl/', color: '#2ECC92', } diff --git a/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue b/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue index 2dcd0db..3a96ab1 100644 --- a/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue +++ b/src/Renderer/components/Manager/Tool/AssetAppenderCard.vue @@ -5,13 +5,15 @@ :elevation="hover ? 12 : 2" :class="{ 'on-hover': hover }" max-width="250" - min-height="400" - class="card-wrapper" + min-height="425" + class="d-flex flex-column card-wrapper" @click="openExternal(url)" > @@ -20,11 +22,12 @@ {{ subtitle }} - + 설치하기 @@ -50,7 +53,7 @@ 설치할 경우 프로젝트의 용량이 {{ calcSize(source).toFixed(2) }}MB만큼 늘어납니다.

- 이 에셋은 Assets/{{ namespace }} 경로를 포함해, 일부 프로젝트 디렉토리를 덮어 씌울 것입니다. + 이 에셋은 {{ warnDirectory }} 경로를 덮어 씌울 것입니다.
해당 경로에 중요한 데이터가 있다면 백업하십시오.

@@ -78,7 +81,7 @@ import path from 'path' import fs from 'fs-extra' import { shell, ipcRenderer } from 'electron' -import { defineComponent, getCurrentInstance, ref } from '@vue/composition-api' +import { computed, defineComponent, getCurrentInstance, ref } from '@vue/composition-api' import { PROJECT_SRC_DIRECTORY_NAME, @@ -120,12 +123,20 @@ function useStatSize() { } function useAppender() { - const { root } = getCurrentInstance()! + const { root, props } = getCurrentInstance()! + const namespace = props.namespace as string + const source = props.source as string + const projectDirectory = path.resolve(root.proxy.$store.state.projectDirectory) const isAppendDialogOpen = ref(false) const appending = ref(false) + const warnDirectory = computed(() => { + const zipName = path.parse(source).name + return path.posix.join('Assets', namespace, zipName) + }) + const confirmAppend = () => { isAppendDialogOpen.value = true } @@ -136,10 +147,9 @@ function useAppender() { // 임시 폴더에 생성한 후, 완료되면 프로젝트 디렉토리로 이동합니다. // 이는 압축 해제 시, 파일이 실시간으로 생성되면 리스트 업데이트가 불필요할 정도로 일어나는 것을 방지하기 위함입니다. const src = source - const dist = path.resolve(projectDirectory, PROJECT_SRC_DIRECTORY_NAME, PROJECT_SRC_ASSET_DIRECTORY_NAME, namespace) + const dist = path.resolve(projectDirectory, PROJECT_SRC_DIRECTORY_NAME, PROJECT_SRC_ASSET_DIRECTORY_NAME, namespace, path.parse(source).name) - const dist_tmp = await fs.mkdtemp(path.resolve(projectDirectory, 'unpackage-')) - const unzip: Engine.FileSystem.UnzipSuccess|Engine.FileSystem.UnzipFail = await ipcRenderer.invoke('unzip', src, dist_tmp) + const unzip: Engine.FileSystem.UnzipSuccess|Engine.FileSystem.UnzipFail = await ipcRenderer.invoke('unzip', src, dist) const fail = (message: string) => { root.proxy.$store.dispatch('snackbar', message) @@ -151,13 +161,6 @@ function useAppender() { return fail(unzip.message) } - try { - await fs.rename(dist_tmp, dist) - } catch (reason) { - const message = reason.toString() - return fail(message) - } - isAppendDialogOpen.value = false appending.value = false } @@ -165,6 +168,7 @@ function useAppender() { return { isAppendDialogOpen, appending, + warnDirectory, confirmAppend, append, } diff --git a/src/Utils/FileWatcher.ts b/src/Utils/FileWatcher.ts index 30afff7..38d5ff4 100644 --- a/src/Utils/FileWatcher.ts +++ b/src/Utils/FileWatcher.ts @@ -43,7 +43,7 @@ export class FileWatcher { // todo: 폴링을 쓰는 이유 // chikidar에서 폴링을 사용하지 않으면 여러 디렉토리가 중첩되어 있을 경우, 상위 디렉토리를 잠그는 오류가 발생함. // https://github.com/paulmillr/chokidar/issues/320 - const watchInterval = 3000 + const watchInterval = 1500 this.watcher = chokidar.watch(this.cwd, { ignoreInitial: true, awaitWriteFinish: true, usePolling: true, interval: watchInterval, binaryInterval: watchInterval }) this.watcher.on('add', (filePath) => { this.onUpdate(filePath) }) this.watcher.on('change', (filePath) => { this.onUpdate(filePath) })