Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
4b9f3813
Commit
4b9f3813
authored
Jul 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix something
parent
9b55b152
Pipeline
#22614
passed with stages
in 10 minutes and 58 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
src/middleware/socket.ts
src/middleware/socket.ts
+1
-0
src/ui/Replay/index.tsx
src/ui/Replay/index.tsx
+25
-1
src/ui/WaitRoom.tsx
src/ui/WaitRoom.tsx
+8
-7
No files found.
src/middleware/socket.ts
View file @
4b9f3813
...
...
@@ -51,6 +51,7 @@ export default async function (action: socketAction) {
}
else
if
(
isReplay
&&
replayInfo
)
{
ws
=
new
WebSocketStream
(
replayInfo
.
Url
,
(
conn
,
_event
)
=>
{
console
.
info
(
"
replay websocket open.
"
);
conn
.
binaryType
=
"
arraybuffer
"
;
conn
.
send
(
replayInfo
.
data
);
});
...
...
src/ui/Replay/index.tsx
View file @
4b9f3813
...
...
@@ -4,8 +4,13 @@ import { UploadOutlined } from "@ant-design/icons";
import
{
Button
,
message
,
Modal
,
Upload
,
UploadProps
}
from
"
antd
"
;
import
React
,
{
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
rustInit
from
"
rust-src
"
;
import
{
initStrings
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
socketMiddleWare
,
{
socketCmd
}
from
"
@/middleware/socket
"
;
import
sqliteMiddleWare
,
{
sqliteCmd
}
from
"
@/middleware/sqlite
"
;
const
NeosConfig
=
useConfig
();
const
ReplayModal
:
React
.
FC
=
()
=>
{
const
[
replay
,
setReplay
]
=
useState
<
null
|
ArrayBuffer
>
(
null
);
...
...
@@ -29,10 +34,20 @@ const ReplayModal: React.FC = () => {
title=
"选择回放"
open=
{
true
}
maskClosable=
{
false
}
onOk=
{
()
=>
{
onOk=
{
async
()
=>
{
if
(
replay
===
null
)
{
message
.
error
(
"
请先上传录像文件
"
);
}
else
{
// 初始化wasm
const
url
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
undefined
:
new
URL
(
"
rust_src_bg.wasm
"
,
`${import.meta.env.BASE_URL}assets/`
);
await
rustInit
(
url
);
// 连接回放websocket服务
socketMiddleWare
({
cmd
:
socketCmd
.
CONNECT
,
...
...
@@ -43,6 +58,15 @@ const ReplayModal: React.FC = () => {
},
});
// 初始化sqlite
await
sqliteMiddleWare
({
cmd
:
sqliteCmd
.
INIT
,
initInfo
:
{
dbUrl
:
NeosConfig
.
cardsDbUrl
},
});
// 初始化文案
await
initStrings
();
// 跳转
navigate
(
"
/duel/neos/replay/replay.neos.moe
"
);
}
...
...
src/ui/WaitRoom.tsx
View file @
4b9f3813
...
...
@@ -59,6 +59,14 @@ const WaitRoom = () => {
useEffect
(()
=>
{
if
(
ip
&&
player
&&
player
.
length
!=
0
&&
passWd
&&
passWd
.
length
!=
0
)
{
const
init
=
async
()
=>
{
// 初始化wasm
// 需要在连接websocket之前
const
url
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
undefined
:
new
URL
(
"
rust_src_bg.wasm
"
,
`
${
import
.
meta
.
env
.
BASE_URL
}
assets/`
);
await
rustInit
(
url
);
// 页面第一次渲染时,通过socket中间件向ygopro服务端请求建立长连接
socketMiddleWare
({
cmd
:
socketCmd
.
CONNECT
,
...
...
@@ -77,13 +85,6 @@ const WaitRoom = () => {
// 初始化文案
await
initStrings
();
// 初始化wasm
const
url
=
import
.
meta
.
env
.
BASE_URL
===
"
/
"
?
undefined
:
new
URL
(
"
rust_src_bg.wasm
"
,
`
${
import
.
meta
.
env
.
BASE_URL
}
assets/`
);
await
rustInit
(
url
);
};
init
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment