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
405b1fc9
Commit
405b1fc9
authored
Feb 14, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add post watch
parent
96c55e12
Pipeline
#43199
failed with stages
in 30 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
9 deletions
+40
-9
src/constants/trans.ts
src/constants/trans.ts
+6
-0
src/feats/feats-module.ts
src/feats/feats-module.ts
+2
-0
src/room/duel-record.ts
src/room/duel-record.ts
+1
-1
src/room/room.ts
src/room/room.ts
+31
-8
No files found.
src/constants/trans.ts
View file @
405b1fc9
...
@@ -10,6 +10,9 @@ export const TRANSLATIONS = {
...
@@ -10,6 +10,9 @@ export const TRANSLATIONS = {
blank_room_name
:
'
Blank room name is unallowed, please fill in something.
'
,
blank_room_name
:
'
Blank room name is unallowed, please fill in something.
'
,
replay_hint_part1
:
'
Sending the replay of the duel number
'
,
replay_hint_part1
:
'
Sending the replay of the duel number
'
,
replay_hint_part2
:
'
.
'
,
replay_hint_part2
:
'
.
'
,
watch_join
:
'
joined as spectator.
'
,
quit_watch
:
'
quited spectating
'
,
left_game
:
'
quited game
'
,
},
},
'
zh-CN
'
:
{
'
zh-CN
'
:
{
update_required
:
'
请更新你的客户端版本
'
,
update_required
:
'
请更新你的客户端版本
'
,
...
@@ -21,5 +24,8 @@ export const TRANSLATIONS = {
...
@@ -21,5 +24,8 @@ export const TRANSLATIONS = {
blank_room_name
:
'
房间名不能为空,请在主机密码处填写房间名
'
,
blank_room_name
:
'
房间名不能为空,请在主机密码处填写房间名
'
,
replay_hint_part1
:
'
正在发送第
'
,
replay_hint_part1
:
'
正在发送第
'
,
replay_hint_part2
:
'
局决斗的录像。
'
,
replay_hint_part2
:
'
局决斗的录像。
'
,
watch_join
:
'
加入了观战
'
,
quit_watch
:
'
退出了观战
'
,
left_game
:
'
离开了游戏
'
,
},
},
};
};
src/feats/feats-module.ts
View file @
405b1fc9
...
@@ -2,8 +2,10 @@ import { createAppContext } from 'nfkit';
...
@@ -2,8 +2,10 @@ import { createAppContext } from 'nfkit';
import
{
ClientVersionCheck
}
from
'
./client-version-check
'
;
import
{
ClientVersionCheck
}
from
'
./client-version-check
'
;
import
{
ContextState
}
from
'
../app
'
;
import
{
ContextState
}
from
'
../app
'
;
import
{
Welcome
}
from
'
./welcome
'
;
import
{
Welcome
}
from
'
./welcome
'
;
import
{
PlayerStatusNotify
}
from
'
./player-status-notify
'
;
export
const
FeatsModule
=
createAppContext
<
ContextState
>
()
export
const
FeatsModule
=
createAppContext
<
ContextState
>
()
.
provide
(
ClientVersionCheck
)
.
provide
(
ClientVersionCheck
)
.
provide
(
Welcome
)
.
provide
(
Welcome
)
.
provide
(
PlayerStatusNotify
)
.
define
();
.
define
();
src/room/duel-record.ts
View file @
405b1fc9
...
@@ -19,7 +19,7 @@ export class DuelRecord {
...
@@ -19,7 +19,7 @@ export class DuelRecord {
date
=
new
Date
();
date
=
new
Date
();
winPosition
?:
number
;
winPosition
?:
number
;
responses
:
Buffer
[]
=
[];
responses
:
Buffer
[]
=
[];
m
essages
:
YGOProMsgBase
[]
=
[];
watchM
essages
:
YGOProMsgBase
[]
=
[];
private
toReplayDeck
(
deck
:
YGOProDeck
|
null
|
undefined
)
{
private
toReplayDeck
(
deck
:
YGOProDeck
|
null
|
undefined
)
{
if
(
!
deck
)
{
if
(
!
deck
)
{
...
...
src/room/room.ts
View file @
405b1fc9
...
@@ -295,11 +295,25 @@ export class Room {
...
@@ -295,11 +295,25 @@ export class Room {
return
this
.
getDuelPosPlayers
(
swappedDuelPos
);
return
this
.
getDuelPosPlayers
(
swappedDuelPos
);
}
}
private
sendPostWatchMessages
(
client
:
Client
)
{
client
.
send
(
new
YGOProStocDuelStart
());
if
(
this
.
duelStage
===
DuelStage
.
Siding
)
{
client
.
send
(
new
YGOProStocWaitingSide
());
}
else
if
(
this
.
duelStage
===
DuelStage
.
Dueling
)
{
this
.
lastDuelRecord
?.
watchMessages
.
forEach
((
message
)
=>
{
client
.
send
(
new
YGOProStocGameMsg
().
fromPartial
({
msg
:
message
.
observerView
()
}),
);
});
}
}
async
join
(
client
:
Client
)
{
async
join
(
client
:
Client
)
{
client
.
roomName
=
this
.
name
;
client
.
roomName
=
this
.
name
;
client
.
isHost
=
!
this
.
allPlayers
.
length
;
client
.
isHost
=
!
this
.
allPlayers
.
length
;
const
firstEmptyPlayerSlot
=
this
.
players
.
findIndex
((
p
)
=>
!
p
);
const
firstEmptyPlayerSlot
=
this
.
players
.
findIndex
((
p
)
=>
!
p
);
const
isPlayer
=
firstEmptyPlayerSlot
>=
0
;
const
isPlayer
=
firstEmptyPlayerSlot
>=
0
&&
this
.
duelStage
===
DuelStage
.
Begin
;
if
(
isPlayer
)
{
if
(
isPlayer
)
{
this
.
players
[
firstEmptyPlayerSlot
]
=
client
;
this
.
players
[
firstEmptyPlayerSlot
]
=
client
;
...
@@ -319,16 +333,20 @@ export class Room {
...
@@ -319,16 +333,20 @@ export class Room {
client
.
send
(
p
.
prepareChangePacket
());
client
.
send
(
p
.
prepareChangePacket
());
}
}
});
});
if
(
this
.
watchers
.
size
)
{
if
(
this
.
watchers
.
size
&&
this
.
duelStage
===
DuelStage
.
Begin
)
{
client
.
send
(
this
.
watcherSizeMessage
);
client
.
send
(
this
.
watcherSizeMessage
);
}
}
// send to other players
// send to other players
this
.
allPlayers
if
(
isPlayer
)
{
.
filter
((
p
)
=>
p
!==
client
)
this
.
allPlayers
.
forEach
((
p
)
=>
{
.
filter
((
p
)
=>
p
!==
client
)
p
.
send
(
client
.
prepareEnterPacket
());
.
forEach
((
p
)
=>
{
});
p
.
send
(
client
.
prepareEnterPacket
());
});
}
else
if
(
this
.
watchers
.
size
&&
this
.
duelStage
===
DuelStage
.
Begin
)
{
client
.
send
(
this
.
watcherSizeMessage
);
}
await
this
.
ctx
.
dispatch
(
new
OnRoomJoin
(
this
),
client
);
await
this
.
ctx
.
dispatch
(
new
OnRoomJoin
(
this
),
client
);
...
@@ -338,6 +356,11 @@ export class Room {
...
@@ -338,6 +356,11 @@ export class Room {
}
else
{
}
else
{
await
this
.
ctx
.
dispatch
(
new
OnRoomJoinObserver
(
this
),
client
);
await
this
.
ctx
.
dispatch
(
new
OnRoomJoinObserver
(
this
),
client
);
}
}
if
(
this
.
duelStage
!==
DuelStage
.
Begin
)
{
this
.
sendPostWatchMessages
(
client
);
}
return
undefined
;
return
undefined
;
}
}
...
@@ -1471,7 +1494,7 @@ export class Room {
...
@@ -1471,7 +1494,7 @@ export class Room {
.
middleware
(
YGOProMsgBase
,
async
(
message
,
next
)
=>
{
.
middleware
(
YGOProMsgBase
,
async
(
message
,
next
)
=>
{
// record messages for replay
// record messages for replay
if
(
!
(
message
instanceof
YGOProMsgResponseBase
))
{
if
(
!
(
message
instanceof
YGOProMsgResponseBase
))
{
this
.
lastDuelRecord
.
m
essages
.
push
(
message
);
this
.
lastDuelRecord
.
watchM
essages
.
push
(
message
);
}
}
return
next
();
return
next
();
})
})
...
...
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