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
734de2d9
Commit
734de2d9
authored
Aug 07, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update NewMatch
parent
4427068c
Pipeline
#22950
passed with stages
in 14 minutes and 5 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
16 deletions
+60
-16
neos.config.json
neos.config.json
+1
-0
neos.config.prod.json
neos.config.prod.json
+1
-0
src/ui/NewMatch/index.tsx
src/ui/NewMatch/index.tsx
+58
-16
No files found.
neos.config.json
View file @
734de2d9
...
...
@@ -2,6 +2,7 @@
"version"
:
4960
,
"servers"
:[
{
"name"
:
"koishi"
,
"ip"
:
"koishi.momobako.com"
,
"port"
:
"7211"
}
...
...
neos.config.prod.json
View file @
734de2d9
...
...
@@ -2,6 +2,7 @@
"version"
:
4960
,
"servers"
:[
{
"name"
:
"koishi"
,
"ip"
:
"koishi-r.momobako.com"
,
"port"
:
"7211"
}
...
...
src/ui/NewMatch/index.tsx
View file @
734de2d9
import
{
EditFilled
,
SettingFilled
}
from
"
@ant-design/icons
"
;
import
{
Space
}
from
"
antd
"
;
import
{
type
LoaderFunction
}
from
"
react-router-dom
"
;
import
{
useEffect
,
useState
}
from
"
react
"
;
import
{
type
LoaderFunction
,
useNavigate
}
from
"
react-router-dom
"
;
import
{
useSnapshot
}
from
"
valtio
"
;
import
{
CookieKeys
,
setCookie
}
from
"
@/api
"
;
import
{
accountStore
,
type
User
}
from
"
@/stores
"
;
import
{
useConfig
}
from
"
@/config
"
;
import
{
accountStore
,
deckStore
,
IDeck
,
roomStore
,
type
User
}
from
"
@/stores
"
;
import
{
Background
,
IconFont
,
Select
}
from
"
@/ui/Shared
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
MatchModal
,
matchStore
}
from
"
./MatchModal
"
;
import
{
ReplayModal
,
replayOpen
}
from
"
./ReplayModal
"
;
import
{
init
}
from
"
./util
"
;
export
const
loader
:
LoaderFunction
=
()
=>
{
const
sso
=
new
URLSearchParams
(
location
.
search
).
get
(
"
sso
"
);
...
...
@@ -21,7 +25,26 @@ export const loader: LoaderFunction = () => {
return
null
;
};
const
NeosConfig
=
useConfig
();
export
const
Component
:
React
.
FC
=
()
=>
{
const
serverList
=
NeosConfig
.
servers
;
const
[
server
,
setServer
]
=
useState
(
`
${
serverList
[
0
].
ip
}
:
${
serverList
[
0
].
port
}
`
);
const
{
decks
}
=
useSnapshot
(
deckStore
);
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
const
{
user
}
=
useSnapshot
(
accountStore
);
const
{
joined
}
=
useSnapshot
(
roomStore
);
const
navigate
=
useNavigate
();
useEffect
(()
=>
{
// 人机对战跳转
if
(
joined
)
{
navigate
(
`/waitroom`
);
}
},
[
joined
]);
return
(
<>
<
Background
/>
...
...
@@ -31,26 +54,35 @@ export const Component: React.FC = () => {
<
Select
title=
"服务器"
showSearch
defaultValue=
"lucy"
value=
{
server
}
style=
{
{
width
:
200
}
}
options=
{
[
{
value
:
"
jack
"
,
label
:
"
Jack
"
},
{
value
:
"
lucy
"
,
label
:
"
Lucy
"
},
{
value
:
"
Yiminghe
"
,
label
:
"
yiminghe
"
},
{
value
:
"
disabled
"
,
label
:
"
Disabled
"
,
disabled
:
true
},
]
}
onChange=
{
// @ts-ignore
(
value
)
=>
setServer
(
value
)
}
options=
{
serverList
.
map
((
item
)
=>
({
value
:
`${item.ip}:${item.port}`
,
label
:
item
.
name
,
}))
}
/>
<
Select
title=
"卡组"
showSearch
defaultValue=
"lucy"
value=
{
deck
.
deckName
}
style=
{
{
width
:
200
}
}
options=
{
[
{
value
:
"
jack
"
,
label
:
"
Jack
"
},
{
value
:
"
lucy
"
,
label
:
"
Lucy
"
},
{
value
:
"
Yiminghe
"
,
label
:
"
yiminghe
"
},
{
value
:
"
disabled
"
,
label
:
"
Disabled
"
,
disabled
:
true
},
]
}
onChange=
{
(
value
)
=>
{
// @ts-ignore
const
item
=
deckStore
.
get
(
value
);
if
(
item
)
{
setDeck
(
item
);
}
else
{
alert
(
`Deck ${value} not found`
);
}
}
}
options=
{
decks
.
map
((
deck
)
=>
({
value
:
deck
.
deckName
,
label
:
deck
.
deckName
,
}))
}
/>
</
Space
>
<
div
className=
{
styles
[
"
mode-select
"
]
}
>
...
...
@@ -68,6 +100,16 @@ export const Component: React.FC = () => {
title=
"单人模式"
desc=
"开启与AI的决斗,验证自己的卡组,或者只是打发时间。"
icon=
{
<
IconFont
type=
"icon-chip"
size=
{
26
}
/>
}
onClick=
{
async
()
=>
{
// TODO: 有时间可以做一个Loading
// 初始化,然后等待后端通知成功加入房间后跳转页面
await
init
({
ip
:
server
,
player
:
user
?.
name
??
"
Guest
"
,
passWd
:
"
AI
"
,
});
}
}
/>
<
Mode
title=
"自定义房间"
...
...
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