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
6ae9cd3b
Commit
6ae9cd3b
authored
Aug 13, 2023
by
timel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev/sort-in-deck' into 'main'
feat: sort more naturally See merge request
!257
parents
df5d859d
ab07addb
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
src/common.ts
src/common.ts
+19
-0
src/ui/BuildDeck/utils.ts
src/ui/BuildDeck/utils.ts
+4
-1
No files found.
src/common.ts
View file @
6ae9cd3b
...
...
@@ -113,6 +113,25 @@ export function tellCardBasicType(typeCode: number): number {
return
basicTypes
.
reduce
((
acc
,
cur
)
=>
(
acc
|
cur
)
&
typeCode
,
0
);
}
/** 获取更加细分的分类 */
export
function
tellCardSecondaryType
(
typeCode
:
number
):
number
{
const
secondaryType
=
[
TYPE_NORMAL
,
TYPE_FUSION
,
TYPE_RITUAL
,
TYPE_SYNCHRO
,
TYPE_XYZ
,
TYPE_PENDULUM
,
TYPE_LINK
,
TYPE_QUICKPLAY
,
TYPE_CONTINUOUS
,
TYPE_EQUIP
,
TYPE_FIELD
,
TYPE_COUNTER
,
];
return
secondaryType
.
reduce
((
acc
,
cur
)
=>
(
acc
|
cur
)
&
typeCode
,
0
);
}
/** 是不是衍生物 */
export
function
isToken
(
typeCode
:
number
):
boolean
{
return
(
typeCode
&
TYPE_TOKEN
)
>
0
;
...
...
src/ui/BuildDeck/utils.ts
View file @
6ae9cd3b
import
{
type
CardMeta
,
fetchCard
}
from
"
@/api
"
;
import
{
tellCardBasicType
}
from
"
@/common
"
;
import
{
tellCardBasicType
,
tellCardSecondaryType
}
from
"
@/common
"
;
import
{
type
IDeck
}
from
"
@/stores
"
;
export
type
Type
=
"
main
"
|
"
extra
"
|
"
side
"
;
...
...
@@ -33,6 +33,9 @@ export const compareCards = (a: CardMeta, b: CardMeta): number => {
const
aType
=
tellCardBasicType
(
a
.
data
.
type
??
0
);
const
bType
=
tellCardBasicType
(
b
.
data
.
type
??
0
);
if
(
aType
!==
bType
)
return
aType
-
bType
;
const
aSecondaryType
=
tellCardSecondaryType
(
a
.
data
.
type
??
0
);
const
bSecondaryType
=
tellCardSecondaryType
(
b
.
data
.
type
??
0
);
if
(
aSecondaryType
!==
bSecondaryType
)
return
aSecondaryType
-
bSecondaryType
;
return
a
.
id
-
b
.
id
;
};
...
...
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