Commit 80659000 authored by Chunchi Che's avatar Chunchi Che

Merge branch 'optimize/route' into 'main'

fix route

See merge request mycard/Neos!105
parents e17ac6e2 e8a05cc9
Pipeline #20124 passed with stages
in 6 minutes and 40 seconds
......@@ -99,11 +99,11 @@ const FixedSlot = (props: {
diffuseTexture={
props.state.occupant
? faceDown
? new BABYLON.Texture(`assets/card_back.jpg`)
? new BABYLON.Texture(`/assets/card_back.jpg`)
: new BABYLON.Texture(
`https://cdn02.moecube.com:444/images/ygopro-images-zh-CN/${props.state.occupant.id}.jpg`
)
: new BABYLON.Texture(`assets/card_slot.png`)
: new BABYLON.Texture(`/assets/card_slot.png`)
}
alpha={props.state.occupant ? 1 : 0}
></standardMaterial>
......
......@@ -51,7 +51,7 @@ const Hands = () => {
sequence={idx}
position={position}
rotation={handRotation}
cover={(_) => `assets/card_back.jpg`}
cover={(_) => `/assets/card_back.jpg`}
/>
);
})}
......
......@@ -94,7 +94,7 @@ const Light = () => (
const Ground = () => {
const shape = CONFIG.GroundShape();
const texture = new BABYLON.Texture(`assets/newfield.png`);
const texture = new BABYLON.Texture(`/assets/newfield.png`);
texture.hasAlpha = true;
return (
......
......@@ -77,7 +77,7 @@ const SingleSlot = (props: {
>
<standardMaterial
name="single-slot-mat"
diffuseTexture={new BABYLON.Texture(`assets/card_back.jpg`)}
diffuseTexture={new BABYLON.Texture(`/assets/card_back.jpg`)}
alpha={props.state.length == 0 ? 0 : 1}
/>
</box>
......
......@@ -32,7 +32,7 @@ export default function JoinRoom() {
<div id="login">
<form
className="login-form"
onSubmit={() => navigate(`/${player}/${passWd}/${ip}`)}
onSubmit={() => navigate(`/room/${player}/${passWd}/${ip}`)}
>
<span className="fa fa-user"></span>
<Input
......
......@@ -10,7 +10,7 @@ import {
import { selectDuelHsStart } from "../reducers/duel/mod";
import { store } from "../store";
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
import { useNavigate, useParams } from "react-router-dom";
import { Button, Modal } from "antd";
import {
ScissorOutlined,
......@@ -24,11 +24,16 @@ const Mora = () => {
const selectTpAble = useAppSelector(selectTpSelectAble);
const duelHsStart = useAppSelector(selectDuelHsStart);
const navigate = useNavigate();
const { player, passWd, ip } = useParams<{
player?: string;
passWd?: string;
ip?: string;
}>();
useEffect(() => {
// 若对局已经开始,自动跳转
if (duelHsStart) {
navigate("/duel");
navigate(`/duel/${player}/${passWd}/${ip}`);
}
}, [duelHsStart]);
......
......@@ -10,9 +10,9 @@ export default function () {
return (
<Routes>
<Route path="/" element={<JoinRoom />} />
<Route path="/:player/:passWd/:ip" element={<WaitRoomV2 />} />
<Route path="/mora" element={<MoraV2 />} />
<Route path="/duel" element={<NeosDuel />} />
<Route path="/room/:player/:passWd/:ip" element={<WaitRoomV2 />} />
<Route path="/mora/:player/:passWd/:ip" element={<MoraV2 />} />
<Route path="/duel/:player/:passWd/:ip" element={<NeosDuel />} />
</Routes>
);
}
......@@ -191,7 +191,7 @@ const WaitRoom = () => {
player0.state !== READY_STATE ||
player1.state !== READY_STATE
? {}
: { pathname: `/mora` }
: { pathname: `/mora/${player}/${passWd}/${ip}` }
}
>
开始游戏
......
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