Commit 602ea114 authored by timel's avatar timel

feat: valtio store logic 81%, mora/waitroom use valtio data source

parent c2161582
...@@ -27,17 +27,16 @@ const { ...@@ -27,17 +27,16 @@ const {
} = useConfig(); } = useConfig();
const Mora = () => { const Mora = () => {
const stateMora = moraStore; const snapMora = useSnapshot(moraStore);
const snapMora = useSnapshot(stateMora);
const dispatch = store.dispatch; const dispatch = store.dispatch;
const selectHandAble = useAppSelector(selectHandSelectAble); // const selectHandAble = useAppSelector(selectHandSelectAble);
const selectTpAble = useAppSelector(selectTpSelectAble); // const selectTpAble = useAppSelector(selectTpSelectAble);
const duelHsStart = useAppSelector(selectDuelHsStart); // const duelHsStart = useAppSelector(selectDuelHsStart);
// const selectHandAble = snapMora.selectHandAble; const selectHandAble = snapMora.selectHandAble;
// const selectTpAble = snapMora.selectTpAble; const selectTpAble = snapMora.selectTpAble;
// const duelHsStart = snapMora.duelStart; const duelHsStart = snapMora.duelStart;
const navigate = useNavigate(); const navigate = useNavigate();
const { player, passWd, ip } = useParams<{ const { player, passWd, ip } = useParams<{
...@@ -49,12 +48,12 @@ const Mora = () => { ...@@ -49,12 +48,12 @@ const Mora = () => {
const handleSelectMora = (selected: string) => { const handleSelectMora = (selected: string) => {
sendHandResult(selected); sendHandResult(selected);
dispatch(unSelectHandAble()); dispatch(unSelectHandAble());
stateMora.selectHandAble = false; moraStore.selectHandAble = false;
}; };
const handleSelectTp = (isFirst: boolean) => { const handleSelectTp = (isFirst: boolean) => {
sendTpResult(isFirst); sendTpResult(isFirst);
dispatch(unSelectTpAble()); dispatch(unSelectTpAble());
stateMora.selectTpAble = false; moraStore.selectTpAble = false;
}; };
useEffect(() => { useEffect(() => {
......
...@@ -104,20 +104,20 @@ const WaitRoom = () => { ...@@ -104,20 +104,20 @@ const WaitRoom = () => {
}, []); }, []);
const dispatch = store.dispatch; const dispatch = store.dispatch;
const joined = useAppSelector(selectJoined); // const joined = useAppSelector(selectJoined);
const chat = useAppSelector(selectChat); // const chat = useAppSelector(selectChat);
const isHost = useAppSelector(selectIsHost); // const isHost = useAppSelector(selectIsHost);
const player0 = useAppSelector(selectPlayer0); // const player0 = useAppSelector(selectPlayer0);
const player1 = useAppSelector(selectPlayer1); // const player1 = useAppSelector(selectPlayer1);
const duelStart = useAppSelector(selectDuelStart); // const duelStart = useAppSelector(selectDuelStart);
const [api, contextHolder] = notification.useNotification(); const [api, contextHolder] = notification.useNotification();
// const joined = snap.joinStore.value; const joined = snap.joinStore.value;
// const chat = snap.chatStore.message; const chat = snap.chatStore.message;
// const isHost = snap.playerStore.isHost; const isHost = snap.playerStore.isHost;
// const player0 = snap.playerStore.player0; const player0 = snap.playerStore.player0;
// const player1 = snap.playerStore.player1; const player1 = snap.playerStore.player1;
// const duelStart = snap.moraStore.duelStart; const duelStart = snap.moraStore.duelStart;
// FIXME: 这些数据应该从`store`中获取 // FIXME: 这些数据应该从`store`中获取
// TODO: 云卡组 // TODO: 云卡组
...@@ -163,6 +163,7 @@ const WaitRoom = () => { ...@@ -163,6 +163,7 @@ const WaitRoom = () => {
await dispatch( await dispatch(
initMeExtraDeckMeta({ controler: 0, codes: deck.extra?.reverse() || [] }) initMeExtraDeckMeta({ controler: 0, codes: deck.extra?.reverse() || [] })
); );
valtioStore.matStore.extraDecks.of(0).add(deck.extra?.reverse() || []);
setChoseDeck(true); setChoseDeck(true);
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment