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
04548ae3
Commit
04548ae3
authored
Sep 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
e6c4ec4a
Pipeline
#23637
passed with stages
in 16 minutes and 4 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
17 deletions
+60
-17
neos.config.json
neos.config.json
+6
-1
neos.config.prod.json
neos.config.prod.json
+6
-1
src/ui/Match/WatchModal.tsx
src/ui/Match/WatchModal.tsx
+4
-2
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+44
-13
No files found.
neos.config.json
View file @
04548ae3
...
@@ -5,6 +5,11 @@
...
@@ -5,6 +5,11 @@
"name"
:
"koishi"
,
"name"
:
"koishi"
,
"ip"
:
"koishi.momobako.com"
,
"ip"
:
"koishi.momobako.com"
,
"port"
:
"7211"
"port"
:
"7211"
},
{
"name"
:
"mycard"
,
"ip"
:
"tiramisu.moecube.com"
,
"port"
:
"7912"
}
}
],
],
"assetsPath"
:
"/neos-assets"
,
"assetsPath"
:
"/neos-assets"
,
...
@@ -18,7 +23,7 @@
...
@@ -18,7 +23,7 @@
"profileUrl"
:
"https://accounts.moecube.com/profiles"
,
"profileUrl"
:
"https://accounts.moecube.com/profiles"
,
"athleticWatchUrl"
:
"wss://tiramisu.moecube.com:8923"
,
"athleticWatchUrl"
:
"wss://tiramisu.moecube.com:8923"
,
"entertainWatchUrl"
:
"wss://tiramisu.moecube.com:7923"
,
"entertainWatchUrl"
:
"wss://tiramisu.moecube.com:7923"
,
"avatarApi"
:
"https://sapi.moecube.com:444/avatar/avatar/{username}/120/1.png"
,
"avatarApi"
:
"https://sapi.moecube.com:444/avatar/avatar/{username}/120/1.png"
,
"streamInterval"
:
20
,
"streamInterval"
:
20
,
"startDelay"
:
1000
,
"startDelay"
:
1000
,
"ui"
:{
"ui"
:{
...
...
neos.config.prod.json
View file @
04548ae3
...
@@ -5,6 +5,11 @@
...
@@ -5,6 +5,11 @@
"name"
:
"koishi"
,
"name"
:
"koishi"
,
"ip"
:
"koishi.momobako.com"
,
"ip"
:
"koishi.momobako.com"
,
"port"
:
"7211"
"port"
:
"7211"
},
{
"name"
:
"mycard"
,
"ip"
:
"tiramisu.moecube.com"
,
"port"
:
"7912"
}
}
],
],
"assetsPath"
:
"/neos-assets"
,
"assetsPath"
:
"/neos-assets"
,
...
@@ -18,7 +23,7 @@
...
@@ -18,7 +23,7 @@
"profileUrl"
:
"https://accounts.moecube.com/profiles"
,
"profileUrl"
:
"https://accounts.moecube.com/profiles"
,
"athleticWatchUrl"
:
"wss://tiramisu.moecube.com:8923"
,
"athleticWatchUrl"
:
"wss://tiramisu.moecube.com:8923"
,
"entertainWatchUrl"
:
"wss://tiramisu.moecube.com:7923"
,
"entertainWatchUrl"
:
"wss://tiramisu.moecube.com:7923"
,
"avatarApi"
:
"https://sapi.moecube.com:444/avatar/avatar/{username}/120/1.png"
,
"avatarApi"
:
"https://sapi.moecube.com:444/avatar/avatar/{username}/120/1.png"
,
"streamInterval"
:
20
,
"streamInterval"
:
20
,
"startDelay"
:
1000
,
"startDelay"
:
1000
,
"ui"
:{
"ui"
:{
...
...
src/ui/Match/WatchModal.tsx
View file @
04548ae3
...
@@ -33,7 +33,9 @@ interface Options {
...
@@ -33,7 +33,9 @@ interface Options {
auto_death
:
boolean
;
auto_death
:
boolean
;
}
}
export
const
WatchModal
:
React
.
FC
=
()
=>
{
export
const
WatchContent
:
React
.
FC
<
{
setWatchPasswd
:
React
.
Dispatch
<
React
.
SetStateAction
<
string
|
undefined
>>
;
}
>
=
({
setWatchPasswd
})
=>
{
const
[
rooms
,
setRooms
]
=
useState
<
Room
[]
>
([]);
const
[
rooms
,
setRooms
]
=
useState
<
Room
[]
>
([]);
const
{
message
}
=
App
.
useApp
();
const
{
message
}
=
App
.
useApp
();
const
url
=
new
URL
(
athleticWatchUrl
);
const
url
=
new
URL
(
athleticWatchUrl
);
...
@@ -99,7 +101,7 @@ export const WatchModal: React.FC = () => {
...
@@ -99,7 +101,7 @@ export const WatchModal: React.FC = () => {
}
}
}
}
dataSource=
{
rooms
}
dataSource=
{
rooms
}
renderItem=
{
(
room
)
=>
(
renderItem=
{
(
room
)
=>
(
<
List
.
Item
key=
{
room
.
id
}
>
<
List
.
Item
key=
{
room
.
id
}
onClick=
{
()
=>
setWatchPasswd
(
room
.
id
)
}
>
<
List
.
Item
.
Meta
<
List
.
Item
.
Meta
avatar=
{
avatar=
{
<
Avatar
<
Avatar
...
...
src/ui/Match/index.tsx
View file @
04548ae3
...
@@ -18,9 +18,9 @@ import styles from "./index.module.scss";
...
@@ -18,9 +18,9 @@ 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
{
connectSrvpro
}
from
"
./util
"
;
import
{
connectSrvpro
}
from
"
./util
"
;
import
{
Watch
Modal
}
from
"
./WatchModal
"
;
import
{
Watch
Content
}
from
"
./WatchModal
"
;
const
NeosConfig
=
useConfig
();
const
{
servers
:
serverList
}
=
useConfig
();
export
const
loader
:
LoaderFunction
=
()
=>
{
export
const
loader
:
LoaderFunction
=
()
=>
{
// 在加载这个页面之前先重置一些store,清掉上局游戏遗留的数据
// 在加载这个页面之前先重置一些store,清掉上局游戏遗留的数据
...
@@ -30,7 +30,6 @@ export const loader: LoaderFunction = () => {
...
@@ -30,7 +30,6 @@ export const loader: LoaderFunction = () => {
export
const
Component
:
React
.
FC
=
()
=>
{
export
const
Component
:
React
.
FC
=
()
=>
{
const
{
message
,
modal
}
=
App
.
useApp
();
const
{
message
,
modal
}
=
App
.
useApp
();
const
serverList
=
NeosConfig
.
servers
;
const
server
=
`
${
serverList
[
0
].
ip
}
:
${
serverList
[
0
].
port
}
`
;
const
server
=
`
${
serverList
[
0
].
ip
}
:
${
serverList
[
0
].
port
}
`
;
const
{
decks
}
=
deckStore
;
const
{
decks
}
=
deckStore
;
const
[
deckName
,
setDeckName
]
=
useState
(
decks
.
at
(
0
)?.
deckName
??
""
);
const
[
deckName
,
setDeckName
]
=
useState
(
decks
.
at
(
0
)?.
deckName
??
""
);
...
@@ -38,6 +37,8 @@ export const Component: React.FC = () => {
...
@@ -38,6 +37,8 @@ export const Component: React.FC = () => {
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
[
matchLoading
,
setMatchLoading
]
=
useState
(
false
);
// 匹配模式的loading状态
const
[
watchLoading
,
setWatchLoading
]
=
useState
(
false
);
// 观战模式的loading状态
const
[
watchPasswd
,
setWatchPasswd
]
=
useState
<
string
|
undefined
>
(
undefined
);
const
navigate
=
useNavigate
();
const
navigate
=
useNavigate
();
// 竞技匹配
// 竞技匹配
...
@@ -63,6 +64,43 @@ export const Component: React.FC = () => {
...
@@ -63,6 +64,43 @@ export const Component: React.FC = () => {
}
}
};
};
// MC观战
const
onMCWatch
=
()
=>
{
if
(
!
user
)
{
message
.
error
(
"
请先登录萌卡账号
"
);
}
else
{
modal
.
info
({
icon
:
null
,
okText
:
"
进入观战
"
,
onOk
:
async
()
=>
{
if
(
watchPasswd
)
{
setWatchLoading
(
true
);
const
mcServer
=
serverList
.
find
(
(
server
)
=>
server
.
name
===
"
mycard
"
,
);
if
(
mcServer
)
{
await
connectSrvpro
({
ip
:
mcServer
.
ip
+
"
:
"
+
mcServer
.
port
,
player
:
user
.
username
,
passWd
:
watchPasswd
,
});
}
else
{
message
.
error
(
"
Something unexpected happened, please contact <ccc@neos.moe> to fix
"
,
);
}
}
else
{
message
.
error
(
"
请选择观战的房间
"
);
}
},
centered
:
true
,
maskClosable
:
true
,
content
:
<
WatchContent
setWatchPasswd=
{
setWatchPasswd
}
/>,
});
}
};
// 单人模式
// 单人模式
const
onAIMatch
=
async
()
=>
{
const
onAIMatch
=
async
()
=>
{
setSingleLoading
(
true
);
setSingleLoading
(
true
);
...
@@ -82,6 +120,7 @@ export const Component: React.FC = () => {
...
@@ -82,6 +120,7 @@ export const Component: React.FC = () => {
if
(
joined
)
{
if
(
joined
)
{
setSingleLoading
(
false
);
setSingleLoading
(
false
);
setMatchLoading
(
false
);
setMatchLoading
(
false
);
setWatchLoading
(
false
);
navigate
(
`/waitroom`
);
navigate
(
`/waitroom`
);
}
}
},
[
joined
]);
},
[
joined
]);
...
@@ -142,16 +181,8 @@ export const Component: React.FC = () => {
...
@@ -142,16 +181,8 @@ export const Component: React.FC = () => {
<
Mode
<
Mode
title=
"MC观战列表"
title=
"MC观战列表"
desc=
"观看萌卡MyCard上正在进行的决斗。"
desc=
"观看萌卡MyCard上正在进行的决斗。"
icon=
{
<
PlayCircleFilled
/>
}
icon=
{
watchLoading
?
<
LoadingOutlined
/>
:
<
PlayCircleFilled
/>
}
onClick=
{
()
=>
onClick=
{
onMCWatch
}
modal
.
info
({
icon
:
null
,
footer
:
<></>,
centered
:
true
,
maskClosable
:
true
,
content
:
<
WatchModal
/>,
})
}
/>
/>
<
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