Commit 8bf56875 authored by timel's avatar timel

fix: 零成本抽象

parent c7e976ea
Pipeline #27553 passed with stages
in 7 minutes and 19 seconds
...@@ -24,6 +24,7 @@ import { AnnounceModal } from "./Message/AnnounceModal"; ...@@ -24,6 +24,7 @@ import { AnnounceModal } from "./Message/AnnounceModal";
import { LifeBar, Mat, Menu, Underlying } from "./PlayMat"; import { LifeBar, Mat, Menu, Underlying } from "./PlayMat";
import { ChatBox } from "./PlayMat/ChatBox"; import { ChatBox } from "./PlayMat/ChatBox";
import { HandChain } from "./PlayMat/HandChain"; import { HandChain } from "./PlayMat/HandChain";
import { useEnv } from "@/hook";
export const loader: LoaderFunction = async () => { export const loader: LoaderFunction = async () => {
// 更新场景 // 更新场景
...@@ -38,14 +39,16 @@ export const Component: React.FC = () => { ...@@ -38,14 +39,16 @@ export const Component: React.FC = () => {
// 如果处于开发时的本地文件回放模式,则重新跳回Match且保持record参数,从而开始下一轮播放 // 如果处于开发时的本地文件回放模式,则重新跳回Match且保持record参数,从而开始下一轮播放
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const { DEV } = useEnv();
useEffect(() => { useEffect(() => {
const devReplayFile = searchParams.get("record"); if (!DEV) return;
const recordName = searchParams.get("record");
if ( if (
searchParams && searchParams &&
matStore.selfType === ygopro.StocTypeChange.SelfType.UNKNOWN matStore.selfType === ygopro.StocTypeChange.SelfType.UNKNOWN
) { ) {
navigate(`/match?record=${devReplayFile}`); navigate(`/match?record=${recordName}`);
} }
}, []); }, []);
......
...@@ -7,6 +7,7 @@ import { replayStore } from "@/stores"; ...@@ -7,6 +7,7 @@ import { replayStore } from "@/stores";
import { Uploader } from "../../Shared"; import { Uploader } from "../../Shared";
import { connectSrvpro } from "../util"; import { connectSrvpro } from "../util";
import { useEnv } from "@/hook";
const localStore = proxy({ const localStore = proxy({
open: false, open: false,
...@@ -44,10 +45,12 @@ export const ReplayModal: React.FC = () => { ...@@ -44,10 +45,12 @@ export const ReplayModal: React.FC = () => {
// 开发时的回放模式:路径跳转到duel // 开发时的回放模式:路径跳转到duel
const [searchParams] = useSearchParams(); const [searchParams] = useSearchParams();
const { DEV } = useEnv();
const recordName = searchParams.get("record"); const recordName = searchParams.get("record");
// 如处于回放模式且有回放文件,则导入播放 // 如处于回放模式且有回放文件,则导入播放
useEffect(() => { useEffect(() => {
if (!DEV) return;
if (recordName) { if (recordName) {
import( import(
/* @vite-ignore */ `../../../../neos-assets/records/${recordName}.yrp3d?arraybuffer` /* @vite-ignore */ `../../../../neos-assets/records/${recordName}.yrp3d?arraybuffer`
......
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