Commit 7553a952 authored by Chunchi Che's avatar Chunchi Che

finish side migration 100%

parent cf314eab
Pipeline #23299 passed with stages
in 12 minutes and 29 seconds
import React, { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useSnapshot } from "valtio";
import { resetUniverse } from "@/stores";
import { SideStage, sideStore } from "@/stores";
import {
Alert,
......@@ -20,13 +22,15 @@ import {
import { LifeBar, Mat, Menu, Underlying } from "./PlayMat";
export const Component: React.FC = () => {
const { stage } = useSnapshot(sideStore);
const navigate = useNavigate();
useEffect(() => {
return () => {
// FIXME
// Duel组件卸载的时候初始化一些store
resetUniverse();
};
}, []);
if (stage === SideStage.SIDE_CHANGING) {
// 跳转更换Side
navigate("/side");
}
}, [stage]);
return (
<>
......
......@@ -6,12 +6,12 @@ import {
} from "@ant-design/icons";
import { App, Button, Space } from "antd";
import { useEffect, useState } from "react";
import { useNavigate } from "react-router-dom";
import { LoaderFunction, useNavigate } from "react-router-dom";
import { useSnapshot } from "valtio";
import { match } from "@/api";
import { useConfig } from "@/config";
import { accountStore, deckStore, roomStore } from "@/stores";
import { accountStore, deckStore, resetUniverse, roomStore } from "@/stores";
import { Background, IconFont, Select } from "@/ui/Shared";
import styles from "./index.module.scss";
......@@ -21,6 +21,12 @@ import { connectSrvpro } from "./util";
const NeosConfig = useConfig();
export const loader: LoaderFunction = () => {
// 在加载这个页面之前先重置一些store,清掉上局游戏遗留的数据
resetUniverse();
return null;
};
export const Component: React.FC = () => {
const { message } = App.useApp();
const serverList = NeosConfig.servers;
......
......@@ -5,7 +5,7 @@ import { useSnapshot } from "valtio";
import { sendTpResult } from "@/api";
import { SideStage, sideStore } from "@/stores";
import styles from "./index.module.scss";
import styles from "./TpModal.module.scss";
export const TpModal: React.FC = () => {
const { stage } = useSnapshot(sideStore);
......
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