Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
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
nanahira
srvpro2
Commits
50dfa86d
Commit
50dfa86d
authored
Feb 24, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add DuelRecord.toPlayback
parent
382ebb8f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
src/feats/cloud-replay/cloud-replay-service.ts
src/feats/cloud-replay/cloud-replay-service.ts
+1
-1
src/room/duel-record.ts
src/room/duel-record.ts
+21
-4
src/room/room.ts
src/room/room.ts
+2
-2
No files found.
src/feats/cloud-replay/cloud-replay-service.ts
View file @
50dfa86d
...
...
@@ -427,7 +427,7 @@ export class CloudReplayService {
duelRecord
:
DuelRecord
,
viewMode
:
ReplayWatchViewMode
=
'
default
'
,
)
{
return
duelRecord
.
to
Observer
Playback
(
return
duelRecord
.
toPlayback
(
viewMode
===
'
default
'
?
(
msg
)
=>
msg
:
viewMode
===
'
observer
'
...
...
src/room/duel-record.ts
View file @
50dfa86d
...
...
@@ -5,6 +5,7 @@ import {
NetPlayerType
,
YGOProMsgBase
,
YGOProMsgResponseBase
,
YGOProMsgStart
,
YGOProMsgWin
,
YGOProStocGameMsg
,
}
from
'
ygopro-msg-encode
'
;
...
...
@@ -118,14 +119,21 @@ export class DuelRecord {
return
yrp
;
}
*
to
Observer
Playback
(
*
toPlayback
(
cb
:
(
msg
:
YGOProMsgBase
)
=>
YGOProMsgBase
|
undefined
=
(
msg
)
=>
msg
,
options
:
{
includeResponse
?:
boolean
;
includeNonObserver
?:
boolean
;
msgStartPos
?:
number
;
}
=
{},
):
Generator
<
YGOProStocGameMsg
,
void
,
unknown
>
{
let
recordedWinMsg
:
YGOProMsgWin
|
undefined
;
for
(
cons
t
message
of
this
.
messages
)
{
for
(
le
t
message
of
this
.
messages
)
{
if
(
message
instanceof
YGOProMsgResponseBase
)
{
continue
;
if
(
!
options
.
includeResponse
)
{
continue
;
}
}
if
(
message
instanceof
YGOProMsgWin
)
{
if
(
!
recordedWinMsg
)
{
...
...
@@ -133,9 +141,18 @@ export class DuelRecord {
}
continue
;
}
if
(
!
message
.
getSendTargets
().
includes
(
NetPlayerType
.
OBSERVER
))
{
if
(
!
options
.
includeNonObserver
&&
!
message
.
getSendTargets
().
includes
(
NetPlayerType
.
OBSERVER
)
)
{
continue
;
}
if
(
options
.
msgStartPos
!=
null
&&
message
instanceof
YGOProMsgStart
)
{
message
=
new
YGOProMsgStart
().
fromPartial
({
...
message
,
playerType
:
options
.
msgStartPos
,
});
}
const
mappedMsg
=
cb
(
message
);
if
(
!
mappedMsg
)
{
continue
;
...
...
src/room/room.ts
View file @
50dfa86d
...
...
@@ -354,7 +354,7 @@ export class Room {
:
this
.
duelRecords
;
if
(
previousDuels
.
length
)
{
for
(
const
duelRecord
of
previousDuels
)
{
for
(
const
message
of
duelRecord
.
to
Observer
Playback
((
msg
)
=>
for
(
const
message
of
duelRecord
.
toPlayback
((
msg
)
=>
msg
.
observerView
(),
))
{
await
client
.
send
(
message
);
...
...
@@ -375,7 +375,7 @@ export class Room {
await
client
.
send
(
new
YGOProStocWaitingSide
());
}
else
if
(
this
.
duelStage
===
DuelStage
.
Dueling
)
{
// Dueling 阶段不发 DeckCount,直接发送观战消息
for
(
const
message
of
this
.
lastDuelRecord
?.
to
Observer
Playback
((
msg
)
=>
for
(
const
message
of
this
.
lastDuelRecord
?.
toPlayback
((
msg
)
=>
msg
.
observerView
(),
)
||
[])
{
await
client
.
send
(
message
);
...
...
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