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
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
love_飞影
Neos
Commits
87d860af
Commit
87d860af
authored
Mar 12, 2024
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle createRoom
parent
d0b02466
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
59 additions
and
7 deletions
+59
-7
neos.config.json
neos.config.json
+5
-0
src/ui/Match/CustomRoomContent/index.tsx
src/ui/Match/CustomRoomContent/index.tsx
+10
-3
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+44
-4
No files found.
neos.config.json
View file @
87d860af
...
...
@@ -10,6 +10,11 @@
"ip"
:
"tiramisu.moecube.com"
,
"port"
:
"8912"
},
{
"name"
:
"mycard-custom"
,
"ip"
:
"tiramisu.moecube.com"
,
"port"
:
"7912"
},
{
"name"
:
"pre-release"
,
"ip"
:
"koishi.momobako.com"
,
...
...
src/ui/Match/CustomRoomContent/index.tsx
View file @
87d860af
...
...
@@ -195,11 +195,18 @@ export const CustomRoomContent: React.FC = () => {
);
};
export
const
CustomRoomFooter
:
React
.
FC
=
()
=>
{
export
const
CustomRoomFooter
:
React
.
FC
<
{
onCreateRoom
:
()
=>
void
;
onJoinRoom
:
()
=>
void
;
}
>
=
({
onCreateRoom
,
onJoinRoom
})
=>
{
return
(
<
div
className=
{
styles
.
footer
}
>
<
Button
className=
{
styles
.
btn
}
>
创建私密房间
</
Button
>
<
Button
className=
{
styles
.
btn
}
>
加入私密房间
</
Button
>
<
Button
className=
{
styles
.
btn
}
onClick=
{
onCreateRoom
}
>
创建私密房间
</
Button
>
<
Button
className=
{
styles
.
btn
}
onClick=
{
onJoinRoom
}
>
加入私密房间
</
Button
>
</
div
>
);
};
src/ui/Match/index.tsx
View file @
87d860af
...
...
@@ -5,17 +5,26 @@ import {
PlayCircleFilled
,
SettingFilled
,
}
from
"
@ant-design/icons
"
;
import
{
App
,
Button
,
Space
}
from
"
antd
"
;
import
{
App
,
Button
,
Modal
,
Space
}
from
"
antd
"
;
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
LoaderFunction
,
useNavigate
}
from
"
react-router-dom
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
getJoinRoomPasswd
,
match
}
from
"
@/api
"
;
import
{
getCreateRoomPasswd
,
getJoinRoomPasswd
,
getPrivateRoomID
,
match
,
}
from
"
@/api
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
accountStore
,
deckStore
,
resetUniverse
,
roomStore
}
from
"
@/stores
"
;
import
{
Background
,
IconFont
,
Select
}
from
"
@/ui/Shared
"
;
import
{
CustomRoomContent
,
CustomRoomFooter
}
from
"
./CustomRoomContent
"
;
import
{
CustomRoomContent
,
CustomRoomFooter
,
mcCustomRoomStore
,
}
from
"
./CustomRoomContent
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
MatchModal
,
matchStore
}
from
"
./MatchModal
"
;
import
{
ReplayModal
,
replayOpen
}
from
"
./ReplayModal
"
;
...
...
@@ -37,6 +46,7 @@ export const Component: React.FC = () => {
const
[
deckName
,
setDeckName
]
=
useState
(
decks
.
at
(
0
)?.
deckName
??
""
);
const
user
=
accountStore
.
user
;
const
{
joined
}
=
useSnapshot
(
roomStore
);
const
{
options
,
friendPrivateID
}
=
mcCustomRoomStore
;
const
[
singleLoading
,
setSingleLoading
]
=
useState
(
false
);
// 单人模式的loading状态
const
[
athleticMatchLoading
,
setAthleticMatchLoading
]
=
useState
(
false
);
// 竞技匹配的loading状态
const
[
entertainMatchLoading
,
setEntertainMatchLoading
]
=
useState
(
false
);
// 娱乐匹配的loading状态
...
...
@@ -81,11 +91,40 @@ export const Component: React.FC = () => {
centered
:
true
,
maskClosable
:
true
,
content
:
<
CustomRoomContent
/>,
footer
:
<
CustomRoomFooter
/>,
footer
:
(
<
CustomRoomFooter
onCreateRoom=
{
onCreateMCRoom
}
onJoinRoom=
{
onJoinMCRoom
}
/>
),
});
}
};
// 创建MC自定义房间
const
onCreateMCRoom
=
async
()
=>
{
if
(
user
)
{
const
mcServer
=
serverList
.
find
(
(
server
)
=>
server
.
name
===
"
mycard-custom
"
,
);
if
(
mcServer
)
{
const
passWd
=
getCreateRoomPasswd
(
options
,
String
(
getPrivateRoomID
(
user
.
external_id
)),
user
.
external_id
,
true
,
);
await
connectSrvpro
({
ip
:
mcServer
.
ip
+
"
:
"
+
mcServer
.
port
,
player
:
user
.
username
,
passWd
,
});
}
}
};
// 加入MC自定义房间
const
onJoinMCRoom
=
()
=>
{};
// MC观战
const
onMCWatch
=
()
=>
{
if
(
!
user
)
{
...
...
@@ -150,6 +189,7 @@ export const Component: React.FC = () => {
setAthleticMatchLoading
(
false
);
setEntertainMatchLoading
(
false
);
setWatchLoading
(
false
);
Modal
.
destroyAll
();
// 销毁当前所有modal
navigate
(
`/waitroom`
);
}
},
[
joined
]);
...
...
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