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
0b0587df
Commit
0b0587df
authored
Nov 20, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable athletics match
parent
5eb16f3d
Pipeline
#24103
passed with stages
in 15 minutes and 22 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
src/api/mycard/match.ts
src/api/mycard/match.ts
+1
-1
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+24
-11
No files found.
src/api/mycard/match.ts
View file @
0b0587df
...
@@ -9,7 +9,7 @@ export interface MatchInfo {
...
@@ -9,7 +9,7 @@ export interface MatchInfo {
export
async
function
match
(
export
async
function
match
(
username
:
string
,
username
:
string
,
extraId
:
number
,
extraId
:
number
,
arena
:
string
=
"
entertain
"
,
arena
:
"
athletic
"
|
"
entertain
"
=
"
entertain
"
,
):
Promise
<
MatchInfo
|
undefined
>
{
):
Promise
<
MatchInfo
|
undefined
>
{
const
headers
=
{
const
headers
=
{
Authorization
:
"
Basic
"
+
customBase64Encode
(
username
+
"
:
"
+
extraId
),
Authorization
:
"
Basic
"
+
customBase64Encode
(
username
+
"
:
"
+
extraId
),
...
...
src/ui/Match/index.tsx
View file @
0b0587df
...
@@ -36,20 +36,20 @@ export const Component: React.FC = () => {
...
@@ -36,20 +36,20 @@ export const Component: React.FC = () => {
const
user
=
accountStore
.
user
;
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
);
// 匹配模式的loading状态
const
[
athleticMatchLoading
,
setAthleticMatchLoading
]
=
useState
(
false
);
// 竞技匹配的loading状态
const
[
entertainMatchLoading
,
setEntertainMatchLoading
]
=
useState
(
false
);
// 娱乐匹配的loading状态
const
[
watchLoading
,
setWatchLoading
]
=
useState
(
false
);
// 观战模式的loading状态
const
[
watchLoading
,
setWatchLoading
]
=
useState
(
false
);
// 观战模式的loading状态
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
// 竞技匹配
// 匹配
const
onCompetitiveMatch
=
()
=>
message
.
error
(
"
暂未开放,敬请期待
"
);
const
onMatch
=
async
(
arena
:
"
athletic
"
|
"
entertain
"
)
=>
{
// 娱乐匹配
const
onEntertainMatch
=
async
()
=>
{
if
(
!
user
)
{
if
(
!
user
)
{
message
.
error
(
"
请先登录萌卡账号
"
);
message
.
error
(
"
请先登录萌卡账号
"
);
}
else
{
}
else
{
setMatchLoading
(
true
);
arena
===
"
athletic
"
const
matchInfo
=
await
match
(
user
.
username
,
user
.
external_id
);
?
setAthleticMatchLoading
(
true
)
:
setEntertainMatchLoading
(
true
);
const
matchInfo
=
await
match
(
user
.
username
,
user
.
external_id
,
arena
);
if
(
matchInfo
)
{
if
(
matchInfo
)
{
await
connectSrvpro
({
await
connectSrvpro
({
...
@@ -63,6 +63,12 @@ export const Component: React.FC = () => {
...
@@ -63,6 +63,12 @@ export const Component: React.FC = () => {
}
}
};
};
// 竞技匹配
const
onCompetitiveMatch
=
async
()
=>
await
onMatch
(
"
athletic
"
);
// 娱乐匹配
const
onEntertainMatch
=
async
()
=>
await
onMatch
(
"
entertain
"
);
// MC观战
// MC观战
const
onMCWatch
=
()
=>
{
const
onMCWatch
=
()
=>
{
if
(
!
user
)
{
if
(
!
user
)
{
...
@@ -121,7 +127,8 @@ export const Component: React.FC = () => {
...
@@ -121,7 +127,8 @@ export const Component: React.FC = () => {
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
joined
)
{
if
(
joined
)
{
setSingleLoading
(
false
);
setSingleLoading
(
false
);
setMatchLoading
(
false
);
setAthleticMatchLoading
(
false
);
setEntertainMatchLoading
(
false
);
setWatchLoading
(
false
);
setWatchLoading
(
false
);
navigate
(
`/waitroom`
);
navigate
(
`/waitroom`
);
}
}
...
@@ -165,14 +172,20 @@ export const Component: React.FC = () => {
...
@@ -165,14 +172,20 @@ export const Component: React.FC = () => {
<
Mode
<
Mode
title=
"MC竞技匹配"
title=
"MC竞技匹配"
desc=
"与MyCard天梯其他数万名玩家激战,力争最强。每月最后一天22点结算,公布排名并获取奖励。"
desc=
"与MyCard天梯其他数万名玩家激战,力争最强。每月最后一天22点结算,公布排名并获取奖励。"
icon=
{
<
IconFont
type=
"icon-battle"
size=
{
32
}
/>
}
icon=
{
athleticMatchLoading
?
(
<
LoadingOutlined
/>
)
:
(
<
IconFont
type=
"icon-battle"
size=
{
32
}
/>
)
}
onClick=
{
onCompetitiveMatch
}
onClick=
{
onCompetitiveMatch
}
/>
/>
<
Mode
<
Mode
title=
"MC娱乐匹配"
title=
"MC娱乐匹配"
desc=
"暂且搁置胜负,享受决斗的乐趣。过去一周竞技匹配使用数最多的20个卡组将被禁用。"
desc=
"暂且搁置胜负,享受决斗的乐趣。过去一周竞技匹配使用数最多的20个卡组将被禁用。"
icon=
{
icon=
{
m
atchLoading
?
(
entertainM
atchLoading
?
(
<
LoadingOutlined
/>
<
LoadingOutlined
/>
)
:
(
)
:
(
<
IconFont
type=
"icon-coffee"
size=
{
28
}
/>
<
IconFont
type=
"icon-coffee"
size=
{
28
}
/>
...
...
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