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
1b32d903
Commit
1b32d903
authored
Aug 13, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: download ydk
parent
e1541134
Pipeline
#23063
passed with stages
in 12 minutes and 37 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
3 deletions
+38
-3
src/ui/BuildDeck/DeckSelect.tsx
src/ui/BuildDeck/DeckSelect.tsx
+1
-1
src/ui/BuildDeck/index.tsx
src/ui/BuildDeck/index.tsx
+12
-2
src/ui/BuildDeck/utils.ts
src/ui/BuildDeck/utils.ts
+23
-0
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+2
-0
No files found.
src/ui/BuildDeck/DeckSelect.tsx
View file @
1b32d903
...
...
@@ -163,7 +163,7 @@ const DeckUploader: React.FC<{ onLoaded: (deck: IDeck) => void }> = ({
)
) {
// YDK解析成功
onLoaded
({
deckName
:
file
.
name
,
...
deck
});
onLoaded({ deckName: file.name
.replace(/\.ydk/g, "")
, ...deck });
} else {
alert(`${file.name}解析失败,请检查格式是否正确。`);
setUploadState("ERROR");
...
...
src/ui/BuildDeck/index.tsx
View file @
1b32d903
...
...
@@ -43,7 +43,12 @@ import { DeckSelect } from "./DeckSelect";
import
{
Filter
}
from
"
./Filter
"
;
import
styles
from
"
./index.module.scss
"
;
import
{
editDeckStore
}
from
"
./store
"
;
import
{
editingDeckToIDeck
,
iDeckToEditingDeck
,
type
Type
}
from
"
./utils
"
;
import
{
downloadDeckAsYDK
,
editingDeckToIDeck
,
iDeckToEditingDeck
,
type
Type
,
}
from
"
./utils
"
;
export
const
loader
:
LoaderFunction
=
async
()
=>
{
// 必须先加载卡组,不然页面会崩溃
...
...
@@ -97,7 +102,12 @@ export const Component: React.FC = () => {
setSelectedDeck
(
deckStore
.
get
(
name
)
??
deckStore
.
decks
[
0
])
}
onDelete=
{
async
(
name
)
=>
await
deckStore
.
delete
(
name
)
}
onDownload=
{
(
id
)
=>
console
.
log
(
id
)
}
onDownload=
{
(
name
)
=>
{
const
deck
=
deckStore
.
get
(
name
);
if
(
deck
)
{
downloadDeckAsYDK
(
deck
);
}
}
}
onAdd=
{
()
=>
console
.
log
(
"
add
"
)
}
/>
</
ScrollableArea
>
...
...
src/ui/BuildDeck/utils.ts
View file @
1b32d903
...
...
@@ -35,3 +35,26 @@ export const compareCards = (a: CardMeta, b: CardMeta): number => {
if
(
aType
!==
bType
)
return
aType
-
bType
;
return
a
.
id
-
b
.
id
;
};
/** 下载卡组YDK文件 **/
export
function
downloadDeckAsYDK
(
deck
:
IDeck
)
{
const
lines
:
string
[]
=
[];
lines
.
push
(
"
#created by neos
"
);
lines
.
push
(
"
#main
"
);
lines
.
push
(...
deck
.
main
.
map
((
cardId
)
=>
cardId
.
toString
()));
lines
.
push
(
"
#extra
"
);
lines
.
push
(...
deck
.
extra
.
map
((
cardId
)
=>
cardId
.
toString
()));
lines
.
push
(
"
!side
"
);
lines
.
push
(...
deck
.
side
.
map
((
cardId
)
=>
cardId
.
toString
()));
const
text
=
lines
.
join
(
"
\n
"
);
const
blob
=
new
Blob
([
text
],
{
type
:
"
text/plain
"
});
const
url
=
URL
.
createObjectURL
(
blob
);
const
a
=
document
.
createElement
(
"
a
"
);
a
.
href
=
url
;
a
.
download
=
deck
.
deckName
+
"
.ydk
"
;
a
.
click
();
URL
.
revokeObjectURL
(
url
);
}
src/ui/Match/index.tsx
View file @
1b32d903
...
...
@@ -78,11 +78,13 @@ export const Component: React.FC = () => {
title=
"竞技匹配"
desc=
"与世界上其他玩家在线匹配,您的排名将实时显示在排行榜上。"
icon=
{
<
IconFont
type=
"icon-battle"
size=
{
32
}
/>
}
onClick=
{
()
=>
alert
(
"
开发中,敬请期待
"
)
}
/>
<
Mode
title=
"休闲匹配"
desc=
"使用任意卡组进行对战,将胜负暂且搁置,尽情享受决斗的乐趣。"
icon=
{
<
IconFont
type=
"icon-coffee"
size=
{
28
}
/>
}
onClick=
{
()
=>
alert
(
"
开发中,敬请期待
"
)
}
/>
<
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