create-pixi-vn 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +36 -36
- package/index.js +1 -1
- package/package.json +5 -4
- package/template-react-vite-muijoy/package-lock.json +4 -4
- package/template-react-vite-muijoy/package.json +1 -1
- package/template-react-vite-muijoy/src/assets/ink-manifest.gen.json +1 -0
- package/template-react-vite-muijoy/src/components/menus/main-menu.tsx +1 -2
- package/template-react-vite-muijoy/src/components/menus/save-menu/index.tsx +5 -6
- package/template-react-vite-muijoy/src/content/labels/start.label.ts +2 -4
- package/{template-react-vite-muijoy-tauri/src/lib/stores/useGameSaveScreenStore.ts → template-react-vite-muijoy/src/lib/stores/save-menu-pagination-store.ts} +3 -3
- package/template-react-vite-muijoy/src/pixi-vn-keys.gen.d.ts +20 -0
- package/template-react-vite-muijoy/vite.config.ts +1 -0
- package/template-react-vite-muijoy-ink/package-lock.json +3 -3
- package/template-react-vite-muijoy-ink/package.json +2 -2
- package/template-react-vite-muijoy-ink/src/components/menus/save-menu/index.tsx +5 -6
- package/{template-react-vite-muijoy-ink-tauri/src/lib/stores/useGameSaveScreenStore.ts → template-react-vite-muijoy-ink/src/lib/stores/save-menu-pagination-store.ts} +3 -3
- package/template-react-vite-muijoy-ink/src/pixi-vn-keys.gen.d.ts +22 -0
- package/template-react-vite-muijoy-ink/vite.config.ts +1 -0
- package/template-react-vite-muijoy-ink-tauri/package-lock.json +3 -3
- package/template-react-vite-muijoy-ink-tauri/package.json +2 -2
- package/template-react-vite-muijoy-ink-tauri/src/components/menus/save-menu/index.tsx +5 -6
- package/{template-react-vite-muijoy-ink/src/lib/stores/useGameSaveScreenStore.ts → template-react-vite-muijoy-ink-tauri/src/lib/stores/save-menu-pagination-store.ts} +3 -3
- package/template-react-vite-muijoy-ink-tauri/src/pixi-vn-keys.gen.d.ts +22 -0
- package/template-react-vite-muijoy-ink-tauri/vite.config.ts +1 -0
- package/template-react-vite-muijoy-tauri/package-lock.json +4 -4
- package/template-react-vite-muijoy-tauri/package.json +1 -1
- package/template-react-vite-muijoy-tauri/src/assets/ink-manifest.gen.json +1 -0
- package/template-react-vite-muijoy-tauri/src/components/menus/main-menu.tsx +1 -2
- package/template-react-vite-muijoy-tauri/src/components/menus/save-menu/index.tsx +5 -6
- package/template-react-vite-muijoy-tauri/src/content/labels/start.label.ts +2 -4
- package/{template-react-vite-muijoy/src/lib/stores/useGameSaveScreenStore.ts → template-react-vite-muijoy-tauri/src/lib/stores/save-menu-pagination-store.ts} +3 -3
- package/template-react-vite-muijoy-tauri/src/pixi-vn-keys.gen.d.ts +20 -0
- package/template-react-vite-muijoy-tauri/vite.config.ts +1 -0
- package/template-react-vite-muijoy-electron/.eslintrc.cjs +0 -29
- package/template-react-vite-muijoy-electron/.vscode/extensions.json +0 -9
- package/template-react-vite-muijoy-electron/.vscode/launch.json +0 -32
- package/template-react-vite-muijoy-electron/.vscode/settings.json +0 -49
- package/template-react-vite-muijoy-electron/README.md +0 -207
- package/template-react-vite-muijoy-electron/_gitignore +0 -107
- package/template-react-vite-muijoy-electron/forge.config.cts +0 -73
- package/template-react-vite-muijoy-electron/forge.env.d.ts +0 -1
- package/template-react-vite-muijoy-electron/index.html +0 -13
- package/template-react-vite-muijoy-electron/ionic.config.json +0 -7
- package/template-react-vite-muijoy-electron/package-lock.json +0 -16984
- package/template-react-vite-muijoy-electron/package.json +0 -85
- package/template-react-vite-muijoy-electron/public/apple-touch-icon.png +0 -0
- package/template-react-vite-muijoy-electron/public/favicon.ico +0 -0
- package/template-react-vite-muijoy-electron/public/mask-icon.svg +0 -890
- package/template-react-vite-muijoy-electron/public/pixi-vn.svg +0 -23
- package/template-react-vite-muijoy-electron/public/pwa-192x192.png +0 -0
- package/template-react-vite-muijoy-electron/public/pwa-512x512.png +0 -0
- package/template-react-vite-muijoy-electron/public/robots.txt +0 -3
- package/template-react-vite-muijoy-electron/src/App.css +0 -42
- package/template-react-vite-muijoy-electron/src/App.tsx +0 -16
- package/template-react-vite-muijoy-electron/src/AppRoutes.tsx +0 -66
- package/template-react-vite-muijoy-electron/src/Home.tsx +0 -27
- package/template-react-vite-muijoy-electron/src/Imports.tsx +0 -34
- package/template-react-vite-muijoy-electron/src/atoms/autoInfoState.ts +0 -50
- package/template-react-vite-muijoy-electron/src/atoms/dialogueCardHeightState.ts +0 -23
- package/template-react-vite-muijoy-electron/src/atoms/dialogueCardImageWidthState.ts +0 -23
- package/template-react-vite-muijoy-electron/src/atoms/hideInterfaceState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/nextStepLoadingState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/openGameSaveScreenState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/openHistoryScreenState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/openSettingsState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/saveLoadAlertState.ts +0 -26
- package/template-react-vite-muijoy-electron/src/atoms/saveScreenPageState.ts +0 -23
- package/template-react-vite-muijoy-electron/src/atoms/skipEnabledState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/atoms/typewriterDelayState.ts +0 -23
- package/template-react-vite-muijoy-electron/src/atoms/typewriterIsAnimatedState.ts +0 -6
- package/template-react-vite-muijoy-electron/src/components/ChoiceButton.tsx +0 -19
- package/template-react-vite-muijoy-electron/src/components/DragHandleDivider.tsx +0 -40
- package/template-react-vite-muijoy-electron/src/components/MenuButton.tsx +0 -37
- package/template-react-vite-muijoy-electron/src/components/ModalConfirmation.tsx +0 -70
- package/template-react-vite-muijoy-electron/src/components/ModalDialog.tsx +0 -103
- package/template-react-vite-muijoy-electron/src/components/NextButton.tsx +0 -94
- package/template-react-vite-muijoy-electron/src/components/SettingButton.tsx +0 -44
- package/template-react-vite-muijoy-electron/src/components/SliderResizer.tsx +0 -53
- package/template-react-vite-muijoy-electron/src/components/TextMenuButton.tsx +0 -41
- package/template-react-vite-muijoy-electron/src/components/Typewriter.tsx +0 -335
- package/template-react-vite-muijoy-electron/src/components/TypographyShadow.tsx +0 -15
- package/template-react-vite-muijoy-electron/src/i18n.ts +0 -29
- package/template-react-vite-muijoy-electron/src/index.css +0 -9
- package/template-react-vite-muijoy-electron/src/interceptors/EventInterceptor.tsx +0 -49
- package/template-react-vite-muijoy-electron/src/interceptors/SkipAutoInterceptor.tsx +0 -67
- package/template-react-vite-muijoy-electron/src/main.tsx +0 -39
- package/template-react-vite-muijoy-electron/src/models/Character.ts +0 -86
- package/template-react-vite-muijoy-electron/src/models/GameSaveData.ts +0 -9
- package/template-react-vite-muijoy-electron/src/pixi-vn.d.ts +0 -36
- package/template-react-vite-muijoy-electron/src/providers/ThemeProvider.tsx +0 -165
- package/template-react-vite-muijoy-electron/src/screens/ChoiceMenu.tsx +0 -130
- package/template-react-vite-muijoy-electron/src/screens/GameSaveScreen.tsx +0 -274
- package/template-react-vite-muijoy-electron/src/screens/HistoryScreen.tsx +0 -155
- package/template-react-vite-muijoy-electron/src/screens/LoadingScreen.tsx +0 -40
- package/template-react-vite-muijoy-electron/src/screens/MainMenu.tsx +0 -98
- package/template-react-vite-muijoy-electron/src/screens/NarrationScreen.tsx +0 -220
- package/template-react-vite-muijoy-electron/src/screens/QuickTools.tsx +0 -168
- package/template-react-vite-muijoy-electron/src/screens/Settings.tsx +0 -536
- package/template-react-vite-muijoy-electron/src/screens/modals/SaveLoadAlert.tsx +0 -135
- package/template-react-vite-muijoy-electron/src/screens/modals/TextInput.tsx +0 -61
- package/template-react-vite-muijoy-electron/src/use_query/useQueryInterface.ts +0 -73
- package/template-react-vite-muijoy-electron/src/use_query/useQueryLastSave.ts +0 -18
- package/template-react-vite-muijoy-electron/src/use_query/useQuerySaves.ts +0 -18
- package/template-react-vite-muijoy-electron/src/utilities/actions-utility.ts +0 -10
- package/template-react-vite-muijoy-electron/src/utilities/component-utility.ts +0 -25
- package/template-react-vite-muijoy-electron/src/utilities/indexedDB-utility.ts +0 -196
- package/template-react-vite-muijoy-electron/src/utilities/navigate-utility.ts +0 -18
- package/template-react-vite-muijoy-electron/src/utilities/save-utility.ts +0 -125
- package/template-react-vite-muijoy-electron/src/values/characters.ts +0 -11
- package/template-react-vite-muijoy-electron/src/values/translations/strings_en.json +0 -60
- package/template-react-vite-muijoy-electron/src/vite-env.d.ts +0 -4
- package/template-react-vite-muijoy-electron/src-electron/icons/icon.icns +0 -0
- package/template-react-vite-muijoy-electron/src-electron/icons/icon.ico +0 -0
- package/template-react-vite-muijoy-electron/src-electron/icons/icon.png +0 -0
- package/template-react-vite-muijoy-electron/src-electron/index.css +0 -7
- package/template-react-vite-muijoy-electron/src-electron/main.ts +0 -59
- package/template-react-vite-muijoy-electron/src-electron/preload.ts +0 -2
- package/template-react-vite-muijoy-electron/src-electron/renderer.ts +0 -31
- package/template-react-vite-muijoy-electron/tsconfig.json +0 -32
- package/template-react-vite-muijoy-electron/tsconfig.node.json +0 -11
- package/template-react-vite-muijoy-electron/vite.base.config.ts +0 -93
- package/template-react-vite-muijoy-electron/vite.config.ts +0 -54
- package/template-react-vite-muijoy-electron/vite.main.config.ts +0 -9
- package/template-react-vite-muijoy-electron/vite.preload.config.ts +0 -9
- package/template-react-vite-muijoy-electron/vite.renderer.config.ts +0 -9
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
2
|
-
import LanguageDetector from 'i18next-browser-languagedetector';
|
|
3
|
-
import { initReactI18next } from 'react-i18next';
|
|
4
|
-
import strings_en from '../src/values/translations/strings_en.json';
|
|
5
|
-
|
|
6
|
-
const getUserLang = (): string => {
|
|
7
|
-
let userLang: string = navigator.language || "en";
|
|
8
|
-
return userLang?.toLocaleLowerCase()?.split("-")[0];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const useI18n = () => {
|
|
12
|
-
if (!i18n.isInitialized) {
|
|
13
|
-
i18n
|
|
14
|
-
.use(LanguageDetector)
|
|
15
|
-
.use(initReactI18next)
|
|
16
|
-
.init({
|
|
17
|
-
debug: false,
|
|
18
|
-
fallbackLng: 'en',
|
|
19
|
-
lng: getUserLang(),
|
|
20
|
-
interpolation: {
|
|
21
|
-
escapeValue: false,
|
|
22
|
-
},
|
|
23
|
-
resources: {
|
|
24
|
-
en: strings_en,
|
|
25
|
-
// Add more languages here
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { useRecoilState } from 'recoil';
|
|
4
|
-
import { hideInterfaceState } from '../atoms/hideInterfaceState';
|
|
5
|
-
import { INTERFACE_DATA_USE_QUEY_KEY } from '../use_query/useQueryInterface';
|
|
6
|
-
import { initializeIndexedDB } from '../utilities/indexedDB-utility';
|
|
7
|
-
import { useMyNavigate } from '../utilities/navigate-utility';
|
|
8
|
-
import { addRefreshSave, loadRefreshSave } from '../utilities/save-utility';
|
|
9
|
-
|
|
10
|
-
export default function EventInterceptor() {
|
|
11
|
-
const [hideInterface, setHideInterface] = useRecoilState(hideInterfaceState);
|
|
12
|
-
const navigate = useMyNavigate();
|
|
13
|
-
const queryClient = useQueryClient()
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
Promise.all([loadRefreshSave(navigate), initializeIndexedDB()])
|
|
17
|
-
.then(() => queryClient.invalidateQueries({ queryKey: [INTERFACE_DATA_USE_QUEY_KEY] }))
|
|
18
|
-
window.addEventListener("beforeunload", async () => {
|
|
19
|
-
await addRefreshSave()
|
|
20
|
-
});
|
|
21
|
-
window.addEventListener("popstate", onpopstate);
|
|
22
|
-
window.addEventListener('keydown', onkeydown);
|
|
23
|
-
|
|
24
|
-
return () => {
|
|
25
|
-
window.removeEventListener("beforeunload", async () => {
|
|
26
|
-
await addRefreshSave()
|
|
27
|
-
});
|
|
28
|
-
window.removeEventListener("popstate", onpopstate);
|
|
29
|
-
window.removeEventListener('keydown', onkeydown);
|
|
30
|
-
};
|
|
31
|
-
}, []);
|
|
32
|
-
|
|
33
|
-
function onpopstate() {
|
|
34
|
-
window.history.forward();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function onkeydown(event: KeyboardEvent) {
|
|
38
|
-
if (event.code == 'Enter' || event.code == 'Space') {
|
|
39
|
-
if (hideInterface) {
|
|
40
|
-
setHideInterface(false)
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
else if (event.code == 'KeyV' && event.shiftKey) {
|
|
44
|
-
setHideInterface((prev) => !prev)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return null
|
|
49
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { StepLabelProps } from '@drincs/pixi-vn/dist/override';
|
|
2
|
-
import { useSnackbar } from 'notistack';
|
|
3
|
-
import { useEffect, useState } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
|
-
import { useRecoilValue } from 'recoil';
|
|
6
|
-
import { autoInfoState } from '../atoms/autoInfoState';
|
|
7
|
-
import { skipEnabledState } from '../atoms/skipEnabledState';
|
|
8
|
-
import { typewriterIsAnimatedState } from '../atoms/typewriterIsAnimatedState';
|
|
9
|
-
import { useMyNavigate } from '../utilities/navigate-utility';
|
|
10
|
-
|
|
11
|
-
export default function SkipAutoInterceptor({ nextOnClick }: {
|
|
12
|
-
nextOnClick: (props: StepLabelProps) => Promise<void>,
|
|
13
|
-
}) {
|
|
14
|
-
const navigate = useMyNavigate();
|
|
15
|
-
const { t: tNarration } = useTranslation(["narration"]);
|
|
16
|
-
const skipEnabled = useRecoilValue(skipEnabledState)
|
|
17
|
-
const autoInfo = useRecoilValue(autoInfoState)
|
|
18
|
-
const typewriterIsAnimated = useRecoilValue(typewriterIsAnimatedState)
|
|
19
|
-
const [recheckSkip, setRecheckSkip] = useState<number>(0)
|
|
20
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
// Debouncing
|
|
24
|
-
let timeout = setTimeout(() => {
|
|
25
|
-
if (skipEnabled) {
|
|
26
|
-
nextOnClick({
|
|
27
|
-
t: tNarration,
|
|
28
|
-
navigate,
|
|
29
|
-
notify: (message, variant) => enqueueSnackbar(message, { variant }),
|
|
30
|
-
}).then(() => {
|
|
31
|
-
setRecheckSkip((p) => p + 1)
|
|
32
|
-
})
|
|
33
|
-
}
|
|
34
|
-
}, 400);
|
|
35
|
-
|
|
36
|
-
return () => {
|
|
37
|
-
clearTimeout(timeout)
|
|
38
|
-
}
|
|
39
|
-
}, [skipEnabled, recheckSkip])
|
|
40
|
-
|
|
41
|
-
useEffect(() => {
|
|
42
|
-
if (skipEnabled) {
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
if (autoInfo.enabled && !typewriterIsAnimated) {
|
|
46
|
-
if (autoInfo.time) {
|
|
47
|
-
let millisecond = autoInfo.time * 1000
|
|
48
|
-
// Debouncing
|
|
49
|
-
let timeout = setTimeout(() => {
|
|
50
|
-
if (autoInfo.enabled && !skipEnabled) {
|
|
51
|
-
nextOnClick({
|
|
52
|
-
t: tNarration,
|
|
53
|
-
navigate,
|
|
54
|
-
notify: (message, variant) => enqueueSnackbar(message, { variant }),
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
}, millisecond);
|
|
58
|
-
|
|
59
|
-
return () => {
|
|
60
|
-
clearTimeout(timeout)
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}, [autoInfo, typewriterIsAnimated, skipEnabled])
|
|
65
|
-
|
|
66
|
-
return null
|
|
67
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { canvas, narration } from '@drincs/pixi-vn'
|
|
2
|
-
import { createRoot } from 'react-dom/client'
|
|
3
|
-
import App from './App'
|
|
4
|
-
import './index.css'
|
|
5
|
-
import { gameEnd } from './utilities/actions-utility'
|
|
6
|
-
|
|
7
|
-
// Canvas setup with PIXI
|
|
8
|
-
const body = document.body
|
|
9
|
-
if (!body) {
|
|
10
|
-
throw new Error('body element not found')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
canvas.initialize(body, 1920, 1080, {
|
|
14
|
-
backgroundColor: "#303030"
|
|
15
|
-
}).then(() => {
|
|
16
|
-
// React setup with ReactDOM
|
|
17
|
-
const root = document.getElementById('root')
|
|
18
|
-
if (!root) {
|
|
19
|
-
throw new Error('root element not found')
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
canvas.initializeHTMLLayout(root)
|
|
23
|
-
if (!canvas.htmlLayout) {
|
|
24
|
-
throw new Error('htmlLayout not found')
|
|
25
|
-
}
|
|
26
|
-
const reactRoot = createRoot(canvas.htmlLayout)
|
|
27
|
-
|
|
28
|
-
reactRoot.render(
|
|
29
|
-
<App />
|
|
30
|
-
)
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
narration.onGameEnd = async ({ navigate }) => {
|
|
34
|
-
gameEnd(navigate)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
narration.onStepError = async (_error, { notify, t }) => {
|
|
38
|
-
notify(t("allert_error_occurred"), "error")
|
|
39
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { CharacterInterface, CharacterStoredClass } from "@drincs/pixi-vn";
|
|
2
|
-
|
|
3
|
-
interface CharacterProps {
|
|
4
|
-
/**
|
|
5
|
-
* The name of the character.
|
|
6
|
-
*/
|
|
7
|
-
name?: string;
|
|
8
|
-
/**
|
|
9
|
-
* The surname of the character.
|
|
10
|
-
*/
|
|
11
|
-
surname?: string;
|
|
12
|
-
/**
|
|
13
|
-
* The age of the character.
|
|
14
|
-
*/
|
|
15
|
-
age?: number;
|
|
16
|
-
/**
|
|
17
|
-
* The icon of the character.
|
|
18
|
-
*/
|
|
19
|
-
icon?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The color of the character.
|
|
22
|
-
*/
|
|
23
|
-
color?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export default class Character extends CharacterStoredClass implements CharacterInterface {
|
|
27
|
-
/**
|
|
28
|
-
* @param id The id of the character.
|
|
29
|
-
* @param props The properties of the character.
|
|
30
|
-
*/
|
|
31
|
-
constructor(id: string | { id: string, emotion: string }, props: CharacterProps) {
|
|
32
|
-
super(typeof id === "string" ? id : id.id, typeof id === "string" ? "" : id.emotion)
|
|
33
|
-
this.defaultName = props.name
|
|
34
|
-
this.defaultSurname = props.surname
|
|
35
|
-
this.defaultAge = props.age
|
|
36
|
-
this._icon = props.icon
|
|
37
|
-
this._color = props.color
|
|
38
|
-
}
|
|
39
|
-
private defaultName?: string
|
|
40
|
-
/***
|
|
41
|
-
* The name of the character.
|
|
42
|
-
* If you set undefined, it will return the default name.
|
|
43
|
-
*/
|
|
44
|
-
get name(): string {
|
|
45
|
-
return this.getStorageProperty<string>("name") || this.defaultName || this.id
|
|
46
|
-
}
|
|
47
|
-
set name(value: string | undefined) {
|
|
48
|
-
this.setStorageProperty<string>("name", value)
|
|
49
|
-
}
|
|
50
|
-
private defaultSurname?: string
|
|
51
|
-
/**
|
|
52
|
-
* The surname of the character.
|
|
53
|
-
* If you set undefined, it will return the default surname.
|
|
54
|
-
*/
|
|
55
|
-
get surname(): string | undefined {
|
|
56
|
-
return this.getStorageProperty<string>("surname") || this.defaultSurname
|
|
57
|
-
}
|
|
58
|
-
set surname(value: string | undefined) {
|
|
59
|
-
this.setStorageProperty<string>("surname", value)
|
|
60
|
-
}
|
|
61
|
-
private defaultAge?: number | undefined
|
|
62
|
-
/**
|
|
63
|
-
* The age of the character.
|
|
64
|
-
* If you set undefined, it will return the default age.
|
|
65
|
-
*/
|
|
66
|
-
get age(): number | undefined {
|
|
67
|
-
return this.getStorageProperty<number>("age") || this.defaultAge
|
|
68
|
-
}
|
|
69
|
-
set age(value: number | undefined) {
|
|
70
|
-
this.setStorageProperty<number>("age", value)
|
|
71
|
-
}
|
|
72
|
-
private _icon?: string
|
|
73
|
-
/**
|
|
74
|
-
* The icon of the character.
|
|
75
|
-
*/
|
|
76
|
-
get icon(): string | undefined {
|
|
77
|
-
return this._icon
|
|
78
|
-
}
|
|
79
|
-
private _color?: string | undefined
|
|
80
|
-
/**
|
|
81
|
-
* The color of the character.
|
|
82
|
-
*/
|
|
83
|
-
get color(): string | undefined {
|
|
84
|
-
return this._color
|
|
85
|
-
}
|
|
86
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { VariantType } from "notistack"
|
|
2
|
-
|
|
3
|
-
declare module '@drincs/pixi-vn/dist/override' {
|
|
4
|
-
interface StepLabelResult {
|
|
5
|
-
[key: string]: any
|
|
6
|
-
}
|
|
7
|
-
interface StepLabelProps {
|
|
8
|
-
/**
|
|
9
|
-
* function to navigate to a new route.
|
|
10
|
-
* @param route The route to navigate to.
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
navigate: (route: string) => void
|
|
14
|
-
/**
|
|
15
|
-
* Translate a key to a string.
|
|
16
|
-
* @param key The key to translate.
|
|
17
|
-
* @returns The translated string.
|
|
18
|
-
*/
|
|
19
|
-
t: TFunction<[string], undefined>
|
|
20
|
-
/**
|
|
21
|
-
* Show a notification.
|
|
22
|
-
* @param message The message to show.
|
|
23
|
-
* @param variant The variant of the notification.
|
|
24
|
-
* @returns
|
|
25
|
-
*/
|
|
26
|
-
notify: (message: string, variant: VariantType) => void
|
|
27
|
-
[key: string]: any
|
|
28
|
-
}
|
|
29
|
-
interface CharacterInterface {
|
|
30
|
-
name: string
|
|
31
|
-
surname?: string
|
|
32
|
-
age?: number
|
|
33
|
-
icon?: string
|
|
34
|
-
color?: string
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import { CssVarsProvider, extendTheme } from '@mui/joy';
|
|
2
|
-
import {
|
|
3
|
-
THEME_ID as MATERIAL_THEME_ID,
|
|
4
|
-
ThemeProvider as MaterialCssVarsProvider,
|
|
5
|
-
extendTheme as materialExtendTheme,
|
|
6
|
-
} from '@mui/material/styles';
|
|
7
|
-
import { createContext, useContext, useMemo, useState } from 'react';
|
|
8
|
-
import ShadeGenerator from 'shade-generator';
|
|
9
|
-
|
|
10
|
-
type Iprops = {
|
|
11
|
-
children: React.ReactNode
|
|
12
|
-
}
|
|
13
|
-
type SolidColorType = "black" | "white"
|
|
14
|
-
|
|
15
|
-
const ColorContext = createContext<{
|
|
16
|
-
primaryColor: string,
|
|
17
|
-
setPrimaryColor: (color: string) => void,
|
|
18
|
-
solidColor: SolidColorType,
|
|
19
|
-
setSolidColor: (color: SolidColorType) => void,
|
|
20
|
-
|
|
21
|
-
}>({
|
|
22
|
-
primaryColor: "",
|
|
23
|
-
setPrimaryColor: () => { },
|
|
24
|
-
solidColor: "white",
|
|
25
|
-
setSolidColor: () => { },
|
|
26
|
-
})
|
|
27
|
-
const materialTheme = materialExtendTheme();
|
|
28
|
-
|
|
29
|
-
export function useEditColorProvider() {
|
|
30
|
-
const context = useContext(ColorContext);
|
|
31
|
-
if (context === undefined) {
|
|
32
|
-
throw new Error("usePrimaryColorProvider must be used within a PrimaryColorProvider")
|
|
33
|
-
}
|
|
34
|
-
return context;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Get 10 shades of a color based on the color you pass in.
|
|
39
|
-
* @param color
|
|
40
|
-
* @example
|
|
41
|
-
* If you pass in a color of '#03a9f4', you will get the following shades:
|
|
42
|
-
* {
|
|
43
|
-
* "50": "#e1f5fe",
|
|
44
|
-
* "100": "#b3e5fc",
|
|
45
|
-
* "200": "#81d4fa",
|
|
46
|
-
* "300": "#4fc3f7",
|
|
47
|
-
* "400": "#29b6f6",
|
|
48
|
-
* "500": "#03a9f4",
|
|
49
|
-
* "600": "#039be5",
|
|
50
|
-
* "700": "#0288d1",
|
|
51
|
-
* "800": "#0277bd",
|
|
52
|
-
* "900": "#01579b"
|
|
53
|
-
* }
|
|
54
|
-
*/
|
|
55
|
-
function get10ColorShades(color: string) {
|
|
56
|
-
return {
|
|
57
|
-
"50": ShadeGenerator.hue(color).shade("10").hex(),
|
|
58
|
-
"100": ShadeGenerator.hue(color).shade("20").hex(),
|
|
59
|
-
"200": ShadeGenerator.hue(color).shade("40").hex(),
|
|
60
|
-
"300": ShadeGenerator.hue(color).shade("60").hex(),
|
|
61
|
-
"400": ShadeGenerator.hue(color).shade("80").hex(),
|
|
62
|
-
"500": ShadeGenerator.hue(color).shade("100").hex(),
|
|
63
|
-
"600": ShadeGenerator.hue(color).shade("200").hex(),
|
|
64
|
-
"700": ShadeGenerator.hue(color).shade("300").hex(),
|
|
65
|
-
"800": ShadeGenerator.hue(color).shade("400").hex(),
|
|
66
|
-
"900": ShadeGenerator.hue(color).shade("500").hex(),
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export default function MyThemeProvider({ children }: Iprops) {
|
|
71
|
-
const [primaryColor, setPrimaryColor] = useState(localStorage.getItem("primaryColor") || '#1c73ff')
|
|
72
|
-
const [solidColor, setSolidColor] = useState<SolidColorType>(localStorage.getItem("solidColor") as SolidColorType || "white")
|
|
73
|
-
|
|
74
|
-
// Build the theme: https://mui.com/joy-ui/customization/theme-builder
|
|
75
|
-
const theme = useMemo(() => {
|
|
76
|
-
// Debouncing
|
|
77
|
-
localStorage.setItem("primaryColor", primaryColor)
|
|
78
|
-
localStorage.setItem("solidColor", solidColor)
|
|
79
|
-
|
|
80
|
-
let colors = get10ColorShades(primaryColor)
|
|
81
|
-
return extendTheme({
|
|
82
|
-
colorSchemes: {
|
|
83
|
-
light: {
|
|
84
|
-
palette: {
|
|
85
|
-
primary: {
|
|
86
|
-
...colors,
|
|
87
|
-
solidColor: solidColor === "black" ? "var(--joy-palette-common-black)" : "var(--joy-palette-common-white)",
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
dark: {
|
|
92
|
-
palette: {
|
|
93
|
-
primary: {
|
|
94
|
-
...colors,
|
|
95
|
-
solidColor: solidColor === "black" ? "var(--joy-palette-common-black)" : "var(--joy-palette-common-white)",
|
|
96
|
-
},
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
components: {
|
|
101
|
-
JoyButton: {
|
|
102
|
-
styleOverrides: {
|
|
103
|
-
root: {
|
|
104
|
-
pointerEvents: "auto",
|
|
105
|
-
userSelect: "none",
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
JoyLink: {
|
|
110
|
-
styleOverrides: {
|
|
111
|
-
root: {
|
|
112
|
-
pointerEvents: "auto",
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
JoySvgIcon: {
|
|
117
|
-
styleOverrides: {
|
|
118
|
-
root: {
|
|
119
|
-
pointerEvents: "auto",
|
|
120
|
-
},
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
MuiSvgIcon: {
|
|
124
|
-
styleOverrides: {
|
|
125
|
-
root: {
|
|
126
|
-
pointerEvents: "auto",
|
|
127
|
-
},
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
JoyCard: {
|
|
131
|
-
styleOverrides: {
|
|
132
|
-
root: {
|
|
133
|
-
pointerEvents: "auto",
|
|
134
|
-
},
|
|
135
|
-
},
|
|
136
|
-
},
|
|
137
|
-
JoyIconButton: {
|
|
138
|
-
styleOverrides: {
|
|
139
|
-
root: {
|
|
140
|
-
pointerEvents: "auto",
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
})
|
|
146
|
-
}, [primaryColor, solidColor])
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
return (
|
|
150
|
-
<MaterialCssVarsProvider theme={{ [MATERIAL_THEME_ID]: materialTheme }}>
|
|
151
|
-
<CssVarsProvider
|
|
152
|
-
theme={theme}
|
|
153
|
-
>
|
|
154
|
-
<ColorContext.Provider value={{
|
|
155
|
-
primaryColor: primaryColor,
|
|
156
|
-
setPrimaryColor: setPrimaryColor,
|
|
157
|
-
solidColor: solidColor,
|
|
158
|
-
setSolidColor: setSolidColor,
|
|
159
|
-
}}>
|
|
160
|
-
{children}
|
|
161
|
-
</ColorContext.Provider>
|
|
162
|
-
</CssVarsProvider>
|
|
163
|
-
</MaterialCssVarsProvider>
|
|
164
|
-
);
|
|
165
|
-
}
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { ChoiceMenuOption, ChoiceMenuOptionClose, narration } from '@drincs/pixi-vn';
|
|
2
|
-
import KeyboardReturnIcon from '@mui/icons-material/KeyboardReturn';
|
|
3
|
-
import { Box, Grid } from '@mui/joy';
|
|
4
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { motion, Variants } from "motion/react";
|
|
6
|
-
import { useSnackbar } from 'notistack';
|
|
7
|
-
import { useState } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
|
-
import { useRecoilValue } from 'recoil';
|
|
10
|
-
import { dialogueCardHeightState } from '../atoms/dialogueCardHeightState';
|
|
11
|
-
import { hideInterfaceState } from '../atoms/hideInterfaceState';
|
|
12
|
-
import ChoiceButton from '../components/ChoiceButton';
|
|
13
|
-
import { INTERFACE_DATA_USE_QUEY_KEY, useQueryChoiceMenuOptions } from '../use_query/useQueryInterface';
|
|
14
|
-
import { useMyNavigate } from '../utilities/navigate-utility';
|
|
15
|
-
|
|
16
|
-
export default function ChoiceMenu({ fullscreen = true }: {
|
|
17
|
-
fullscreen?: boolean,
|
|
18
|
-
}) {
|
|
19
|
-
const [loading, setLoading] = useState(false)
|
|
20
|
-
const marginButton = useRecoilValue(dialogueCardHeightState)
|
|
21
|
-
const height = 100 - marginButton
|
|
22
|
-
const { t: tNarration } = useTranslation(["narration"]);
|
|
23
|
-
const navigate = useMyNavigate();
|
|
24
|
-
const { data: menu = [] } = useQueryChoiceMenuOptions()
|
|
25
|
-
const hideInterface = useRecoilValue(hideInterfaceState) || menu.length == 0;
|
|
26
|
-
const queryClient = useQueryClient()
|
|
27
|
-
const { enqueueSnackbar } = useSnackbar();
|
|
28
|
-
const gridVariants: Variants = {
|
|
29
|
-
open: {
|
|
30
|
-
clipPath: "inset(0% 0% 0% 0% round 10px)",
|
|
31
|
-
transition: {
|
|
32
|
-
type: "spring",
|
|
33
|
-
bounce: 0,
|
|
34
|
-
duration: 0.7,
|
|
35
|
-
staggerChildren: 0.05
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
closed: {
|
|
39
|
-
clipPath: "inset(10% 50% 90% 50% round 10px)",
|
|
40
|
-
transition: {
|
|
41
|
-
type: "spring",
|
|
42
|
-
bounce: 0,
|
|
43
|
-
duration: 0.3
|
|
44
|
-
},
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
const itemVariants: Variants = {
|
|
48
|
-
open: {
|
|
49
|
-
opacity: 1,
|
|
50
|
-
y: 0,
|
|
51
|
-
transition: { type: "spring", stiffness: 300, damping: 24 }
|
|
52
|
-
},
|
|
53
|
-
closed: { opacity: 0, y: 20, transition: { duration: 0.2 } }
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
function afterSelectChoice(item: ChoiceMenuOptionClose | ChoiceMenuOption<{}>) {
|
|
57
|
-
setLoading(true)
|
|
58
|
-
narration.selectChoice(item, {
|
|
59
|
-
navigate: navigate,
|
|
60
|
-
t: tNarration,
|
|
61
|
-
notify: (message, variant) => enqueueSnackbar(message, { variant }),
|
|
62
|
-
...item.props
|
|
63
|
-
})
|
|
64
|
-
.then(() => {
|
|
65
|
-
queryClient.invalidateQueries({ queryKey: [INTERFACE_DATA_USE_QUEY_KEY] })
|
|
66
|
-
setLoading(false)
|
|
67
|
-
})
|
|
68
|
-
.catch((e) => {
|
|
69
|
-
setLoading(false)
|
|
70
|
-
console.error(e)
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return (
|
|
75
|
-
<Box
|
|
76
|
-
sx={{
|
|
77
|
-
width: '100%',
|
|
78
|
-
position: "absolute",
|
|
79
|
-
top: 0,
|
|
80
|
-
left: 0,
|
|
81
|
-
right: 0,
|
|
82
|
-
height: fullscreen ? "100%" : `${height}%`,
|
|
83
|
-
pointerEvents: hideInterface ? "none" : "auto",
|
|
84
|
-
}}
|
|
85
|
-
>
|
|
86
|
-
<Grid
|
|
87
|
-
container
|
|
88
|
-
direction="column"
|
|
89
|
-
justifyContent="center"
|
|
90
|
-
alignItems="center"
|
|
91
|
-
spacing={2}
|
|
92
|
-
sx={{
|
|
93
|
-
overflow: 'auto',
|
|
94
|
-
height: "100%",
|
|
95
|
-
gap: 1,
|
|
96
|
-
width: '100%',
|
|
97
|
-
}}
|
|
98
|
-
component={motion.div}
|
|
99
|
-
variants={gridVariants}
|
|
100
|
-
animate={hideInterface ? "closed" : "open"}
|
|
101
|
-
>
|
|
102
|
-
{menu?.map((item, index) => {
|
|
103
|
-
return (
|
|
104
|
-
<Grid
|
|
105
|
-
key={"choice-" + index}
|
|
106
|
-
justifyContent="center"
|
|
107
|
-
alignItems="center"
|
|
108
|
-
component={motion.div}
|
|
109
|
-
variants={itemVariants}
|
|
110
|
-
>
|
|
111
|
-
<ChoiceButton
|
|
112
|
-
loading={loading}
|
|
113
|
-
onClick={() => {
|
|
114
|
-
afterSelectChoice(item)
|
|
115
|
-
}}
|
|
116
|
-
sx={{
|
|
117
|
-
left: 0,
|
|
118
|
-
right: 0,
|
|
119
|
-
}}
|
|
120
|
-
startDecorator={item.type == "close" ? <KeyboardReturnIcon /> : undefined}
|
|
121
|
-
>
|
|
122
|
-
{item.text}
|
|
123
|
-
</ChoiceButton>
|
|
124
|
-
</Grid>
|
|
125
|
-
)
|
|
126
|
-
})}
|
|
127
|
-
</Grid>
|
|
128
|
-
</Box>
|
|
129
|
-
);
|
|
130
|
-
}
|