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
17fa2913
Commit
17fa2913
authored
Feb 16, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add menu
parent
91dcb148
Pipeline
#43260
failed with stages
in 83 minutes and 56 seconds
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
281 additions
and
284 deletions
+281
-284
src/feats/index.ts
src/feats/index.ts
+1
-0
src/feats/menu-manager.ts
src/feats/menu-manager.ts
+220
-0
src/join-handlers/join-blank-pass-menu.ts
src/join-handlers/join-blank-pass-menu.ts
+58
-283
src/join-handlers/join-handler-module.ts
src/join-handlers/join-handler-module.ts
+2
-1
No files found.
src/feats/index.ts
View file @
17fa2913
export
*
from
'
./client-version-check
'
;
export
*
from
'
./client-version-check
'
;
export
*
from
'
./menu-manager
'
;
export
*
from
'
./welcome
'
;
export
*
from
'
./welcome
'
;
export
*
from
'
./random-duel
'
;
export
*
from
'
./random-duel
'
;
export
*
from
'
./reconnect
'
;
export
*
from
'
./reconnect
'
;
...
...
src/feats/menu-manager.ts
0 → 100644
View file @
17fa2913
import
{
GameMode
,
NetPlayerType
,
YGOProCtosBase
,
YGOProCtosHsToDuelist
,
YGOProCtosKick
,
YGOProStocHsPlayerEnter
,
YGOProStocJoinGame
,
YGOProStocTypeChange
,
}
from
'
ygopro-msg-encode
'
;
import
{
Context
}
from
'
../app
'
;
import
{
Chnroute
,
Client
,
I18nService
}
from
'
../client
'
;
import
{
DefaultHostinfo
}
from
'
../room
'
;
import
{
resolvePanelPageLayout
}
from
'
../utility
'
;
export
type
MenuEntry
=
{
title
:
string
;
callback
:
(
client
:
Client
)
=>
Promise
<
unknown
>
|
unknown
;
};
type
MenuAction
=
|
{
type
:
'
entry
'
;
entry
:
MenuEntry
;
}
|
{
type
:
'
next
'
;
title
:
string
;
offset
:
number
;
}
|
{
type
:
'
prev
'
;
title
:
string
;
offset
:
number
;
};
type
MenuView
=
{
actions
:
MenuAction
[];
mode
:
GameMode
;
slotCount
:
number
;
};
export
class
MenuManager
{
private
i18n
=
this
.
ctx
.
get
(()
=>
I18nService
);
private
chnroute
=
this
.
ctx
.
get
(()
=>
Chnroute
);
constructor
(
private
ctx
:
Context
)
{
this
.
ctx
.
middleware
(
YGOProCtosBase
,
async
(
msg
,
client
,
next
)
=>
{
if
(
!
client
.
currentMenu
)
{
return
next
();
}
if
(
msg
instanceof
YGOProCtosHsToDuelist
||
msg
instanceof
YGOProCtosKick
)
{
return
next
();
}
return
undefined
;
},
true
,
);
this
.
ctx
.
middleware
(
YGOProCtosHsToDuelist
,
async
(
msg
,
client
,
next
)
=>
{
if
(
!
client
.
currentMenu
)
{
return
next
();
}
await
this
.
renderMenu
(
client
);
return
msg
;
});
this
.
ctx
.
middleware
(
YGOProCtosKick
,
async
(
msg
,
client
,
next
)
=>
{
if
(
!
client
.
currentMenu
)
{
return
next
();
}
await
this
.
handleKick
(
client
,
Number
(
msg
.
pos
));
return
undefined
;
});
}
async
launchMenu
(
client
:
Client
,
menu
:
MenuEntry
[])
{
client
.
currentMenu
=
menu
;
if
(
client
.
menuOffset
==
null
)
{
client
.
menuOffset
=
0
;
}
await
this
.
renderMenu
(
client
);
}
clearMenu
(
client
:
Client
)
{
client
.
currentMenu
=
undefined
;
client
.
menuOffset
=
undefined
;
}
private
buildMenuView
(
client
:
Client
):
MenuView
{
const
menu
=
client
.
currentMenu
||
[];
if
(
menu
.
length
<=
2
)
{
return
{
actions
:
menu
.
map
((
entry
)
=>
({
type
:
'
entry
'
,
entry
})),
mode
:
GameMode
.
SINGLE
,
slotCount
:
2
,
};
}
if
(
menu
.
length
<=
4
)
{
return
{
actions
:
menu
.
map
((
entry
)
=>
({
type
:
'
entry
'
,
entry
})),
mode
:
GameMode
.
TAG
,
slotCount
:
4
,
};
}
const
layout
=
resolvePanelPageLayout
(
menu
.
length
,
client
.
menuOffset
||
0
);
client
.
menuOffset
=
layout
.
pageStart
;
const
actions
:
MenuAction
[]
=
[];
if
(
layout
.
isFirstPage
)
{
for
(
const
entry
of
menu
.
slice
(
layout
.
pageStart
,
layout
.
pageStart
+
3
))
{
actions
.
push
({
type
:
'
entry
'
,
entry
});
}
actions
.
push
({
type
:
'
next
'
,
title
:
'
#{menu_next_page}
'
,
offset
:
layout
.
pageStarts
[
layout
.
pageIndex
+
1
],
});
}
else
if
(
layout
.
isLastPage
)
{
actions
.
push
({
type
:
'
prev
'
,
title
:
'
#{menu_prev_page}
'
,
offset
:
layout
.
pageStarts
[
layout
.
pageIndex
-
1
],
});
for
(
const
entry
of
menu
.
slice
(
layout
.
pageStart
,
layout
.
pageStart
+
3
))
{
actions
.
push
({
type
:
'
entry
'
,
entry
});
}
}
else
{
actions
.
push
({
type
:
'
prev
'
,
title
:
'
#{menu_prev_page}
'
,
offset
:
layout
.
pageStarts
[
layout
.
pageIndex
-
1
],
});
for
(
const
entry
of
menu
.
slice
(
layout
.
pageStart
,
layout
.
pageStart
+
2
))
{
actions
.
push
({
type
:
'
entry
'
,
entry
});
}
actions
.
push
({
type
:
'
next
'
,
title
:
'
#{menu_next_page}
'
,
offset
:
layout
.
pageStarts
[
layout
.
pageIndex
+
1
],
});
}
return
{
actions
,
mode
:
GameMode
.
TAG
,
slotCount
:
4
,
};
}
private
async
renderMenu
(
client
:
Client
)
{
if
(
!
client
.
currentMenu
)
{
return
;
}
const
view
=
this
.
buildMenuView
(
client
);
await
client
.
send
(
new
YGOProStocJoinGame
().
fromPartial
({
info
:
{
...
DefaultHostinfo
,
mode
:
view
.
mode
,
},
}),
);
await
client
.
send
(
new
YGOProStocTypeChange
().
fromPartial
({
type
:
NetPlayerType
.
OBSERVER
|
0x10
,
}),
);
const
locale
=
this
.
chnroute
.
getLocale
(
client
.
ip
);
for
(
let
i
=
0
;
i
<
view
.
slotCount
;
i
++
)
{
const
action
=
view
.
actions
[
i
];
const
rawTitle
=
action
?.
type
===
'
entry
'
?
action
.
entry
.
title
:
action
?.
title
||
''
;
const
title
=
rawTitle
?
String
(
await
this
.
i18n
.
translate
(
locale
,
rawTitle
)).
slice
(
0
,
20
)
:
''
;
await
client
.
send
(
new
YGOProStocHsPlayerEnter
().
fromPartial
({
name
:
title
,
pos
:
i
,
}),
);
}
}
private
async
handleKick
(
client
:
Client
,
index
:
number
)
{
if
(
!
client
.
currentMenu
)
{
return
;
}
const
view
=
this
.
buildMenuView
(
client
);
const
selected
=
view
.
actions
[
index
];
if
(
!
selected
)
{
await
this
.
renderMenu
(
client
);
return
;
}
if
(
selected
.
type
===
'
next
'
||
selected
.
type
===
'
prev
'
)
{
client
.
menuOffset
=
selected
.
offset
;
await
this
.
renderMenu
(
client
);
return
;
}
const
callback
=
selected
.
entry
.
callback
;
this
.
clearMenu
(
client
);
await
callback
(
client
);
}
}
declare
module
'
../client
'
{
interface
Client
{
currentMenu
?:
MenuEntry
[];
menuOffset
?:
number
;
}
}
src/join-handlers/join-blank-pass-menu.ts
View file @
17fa2913
This diff is collapsed.
Click to expand it.
src/join-handlers/join-handler-module.ts
View file @
17fa2913
import
{
createAppContext
}
from
'
nfkit
'
;
import
{
createAppContext
}
from
'
nfkit
'
;
import
{
ContextState
}
from
'
../app
'
;
import
{
ContextState
}
from
'
../app
'
;
import
{
ClientVersionCheck
}
from
'
../feats
'
;
import
{
ClientVersionCheck
,
MenuManager
}
from
'
../feats
'
;
import
{
JoinWindbotAi
,
JoinWindbotToken
}
from
'
../feats/windbot
'
;
import
{
JoinWindbotAi
,
JoinWindbotToken
}
from
'
../feats/windbot
'
;
import
{
JoinRoom
}
from
'
./join-room
'
;
import
{
JoinRoom
}
from
'
./join-room
'
;
import
{
JoinFallback
}
from
'
./fallback
'
;
import
{
JoinFallback
}
from
'
./fallback
'
;
...
@@ -19,6 +19,7 @@ export const JoinHandlerModule = createAppContext<ContextState>()
...
@@ -19,6 +19,7 @@ export const JoinHandlerModule = createAppContext<ContextState>()
.
provide
(
RandomDuelJoinHandler
)
.
provide
(
RandomDuelJoinHandler
)
.
provide
(
JoinWindbotAi
)
.
provide
(
JoinWindbotAi
)
.
provide
(
JoinRoom
)
.
provide
(
JoinRoom
)
.
provide
(
MenuManager
)
.
provide
(
JoinBlankPassMenu
)
.
provide
(
JoinBlankPassMenu
)
.
provide
(
JoinBlankPassRandomDuel
)
.
provide
(
JoinBlankPassRandomDuel
)
.
provide
(
JoinBlankPassWindbotAi
)
.
provide
(
JoinBlankPassWindbotAi
)
...
...
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