Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
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
xiaoye
mycard
Commits
61d0a2f8
Commit
61d0a2f8
authored
Sep 12, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finish
parent
2694f95c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
8 deletions
+31
-8
src/app/ygopro/ygopro.component.html
src/app/ygopro/ygopro.component.html
+2
-2
src/app/ygopro/ygopro.component.ts
src/app/ygopro/ygopro.component.ts
+29
-6
No files found.
src/app/ygopro/ygopro.component.html
View file @
61d0a2f8
...
@@ -26,9 +26,9 @@
...
@@ -26,9 +26,9 @@
</div>
</div>
<div
class=
"col-sm-8 input-group input-group-sm"
>
<div
class=
"col-sm-8 input-group input-group-sm"
>
<label
i18n
class=
"input-group-text"
id=
"basic-addon1"
>
卡组
</label>
<label
i18n
class=
"input-group-text"
id=
"basic-addon1"
>
卡组
</label>
<select
class=
"form-select form-select-sm"
id=
"exampleSelect1"
name=
"deck"
[(ngModel)]=
"currentDeck"
>
<select
class=
"form-select form-select-sm"
id=
"exampleSelect1"
name=
"deck"
[(ngModel)]=
"currentDeck
Symbol"
(change)=
"onDeckChange()
"
>
<optgroup
*ngFor=
"let group of decks_grouped"
[label]=
"group[0] === '.' ? '未分类卡组' : group[0]"
>
<optgroup
*ngFor=
"let group of decks_grouped"
[label]=
"group[0] === '.' ? '未分类卡组' : group[0]"
>
<option
*ngFor=
"let deck of group[1]"
[value]=
"deck"
>
{{deck.deck}}
</option>
<option
*ngFor=
"let deck of group[1]"
[value]=
"deck
.symbol
"
>
{{deck.deck}}
</option>
</optgroup>
</optgroup>
</select>
</select>
<span
class=
"input-group-btn"
>
<span
class=
"input-group-btn"
>
...
...
src/app/ygopro/ygopro.component.ts
View file @
61d0a2f8
...
@@ -112,9 +112,24 @@ let matching: Subscription | undefined;
...
@@ -112,9 +112,24 @@ let matching: Subscription | undefined;
let
matching_arena
:
string
|
undefined
;
let
matching_arena
:
string
|
undefined
;
let
match_started_at
:
Date
;
let
match_started_at
:
Date
;
export
interface
DeckAndCategory
{
export
class
DeckAndCategory
{
category
:
string
;
category
:
string
;
deck
:
string
;
deck
:
string
;
get
param
()
{
return
{
category
:
this
.
category
===
'
.
'
?
''
:
this
.
category
,
deck
:
this
.
deck
}
}
get
symbol
()
{
return
`
${
this
.
category
}
/
${
this
.
deck
}
`
;
}
set
symbol
(
str
:
string
)
{
this
.
category
=
path
.
dirname
(
str
);
this
.
deck
=
path
.
basename
(
str
,
'
.ydk
'
);
}
}
}
@
Component
({
@
Component
({
...
@@ -135,6 +150,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -135,6 +150,7 @@ export class YGOProComponent implements OnInit, OnDestroy {
decks_grouped
:
[
string
,
DeckAndCategory
[]][];
decks_grouped
:
[
string
,
DeckAndCategory
[]][];
replays
:
string
[]
=
[];
replays
:
string
[]
=
[];
currentDeck
:
DeckAndCategory
;
currentDeck
:
DeckAndCategory
;
currentDeckSymbol
:
string
;
system_conf
?:
string
;
system_conf
?:
string
;
numfont
:
string
[];
numfont
:
string
[];
...
@@ -441,11 +457,15 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -441,11 +457,15 @@ export class YGOProComponent implements OnInit, OnDestroy {
});
});
}
}
onDeckChange
()
{
this
.
currentDeck
=
this
.
getDeckObject
(
this
.
currentDeckSymbol
);
console
.
log
(
`Current deck changed to
${
this
.
currentDeck
.
symbol
}
`
);
}
async
refresh
(
init
?:
boolean
)
{
async
refresh
(
init
?:
boolean
)
{
this
.
decks
=
await
this
.
get_decks
();
this
.
decks
=
await
this
.
get_decks
();
this
.
decks_grouped
=
this
.
deckGroup
();
this
.
decks_grouped
=
this
.
deckGroup
();
const
allDecks
=
_
.
flatten
(
this
.
decks_grouped
.
map
(
g
=>
g
[
1
]))
;
const
allDecks
=
this
.
decks
;
if
(
this
.
lastDeckFormat
)
{
if
(
this
.
lastDeckFormat
)
{
const
systemConfString
=
await
this
.
load_system_conf
();
const
systemConfString
=
await
this
.
load_system_conf
();
...
@@ -488,6 +508,10 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -488,6 +508,10 @@ export class YGOProComponent implements OnInit, OnDestroy {
this
.
currentDeck
=
allDecks
[
0
];
this
.
currentDeck
=
allDecks
[
0
];
}
}
if
(
this
.
currentDeck
)
{
this
.
currentDeckSymbol
=
this
.
currentDeck
.
symbol
;
}
this
.
replays
=
await
this
.
get_replays
();
this
.
replays
=
await
this
.
get_replays
();
// https://mycard.moe/ygopro/api/user?username=ozxdno
// https://mycard.moe/ygopro/api/user?username=ozxdno
...
@@ -514,10 +538,9 @@ export class YGOProComponent implements OnInit, OnDestroy {
...
@@ -514,10 +538,9 @@ export class YGOProComponent implements OnInit, OnDestroy {
}
}
getDeckObject
(
deckPath
:
string
)
{
getDeckObject
(
deckPath
:
string
)
{
return
{
const
deck
=
new
DeckAndCategory
();
deck
:
path
.
basename
(
deckPath
,
'
.ydk
'
),
deck
.
symbol
=
deckPath
;
category
:
path
.
dirname
(
deckPath
)
return
deck
;
}
}
}
deckGroup
():
[
string
,
DeckAndCategory
[]][]
{
deckGroup
():
[
string
,
DeckAndCategory
[]][]
{
...
...
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