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
2aaf7b86
Commit
2aaf7b86
authored
Sep 10, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复一些小问题
parent
79f1f957
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
14 additions
and
15 deletions
+14
-15
src/service/duel/gameMsg.ts
src/service/duel/gameMsg.ts
+3
-2
src/service/duel/start.ts
src/service/duel/start.ts
+2
-1
src/service/onSocketMessage.ts
src/service/onSocketMessage.ts
+2
-2
src/stores/matStore/store.ts
src/stores/matStore/store.ts
+0
-3
src/stores/matStore/types.ts
src/stores/matStore/types.ts
+0
-2
src/stores/replayStore.ts
src/stores/replayStore.ts
+2
-0
src/ui/Duel/Message/EndModal/index.tsx
src/ui/Duel/Message/EndModal/index.tsx
+2
-2
src/ui/Duel/PlayMat/Menu/index.tsx
src/ui/Duel/PlayMat/Menu/index.tsx
+1
-1
src/ui/Match/ReplayModal.tsx
src/ui/Match/ReplayModal.tsx
+2
-2
No files found.
src/service/duel/gameMsg.ts
View file @
2aaf7b86
import
{
ygopro
}
from
"
@/api
"
;
import
{
ygopro
}
from
"
@/api
"
;
import
{
mat
Store
}
from
"
@/stores
"
;
import
{
replay
Store
}
from
"
@/stores
"
;
import
{
showWaiting
}
from
"
@/ui/Duel/Message
"
;
import
{
showWaiting
}
from
"
@/ui/Duel/Message
"
;
import
onAnnounce
from
"
./announce
"
;
import
onAnnounce
from
"
./announce
"
;
...
@@ -83,6 +83,7 @@ const ReplayIgnoreMsg = [
...
@@ -83,6 +83,7 @@ const ReplayIgnoreMsg = [
"
select_yes_no
"
,
"
select_yes_no
"
,
"
select_tribute
"
,
"
select_tribute
"
,
"
select_counter
"
,
"
select_counter
"
,
"
select_sum
"
,
"
rock_paper_scissors
"
,
"
rock_paper_scissors
"
,
"
sort_card
"
,
"
sort_card
"
,
"
announce
"
,
"
announce
"
,
...
@@ -97,7 +98,7 @@ export default async function handleGameMsg(
...
@@ -97,7 +98,7 @@ export default async function handleGameMsg(
showWaiting
(
false
);
showWaiting
(
false
);
}
}
if
(
mat
Store
.
isReplay
&&
ReplayIgnoreMsg
.
includes
(
msg
.
gameMsg
))
return
;
if
(
replay
Store
.
isReplay
&&
ReplayIgnoreMsg
.
includes
(
msg
.
gameMsg
))
return
;
switch
(
msg
.
gameMsg
)
{
switch
(
msg
.
gameMsg
)
{
case
"
start
"
:
{
case
"
start
"
:
{
...
...
src/service/duel/start.ts
View file @
2aaf7b86
...
@@ -7,6 +7,7 @@ import { sleep } from "@/infra";
...
@@ -7,6 +7,7 @@ import { sleep } from "@/infra";
import
{
import
{
cardStore
,
cardStore
,
matStore
,
matStore
,
replayStore
,
RoomStage
,
RoomStage
,
roomStore
,
roomStore
,
SideStage
,
SideStage
,
...
@@ -91,7 +92,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
...
@@ -91,7 +92,7 @@ export default async (start: ygopro.StocGameMessage.MsgStart) => {
.
at
(
ygopro
.
CardZone
.
EXTRA
,
1
-
opponent
)
.
at
(
ygopro
.
CardZone
.
EXTRA
,
1
-
opponent
)
.
forEach
((
card
)
=>
(
card
.
code
=
window
.
myExtraDeckCodes
?.
pop
()
??
0
));
.
forEach
((
card
)
=>
(
card
.
code
=
window
.
myExtraDeckCodes
?.
pop
()
??
0
));
if
(
mat
Store
.
isReplay
)
{
if
(
replay
Store
.
isReplay
)
{
replayStart
();
replayStart
();
}
}
...
...
src/service/onSocketMessage.ts
View file @
2aaf7b86
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
* */
* */
import
{
adaptStoc
}
from
"
@/api/ocgcore/ocgAdapter/adapter
"
;
import
{
adaptStoc
}
from
"
@/api/ocgcore/ocgAdapter/adapter
"
;
import
{
YgoProPacket
}
from
"
@/api/ocgcore/ocgAdapter/packet
"
;
import
{
YgoProPacket
}
from
"
@/api/ocgcore/ocgAdapter/packet
"
;
import
{
matStore
,
replayStore
}
from
"
@/stores
"
;
import
{
replayStore
}
from
"
@/stores
"
;
import
handleGameMsg
from
"
./duel/gameMsg
"
;
import
handleGameMsg
from
"
./duel/gameMsg
"
;
import
handleTimeLimit
from
"
./duel/timeLimit
"
;
import
handleTimeLimit
from
"
./duel/timeLimit
"
;
...
@@ -93,7 +93,7 @@ async function _handle(e: MessageEvent) {
...
@@ -93,7 +93,7 @@ async function _handle(e: MessageEvent) {
case
"
stoc_game_msg
"
:
{
case
"
stoc_game_msg
"
:
{
await
handleGameMsg
(
pb
);
await
handleGameMsg
(
pb
);
if
(
!
mat
Store
.
isReplay
)
{
if
(
!
replay
Store
.
isReplay
)
{
// 如果不是回放模式,则记录回放数据
// 如果不是回放模式,则记录回放数据
replayStore
.
record
(
packet
);
replayStore
.
record
(
packet
);
}
}
...
...
src/stores/matStore/store.ts
View file @
2aaf7b86
...
@@ -73,7 +73,6 @@ const initialState: Omit<MatState, "reset"> = {
...
@@ -73,7 +73,6 @@ const initialState: Omit<MatState, "reset"> = {
enableM2
:
false
,
// 允许进入M2阶段
enableM2
:
false
,
// 允许进入M2阶段
enableEp
:
false
,
// 允许回合结束
enableEp
:
false
,
// 允许回合结束
},
},
isReplay
:
false
,
unimplemented
:
0
,
unimplemented
:
0
,
handResults
:
{
handResults
:
{
me
:
0
,
me
:
0
,
...
@@ -99,7 +98,6 @@ class MatStore implements MatState, NeosStore {
...
@@ -99,7 +98,6 @@ class MatStore implements MatState, NeosStore {
hint
=
initialState
.
hint
;
hint
=
initialState
.
hint
;
currentPlayer
=
initialState
.
currentPlayer
;
currentPlayer
=
initialState
.
currentPlayer
;
phase
=
initialState
.
phase
;
phase
=
initialState
.
phase
;
isReplay
=
initialState
.
isReplay
;
unimplemented
=
initialState
.
unimplemented
;
unimplemented
=
initialState
.
unimplemented
;
handResults
=
initialState
.
handResults
;
handResults
=
initialState
.
handResults
;
tossResult
=
initialState
.
tossResult
;
tossResult
=
initialState
.
tossResult
;
...
@@ -121,7 +119,6 @@ class MatStore implements MatState, NeosStore {
...
@@ -121,7 +119,6 @@ class MatStore implements MatState, NeosStore {
enableM2
:
false
,
// 允许进入M2阶段
enableM2
:
false
,
// 允许进入M2阶段
enableEp
:
false
,
// 允许回合结束
enableEp
:
false
,
// 允许回合结束
};
};
this
.
isReplay
=
false
;
this
.
unimplemented
=
0
;
this
.
unimplemented
=
0
;
this
.
handResults
.
me
=
0
;
this
.
handResults
.
me
=
0
;
this
.
handResults
.
op
=
0
;
this
.
handResults
.
op
=
0
;
...
...
src/stores/matStore/types.ts
View file @
2aaf7b86
...
@@ -30,8 +30,6 @@ export interface MatState {
...
@@ -30,8 +30,6 @@ export interface MatState {
phase
:
PhaseState
;
phase
:
PhaseState
;
isReplay
:
boolean
;
// 是否是回放模式
unimplemented
:
number
;
// 未处理的`Message`
unimplemented
:
number
;
// 未处理的`Message`
tossResult
?:
string
;
// 骰子/硬币结果
tossResult
?:
string
;
// 骰子/硬币结果
...
...
src/stores/replayStore.ts
View file @
2aaf7b86
...
@@ -17,6 +17,7 @@ interface ReplayPacket {
...
@@ -17,6 +17,7 @@ interface ReplayPacket {
// 保存对局回放数据的`Store`
// 保存对局回放数据的`Store`
class
ReplayStore
implements
NeosStore
{
class
ReplayStore
implements
NeosStore
{
isReplay
:
boolean
=
false
;
// 是否进入了回放模式
inner
:
ReplaySpot
[]
=
ref
([]);
inner
:
ReplaySpot
[]
=
ref
([]);
record
(
ygoPacket
:
YgoProPacket
)
{
record
(
ygoPacket
:
YgoProPacket
)
{
this
.
inner
.
push
({
this
.
inner
.
push
({
...
@@ -28,6 +29,7 @@ class ReplayStore implements NeosStore {
...
@@ -28,6 +29,7 @@ class ReplayStore implements NeosStore {
}
}
reset
()
{
reset
()
{
this
.
inner
.
splice
(
0
);
this
.
inner
.
splice
(
0
);
this
.
isReplay
=
false
;
}
}
}
}
...
...
src/ui/Duel/Message/EndModal/index.tsx
View file @
2aaf7b86
...
@@ -2,7 +2,7 @@ import React, { CSSProperties } from "react";
...
@@ -2,7 +2,7 @@ import React, { CSSProperties } from "react";
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
fetchStrings
,
Region
}
from
"
@/api
"
;
import
{
fetchStrings
,
Region
}
from
"
@/api
"
;
import
{
matStore
,
replayStore
,
resetDuel
}
from
"
@/stores
"
;
import
{
replayStore
,
resetDuel
}
from
"
@/stores
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
{
NeosModal
}
from
"
../NeosModal
"
;
import
styles
from
"
./index.module.scss
"
;
import
styles
from
"
./index.module.scss
"
;
...
@@ -22,7 +22,7 @@ const localStore = proxy(defaultProps);
...
@@ -22,7 +22,7 @@ const localStore = proxy(defaultProps);
export
const
EndModal
:
React
.
FC
=
()
=>
{
export
const
EndModal
:
React
.
FC
=
()
=>
{
const
{
isOpen
,
isWin
,
reason
}
=
useSnapshot
(
localStore
);
const
{
isOpen
,
isWin
,
reason
}
=
useSnapshot
(
localStore
);
const
{
isReplay
}
=
useSnapshot
(
mat
Store
);
const
{
isReplay
}
=
useSnapshot
(
replay
Store
);
const
onReturn
=
()
=>
{
const
onReturn
=
()
=>
{
resetDuel
();
resetDuel
();
...
...
src/ui/Duel/PlayMat/Menu/index.tsx
View file @
2aaf7b86
...
@@ -91,7 +91,7 @@ export const Menu = () => {
...
@@ -91,7 +91,7 @@ export const Menu = () => {
const
phaseSwitchItems
:
MenuProps
[
"
items
"
]
=
phaseBind
const
phaseSwitchItems
:
MenuProps
[
"
items
"
]
=
phaseBind
.
filter
(([,
,
,
show
])
=>
show
)
.
filter
(([,
,
,
show
])
=>
show
)
.
map
(([
phase
,
label
,
response
],
key
)
=>
({
.
map
(([
phase
,
label
,
response
,
_
],
key
)
=>
({
key
,
key
,
label
,
label
,
disabled
:
currentPhase
>=
phase
||
!
checkPhaseEnabled
(
phase
),
disabled
:
currentPhase
>=
phase
||
!
checkPhaseEnabled
(
phase
),
...
...
src/ui/Match/ReplayModal.tsx
View file @
2aaf7b86
...
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
...
@@ -3,7 +3,7 @@ import React, { useEffect, useState } from "react";
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
import
{
mat
Store
}
from
"
@/stores
"
;
import
{
replay
Store
}
from
"
@/stores
"
;
import
{
Uploader
}
from
"
../Shared
"
;
import
{
Uploader
}
from
"
../Shared
"
;
import
{
connectSrvpro
}
from
"
./util
"
;
import
{
connectSrvpro
}
from
"
./util
"
;
...
@@ -39,7 +39,7 @@ export const ReplayModal: React.FC = () => {
...
@@ -39,7 +39,7 @@ export const ReplayModal: React.FC = () => {
setLoading
(
true
);
setLoading
(
true
);
// 标记为回放模式
// 标记为回放模式
mat
Store
.
isReplay
=
true
;
replay
Store
.
isReplay
=
true
;
// 初始化额外卡组
// 初始化额外卡组
// FIXME: 这样写应该不对,有空来修
// FIXME: 这样写应该不对,有空来修
...
...
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