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
3159c733
Commit
3159c733
authored
Aug 19, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update Match.tsx
parent
405944be
Pipeline
#23206
passed with stages
in 11 minutes and 7 seconds
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
35 deletions
+47
-35
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+47
-35
No files found.
src/ui/Match/index.tsx
View file @
3159c733
...
@@ -29,12 +29,53 @@ export const Component: React.FC = () => {
...
@@ -29,12 +29,53 @@ export const Component: React.FC = () => {
);
);
const
{
decks
}
=
useSnapshot
(
deckStore
);
const
{
decks
}
=
useSnapshot
(
deckStore
);
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
const
[
deck
,
setDeck
]
=
useState
<
IDeck
>
(
JSON
.
parse
(
JSON
.
stringify
(
decks
[
0
])));
const
{
user
}
=
useSnapshot
(
accountStore
)
;
const
user
=
accountStore
.
user
;
const
{
joined
}
=
useSnapshot
(
roomStore
);
const
{
joined
}
=
useSnapshot
(
roomStore
);
const
[
singleLoading
,
setSingleLoading
]
=
useState
(
false
);
// 单人模式的loading状态
const
[
singleLoading
,
setSingleLoading
]
=
useState
(
false
);
// 单人模式的loading状态
const
[
matchLoading
,
setMatchLoading
]
=
useState
(
false
);
const
[
matchLoading
,
setMatchLoading
]
=
useState
(
false
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
// 竞技匹配
const
onCompetitiveMatch
=
()
=>
message
.
error
(
"
暂未开放,敬请期待
"
);
// 娱乐匹配
const
onEntertainMatch
=
async
()
=>
{
if
(
!
user
)
{
message
.
error
(
"
请先登录萌卡账号
"
);
}
else
{
setMatchLoading
(
true
);
const
matchInfo
=
await
match
(
user
.
username
,
user
.
external_id
);
if
(
matchInfo
)
{
await
connectSrvpro
({
ip
:
matchInfo
.
address
+
"
:
"
+
(
matchInfo
.
port
+
1
),
player
:
user
.
username
,
passWd
:
matchInfo
.
password
,
});
}
else
{
message
.
error
(
"
匹配失败T_T
"
);
}
}
};
// 单人模式
const
onAIMatch
=
async
()
=>
{
setSingleLoading
(
true
);
// 初始化,然后等待后端通知成功加入房间后跳转页面
await
connectSrvpro
({
ip
:
server
,
player
:
user
?.
name
??
"
Guest
"
,
passWd
:
"
AI
"
,
});
};
// 自定义房间
const
onCustomRoom
=
()
=>
(
matchStore
.
open
=
true
);
// 观战列表
const
onWatchList
=
()
=>
message
.
error
(
"
开发中,敬请期待
"
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
joined
)
{
if
(
joined
)
{
setSingleLoading
(
false
);
setSingleLoading
(
false
);
...
@@ -95,7 +136,7 @@ export const Component: React.FC = () => {
...
@@ -95,7 +136,7 @@ export const Component: React.FC = () => {
title=
"竞技匹配"
title=
"竞技匹配"
desc=
"与天梯其他数万名玩家激战,追求胜利登顶最强。每月最后一天晚上10点结算成绩,获取奖励与公布排名。"
desc=
"与天梯其他数万名玩家激战,追求胜利登顶最强。每月最后一天晚上10点结算成绩,获取奖励与公布排名。"
icon=
{
<
IconFont
type=
"icon-battle"
size=
{
32
}
/>
}
icon=
{
<
IconFont
type=
"icon-battle"
size=
{
32
}
/>
}
onClick=
{
()
=>
message
.
error
(
"
开发中,敬请期待
"
)
}
onClick=
{
onCompetitiveMatch
}
/>
/>
<
Mode
<
Mode
title=
"娱乐匹配"
title=
"娱乐匹配"
...
@@ -107,27 +148,7 @@ export const Component: React.FC = () => {
...
@@ -107,27 +148,7 @@ export const Component: React.FC = () => {
<
IconFont
type=
"icon-coffee"
size=
{
28
}
/>
<
IconFont
type=
"icon-coffee"
size=
{
28
}
/>
)
)
}
}
onClick=
{
async
()
=>
{
onClick=
{
onEntertainMatch
}
if
(
!
user
)
{
message
.
error
(
"
请先登录萌卡账号
"
);
}
else
{
setMatchLoading
(
true
);
const
matchInfo
=
await
match
(
user
.
username
,
user
.
external_id
,
);
if
(
matchInfo
)
{
await
connectSrvpro
({
ip
:
matchInfo
.
address
+
"
:
"
+
(
matchInfo
.
port
+
1
),
player
:
user
.
username
,
passWd
:
matchInfo
.
password
,
});
}
else
{
message
.
error
(
"
匹配失败T_T
"
);
}
}
}
}
/>
/>
<
Mode
<
Mode
title=
"单人模式"
title=
"单人模式"
...
@@ -139,22 +160,13 @@ export const Component: React.FC = () => {
...
@@ -139,22 +160,13 @@ export const Component: React.FC = () => {
<
IconFont
type=
"icon-chip"
size=
{
26
}
/>
<
IconFont
type=
"icon-chip"
size=
{
26
}
/>
)
)
}
}
onClick=
{
async
()
=>
{
onClick=
{
onAIMatch
}
setSingleLoading
(
true
);
// 初始化,然后等待后端通知成功加入房间后跳转页面
await
connectSrvpro
({
ip
:
server
,
player
:
user
?.
name
??
"
Guest
"
,
passWd
:
"
AI
"
,
});
}
}
/>
/>
<
Mode
<
Mode
title=
"自定义房间"
title=
"自定义房间"
desc=
"创建双打TAG或自定义规则的房间,或与好友约战,甚至举办竞技比赛。"
desc=
"创建双打TAG或自定义规则的房间,或与好友约战,甚至举办竞技比赛。"
icon=
{
<
SettingFilled
/>
}
icon=
{
<
SettingFilled
/>
}
onClick=
{
()
=>
(
matchStore
.
open
=
true
)
}
onClick=
{
onCustomRoom
}
/>
/>
<
Mode
<
Mode
title=
"录像回放"
title=
"录像回放"
...
@@ -166,7 +178,7 @@ export const Component: React.FC = () => {
...
@@ -166,7 +178,7 @@ export const Component: React.FC = () => {
title=
"观战列表"
title=
"观战列表"
desc=
"观看MyCard上正在进行的决斗"
desc=
"观看MyCard上正在进行的决斗"
icon=
{
<
PlayCircleOutlined
/>
}
icon=
{
<
PlayCircleOutlined
/>
}
onClick=
{
()
=>
message
.
error
(
"
开发中,敬请期待
"
)
}
onClick=
{
onWatchList
}
/>
/>
</
div
>
</
div
>
</
div
>
</
div
>
...
...
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