Skip to content

Commit

Permalink
Merge branch 'main' into deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackRam-oss committed Jul 22, 2024
2 parents 870e46d + 76548cd commit 73252da
Show file tree
Hide file tree
Showing 15 changed files with 391 additions and 339 deletions.
158 changes: 79 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@
},
"dependencies": {
"@drincs/pixi-vn": "^0.6.4",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@mui/icons-material": "^5.16.4",
"@mui/joy": "^5.0.0-beta.28",
"framer-motion": "^11.3.5",
"i18next": "^23.12.1",
"framer-motion": "^11.3.8",
"i18next": "^23.12.2",
"i18next-browser-languagedetector": "^8.0.0",
"notistack": "^3.0.1",
"react": "^18.3.1",
"react-color": "^2.19.3",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.0.13",
"react-i18next": "^14.1.3",
"react-i18next": "^15.0.0",
"react-markdown": "^9.0.1",
"react-router-dom": "^6.25.0",
"react-router-dom": "^6.25.1",
"recoil": "^0.7.7",
"rehype-raw": "^7.0.0",
"remark-gfm": "^4.0.0",
Expand Down
21 changes: 9 additions & 12 deletions src/AppRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { GameStepManager } from '@drincs/pixi-vn';
import { StepLabelProps } from '@drincs/pixi-vn/dist/override';
import { useEffect } from 'react';
import { Route, Routes } from 'react-router-dom';
import { useSetRecoilState } from 'recoil';
import { canGoBackState } from './atoms/canGoBackState';
import { nextStepLoadingState } from './atoms/nextStepLoadingState';
import { reloadInterfaceDataEventState } from './atoms/reloadInterfaceDataEventState';
import DialogueDataEventInterceptor from './interceptors/DialogueDataEventInterceptor';
Expand All @@ -17,23 +15,22 @@ import QuickLoadAlert from './screens/QuickLoadAlert';
export default function AppRoutes() {
const notifyReloadInterfaceDataEvent = useSetRecoilState(reloadInterfaceDataEventState);
const setNextStepLoading = useSetRecoilState(nextStepLoadingState);
const setCanGoBack = useSetRecoilState(canGoBackState);
useEffect(() => {
setTimeout(() => {
setCanGoBack(GameStepManager.canGoBack)
}, 10);
}, []);
async function nextOnClick(props: StepLabelProps): Promise<void> {
setNextStepLoading(true);
try {
if (!GameStepManager.canGoNext) {
setNextStepLoading(false);
return;
}
await GameStepManager.goNext(props);
notifyReloadInterfaceDataEvent((p) => p + 1);
setNextStepLoading(false);
setCanGoBack(GameStepManager.canGoBack)
GameStepManager.goNext(props)
.then(() => {
notifyReloadInterfaceDataEvent((p) => p + 1);
setNextStepLoading(false);
})
.catch((e) => {
setNextStepLoading(false);
console.error(e);
})
return;
} catch (e) {
setNextStepLoading(false);
Expand Down
6 changes: 0 additions & 6 deletions src/atoms/autoEnabledState.ts

This file was deleted.

50 changes: 50 additions & 0 deletions src/atoms/autoInfoState.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { atom, selector } from "recoil";

type AutoInfo = {
/**
* Whether auto forward is enabled
*/
enabled: boolean,
/**
* Time in seconds to wait before auto forwarding
*/
time: number,
/**
* Force recheck the auto forward
*/
update: number,
}

const autoInfoAtomState = atom<AutoInfo>({
key: 'autoInfoAtomState',
default: {
enabled: false,
time: 1,
update: 0,
},
});

export const autoInfoState = selector<AutoInfo>({
key: 'autoInfoState',
get: ({ get }) => {
let time: number | undefined = undefined
try {
let v = localStorage.getItem("auto_forward_second")
if (v) {
time = parseInt(v)
}
} catch (e) { }

let info = get(autoInfoAtomState)
return {
...info,
time: time || info.time,
}
},
set: ({ set }, value) => {
if (value.hasOwnProperty("time")) {
localStorage.setItem("auto_forward_second", (value as AutoInfo).time.toString())
}
set(autoInfoAtomState, value)
},
});
Loading

0 comments on commit 73252da

Please sign in to comment.