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