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