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 {
} = useConfig();
const Mora = () => {
const stateMora = moraStore;
const snapMora = useSnapshot(stateMora);
const snapMora = useSnapshot(moraStore);
const dispatch = store.dispatch;
const selectHandAble = useAppSelector(selectHandSelectAble);
const selectTpAble = useAppSelector(selectTpSelectAble);
const duelHsStart = useAppSelector(selectDuelHsStart);
// const selectHandAble = useAppSelector(selectHandSelectAble);
// const selectTpAble = useAppSelector(selectTpSelectAble);
// const duelHsStart = useAppSelector(selectDuelHsStart);
// const selectHandAble = snapMora.selectHandAble;
// const selectTpAble = snapMora.selectTpAble;
// const duelHsStart = snapMora.duelStart;
const selectHandAble = snapMora.selectHandAble;
const selectTpAble = snapMora.selectTpAble;
const duelHsStart = snapMora.duelStart;
const navigate = useNavigate();
const { player, passWd, ip } = useParams<{
......@@ -49,12 +48,12 @@ const Mora = () => {
const handleSelectMora = (selected: string) => {
sendHandResult(selected);
dispatch(unSelectHandAble());
stateMora.selectHandAble = false;
moraStore.selectHandAble = false;
};
const handleSelectTp = (isFirst: boolean) => {
sendTpResult(isFirst);
dispatch(unSelectTpAble());
stateMora.selectTpAble = false;
moraStore.selectTpAble = false;
};
useEffect(() => {
......
......@@ -104,20 +104,20 @@ const WaitRoom = () => {
}, []);
const dispatch = store.dispatch;
const joined = useAppSelector(selectJoined);
const chat = useAppSelector(selectChat);
const isHost = useAppSelector(selectIsHost);
const player0 = useAppSelector(selectPlayer0);
const player1 = useAppSelector(selectPlayer1);
const duelStart = useAppSelector(selectDuelStart);
// const joined = useAppSelector(selectJoined);
// const chat = useAppSelector(selectChat);
// const isHost = useAppSelector(selectIsHost);
// const player0 = useAppSelector(selectPlayer0);
// const player1 = useAppSelector(selectPlayer1);
// const duelStart = useAppSelector(selectDuelStart);
const [api, contextHolder] = notification.useNotification();
// const joined = snap.joinStore.value;
// const chat = snap.chatStore.message;
// const isHost = snap.playerStore.isHost;
// const player0 = snap.playerStore.player0;
// const player1 = snap.playerStore.player1;
// const duelStart = snap.moraStore.duelStart;
const joined = snap.joinStore.value;
const chat = snap.chatStore.message;
const isHost = snap.playerStore.isHost;
const player0 = snap.playerStore.player0;
const player1 = snap.playerStore.player1;
const duelStart = snap.moraStore.duelStart;
// FIXME: 这些数据应该从`store`中获取
// TODO: 云卡组
......@@ -163,6 +163,7 @@ const WaitRoom = () => {
await dispatch(
initMeExtraDeckMeta({ controler: 0, codes: deck.extra?.reverse() || [] })
);
valtioStore.matStore.extraDecks.of(0).add(deck.extra?.reverse() || []);
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