diff --git a/frontend/palworld-pal-editor-webui/src/components/PathPicker.vue b/frontend/palworld-pal-editor-webui/src/components/PathPicker.vue index 80ac007..73c734d 100644 --- a/frontend/palworld-pal-editor-webui/src/components/PathPicker.vue +++ b/frontend/palworld-pal-editor-webui/src/components/PathPicker.vue @@ -20,6 +20,12 @@ const sortedPathChildren = computed(() => { }) }) +const savePickerResult = () => { + palStore.SHOW_FILE_PICKER = false + palStore.PAL_GAME_SAVE_PATH = palStore.PAL_FILE_PICKER_PATH + +} + // const scrollElement = ref(null); // const checkScroll = () => { @@ -43,19 +49,22 @@ const sortedPathChildren = computed(() => { @@ -95,16 +104,18 @@ const sortedPathChildren = computed(() => { flex: 1; } +.popup li[isdir=true] { + cursor: pointer; +} + .popup li { margin: .2rem .2rem; padding: .3rem .3rem; border-radius: 0.5rem; color: whitesmoke; - cursor: pointer; } -.popup li:hover { +.popup li:hover[isdir=true] { background-color: #4b8d5e; } - \ No newline at end of file diff --git a/frontend/palworld-pal-editor-webui/src/components/modules/BarButton.vue b/frontend/palworld-pal-editor-webui/src/components/modules/BarButton.vue index 24a88e3..27c830b 100644 --- a/frontend/palworld-pal-editor-webui/src/components/modules/BarButton.vue +++ b/frontend/palworld-pal-editor-webui/src/components/modules/BarButton.vue @@ -32,5 +32,6 @@ button:hover { button:disabled { background-color: #8a8a8a; + cursor: auto; } \ No newline at end of file diff --git a/frontend/palworld-pal-editor-webui/src/stores/paleditor.js b/frontend/palworld-pal-editor-webui/src/stores/paleditor.js index 382a2d4..dbd56ed 100644 --- a/frontend/palworld-pal-editor-webui/src/stores/paleditor.js +++ b/frontend/palworld-pal-editor-webui/src/stores/paleditor.js @@ -254,6 +254,8 @@ export const usePalEditorStore = defineStore("paleditor", () => { const PAL_LIST_SEARCH_KEYWORD = ref("") + const IS_PAL_SAVE_PATH = ref(false) + // data const BASE_PAL_MAP = ref(new Map()); const PLAYER_MAP = ref(new Map()); @@ -277,7 +279,9 @@ export const usePalEditorStore = defineStore("paleditor", () => { const HAS_PASSWORD = ref(false); const PAL_WRITE_BACK_PATH = ref(""); const PATH_CONTEXT = ref(new Map()) + const SHOW_FILE_PICKER = ref(false) + const PAL_FILE_PICKER_PATH = ref(PAL_GAME_SAVE_PATH.value) // auth let auth_token = ""; @@ -452,7 +456,8 @@ export const usePalEditorStore = defineStore("paleditor", () => { } function update_path_picker_result(data) { - PAL_GAME_SAVE_PATH.value = data.currentPath + IS_PAL_SAVE_PATH.value = data.isPalDir + PAL_FILE_PICKER_PATH.value = data.currentPath PATH_CONTEXT.value = new Map(Object.entries(data.children)) SHOW_FILE_PICKER.value = true } @@ -1258,6 +1263,9 @@ export const usePalEditorStore = defineStore("paleditor", () => { PATH_CONTEXT, SHOW_FILE_PICKER, + PAL_FILE_PICKER_PATH, + IS_PAL_SAVE_PATH, + HAS_WORKING_PAL_FLAG, BASE_PAL_BTN_CLK_FLAG, PAL_GAME_SAVE_PATH, diff --git a/src/palworld_pal_editor/utils/util.py b/src/palworld_pal_editor/utils/util.py index f94c74a..9cd0b0d 100644 --- a/src/palworld_pal_editor/utils/util.py +++ b/src/palworld_pal_editor/utils/util.py @@ -14,8 +14,7 @@ def reply(status, data=None, msg=None): def get_path_context(path: Path) -> dict: - current_path = path.resolve() - + current_path = path.resolve() children = { str(child.resolve()): { "filename": child.name, @@ -24,9 +23,13 @@ def get_path_context(path: Path) -> dict: for child in sorted(current_path.iterdir(), key=lambda x: (x.is_file(), x.name)) } + names = [child.name for child in current_path.iterdir()] + is_pal_dir = "Level.sav" in names and "Players" in names + return { "currentPath": str(current_path), - "children": children + "children": children, + "isPalDir": is_pal_dir }